Skip to content

Instantly share code, notes, and snippets.

@guaychou
Last active May 2, 2020 18:01
Show Gist options
  • Save guaychou/4bcac72205231885def0b654c3ad4a0b to your computer and use it in GitHub Desktop.
Save guaychou/4bcac72205231885def0b654c3ad4a0b to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "`date` : Build starting . . . "
mkdir -p ~/Applications/PingService.app/Contents/MacOS
go mod download
GOMAXPROCS=1 go build -o PingService 2>err.log
if [ -s "err.log" ];then
echo -e "`date` : Build failed, check err.log "
exit 2
fi
cp PingService ~/Applications/PingService.app/Contents/MacOS
cat << EOF > ~/Applications/PingService.app/Contents/Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSHighResolutionCapable</key>
<string>True</string>
<!-- avoid showing the app on the Dock -->
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>
EOF
echo -e "`date` : Build Success . . . Find your app, in your home Applications "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment