mig/tools/osx-loader-pkg-postinstall.sh

40 строки
633 B
Bash
Executable File

#!/usr/bin/env bash
loaderkeyfile="/etc/mig/mig-loader.key"
chk() {
if [[ -z "$1" ]]; then
return 0
fi
return 1
}
cnt=0
while true; do
buf=$(osascript << EOF
display dialog "Please enter MIG registration token" default answer ""
set ret to text returned of result
return ret
EOF
)
cnt=`expr $cnt + 1`
chk $buf
if [[ $? == "1" ]]; then
break
fi
if [[ $cnt -eq 3 ]]; then
break
fi
done
echo $buf > $loaderkeyfile
# Run the loader once as part of startup
/usr/local/bin/mig-loader
pl=/Library/LaunchAgents/com.mozilla.mig-loader.plist
launchctl unload $pl
launchctl load $pl
launchctl start mig-loader
exit 0