Mac installer work.

This commit is contained in:
Adam Ierymenko 2014-01-03 16:53:00 -08:00
parent 50043f9cd6
commit 63d6052159
5 changed files with 50 additions and 56 deletions

8
.gitignore vendored
View File

@ -6,10 +6,8 @@
.DS_Store .DS_Store
.Apple* .Apple*
*.dSYM *.dSYM
netconf-service/netconf-test /netconf-service/netconf-test
netconf-service/netconf.service /netconf-service/netconf.service
mac-tap/tuntap/src/tap/tap
mac-tap/tuntap/tap.kext
/ipch /ipch
/ZeroTierOne.sdf /ZeroTierOne.sdf
/ZeroTierOne.v11.suo /ZeroTierOne.v11.suo
@ -31,6 +29,6 @@ mac-tap/tuntap/tap.kext
*.obj *.obj
*.tlog *.tlog
/build-* /build-*
/ZeroTierOne-*-install /ZeroTierOneInstaller-*
.qmake.stash .qmake.stash
*.autosave *.autosave

View File

@ -120,7 +120,7 @@ void MainWindow::timerEvent(QTimerEvent *event)
} }
#endif #endif
if (!ZeroTier::Utils::readFile(dotAuthFile.c_str(),authToken)) { if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One.\n\nTo do so manually, copy 'authtoken.secret' from the ZeroTier One home directory to '.zeroTierOneAuthToken' in your home directory and set file modes on this file to only be readable by you (e.g. 0600 on Mac or Linux systems).",QMessageBox::Ok,QMessageBox::NoButton); QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One.\n\nTo do so manually, copy 'authtoken.secret' from the ZeroTier One home directory to '.zeroTierOneAuthToken' in your home directory and set file modes on this file to only be readable by you (e.g. 0600 on Mac or Linux systems).",QMessageBox::Ok,QMessageBox::NoButton);
QApplication::exit(1); QApplication::exit(1);
return; return;
@ -132,7 +132,7 @@ void MainWindow::timerEvent(QTimerEvent *event)
// TODO: do something more user-friendly here... or maybe try to restart // TODO: do something more user-friendly here... or maybe try to restart
// the service? // the service?
if (++this->cyclesSinceResponseFromService == 3) if (++this->cyclesSinceResponseFromService == 4)
QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton); QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
zeroTierClient->send("info"); zeroTierClient->send("info");

View File

@ -3,17 +3,13 @@
# This script builds the installer for *nix systems. Windows must do everything # This script builds the installer for *nix systems. Windows must do everything
# completely differently, as usual. # completely differently, as usual.
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ ! -f zerotier-one ]; then if [ ! -f zerotier-one ]; then
echo "Could not find 'zerotier-one' binary, please build before running this script." echo "Could not find 'zerotier-one' binary, please build before running this script."
exit 2 exit 2
fi fi
make -j 2 file2lz4c
if [ ! -f file2lz4c ]; then
echo "Build of file2lz4c utility failed, aborting installer build."
exit 2
fi
machine=`uname -m` machine=`uname -m`
system=`uname -s` system=`uname -s`
@ -26,12 +22,8 @@ if [ -z "$vmajor" -o -z "$vminor" -o -z "$revision" ]; then
exit 2 exit 2
fi fi
echo "Packaging common files: zerotier-one" rm -rf build-installer
mkdir build-installer
rm -rf installer-build
mkdir installer-build
./file2lz4c zerotier-one zerotier_one >installer-build/zerotier_one.h
case "$system" in case "$system" in
@ -51,44 +43,48 @@ case "$system" in
exit 2 exit 2
esac esac
echo "Assembling Linux installer for $machine and ZT1 version $vmajor.$vminor.$revision" echo "Assembling Linux installer for $machine and version $vmajor.$vminor.$revision"
./file2lz4c ext/installfiles/linux/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h mkdir -p 'build-installer/var/lib/zerotier-one'
./file2lz4c ext/installfiles/linux/init.d/zerotier-one linux__init_d__zerotier_one >installer-build/linux__init_d__zerotier_one.h cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one'
cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one'
mkdir -p 'build-installer/etc/init.d'
cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/etc/init.d'
targ="zt1-${vmajor}_${vminor}_${revision}-linux-${machine}-install" targ="ZeroTierOneInstaller-linux-${machine}-${vmajor}_${vminor}_${revision}"
rm -f build-installer-tmp.tar.gz
if [ -e /usr/bin/clang ]; then cd build-installer
clang -Os -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o tar -cf - * | gzip -9 >../build-installer-tmp.tar.gz
else cd ..
gcc -Os -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o rm -f $targ
fi cat ext/installfiles/linux/install.tmpl.sh build-installer-tmp.tar.gz >$targ
strip --strip-all $targ rm -f build-installer-tmp.tar.gz
ls -l $targ
;; ;;
Darwin) Darwin)
echo "Assembling mac installer for x86/x64 (combined) and ZT1 version $vmajor.$vminor.$revision" echo "Assembling mac installer for x86/x64 (combined) version $vmajor.$vminor.$revision"
./file2lz4c ext/installfiles/mac/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h mkdir -p 'build-installer/Applications'
./file2lz4c ext/installfiles/mac/launch.sh mac__launch_sh >installer-build/mac__launch_sh.h cp -a 'build-ZeroTierUI-release/ZeroTier One.app' 'build-installer/Applications'
./file2lz4c ext/installfiles/mac/com.zerotier.one.plist mac__com_zerotier_one_plist >installer-build/mac__com_zerotier_one_plist.h mv -f 'build-installer/Applications/ZeroTier One.app' 'build-installer/Applications/ZeroTier One_app.LATEST'
./file2lz4c ext/bin/tap-mac/tap.kext/Contents/Info.plist tap_mac__Info_plist >installer-build/tap_mac__Info_plist.h mkdir -p 'build-installer/Library/Application Support/ZeroTier/One'
./file2lz4c ext/bin/tap-mac/tap.kext/Contents/MacOS/tap tap_mac__tap >installer-build/tap_mac__tap.h cp -fp 'ext/installfiles/mac/uninstall.sh' 'build-installer/Library/Application Support/ZeroTier/One'
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Info.plist" mac_ui__contents_info_plist >installer-build/mac_ui__contents_info_plist.h cp -fp 'ext/installfiles/mac/launch.sh' 'build-installer/Library/Application Support/ZeroTier/One'
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/PkgInfo" mac_ui__contents_pkginfo >installer-build/mac_ui__contents_pkginfo.h cp -fp 'zerotier-one' 'build-installer/Library/Application Support/ZeroTier/One'
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One" mac_ui__contents_macos_zerotier_one >installer-build/mac_ui__contents_macos_zerotier_one.h mkdir -p 'build-installer/Library/LaunchDaemons'
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/empty.lproj" mac_ui__contents_resources_empty_lproj >installer-build/mac_ui__contents_resources_empty_lproj.h cp -fp 'ext/installfiles/mac/com.zerotier.one.plist' 'build-installer/Library/LaunchDaemons'
./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/zt1icon.icns" mac_ui__contents_resources_zt1icon_icns >installer-build/mac_ui__contents_resources_zt1icon_icns.h
targ="zt1-${vmajor}_${vminor}_${revision}-mac-combined-install" targ="ZeroTierOneInstaller-mac-combined-${vmajor}_${vminor}_${revision}"
rm -f build-installer-tmp.tar.bz2
# Installer can be i386-only to save space, but installs combined cd build-installer
# x86/x64 binaries for ZT1 itself. find . -type f -name .DS_Store -print0 | xargs -0 rm -f
clang -Os -arch i386 -o $targ installer.c ext/lz4/lz4.o ext/lz4/lz4hc.o tar -cf - * | bzip2 -9 >../build-installer-tmp.tar.bz2
strip $targ cd ..
ls -l $targ rm -f $targ
cat ext/installfiles/mac/install.tmpl.sh build-installer-tmp.tar.bz2 >$targ
chmod 0755 $targ
rm -f build-installer-tmp.tar.bz2
;; ;;

View File

@ -37,7 +37,7 @@ if [ ! -r "$scriptPath" ]; then
fi fi
fi fi
endMarkerIndex=`grep -b -E '^################' "$scriptPath" | head -n 1 | cut -d : -f 1` endMarkerIndex=`grep -a -b -E '^################' "$scriptPath" | head -c 16 | cut -d : -f 1`
if [ "$endMarkerIndex" -le 100 ]; then if [ "$endMarkerIndex" -le 100 ]; then
echo 'Internal error: unable to find end of script / start of binary data marker.' echo 'Internal error: unable to find end of script / start of binary data marker.'
exit 2 exit 2
@ -55,7 +55,7 @@ else
tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xvop -C / -f - tail -c +$blobStart "$scriptPath" | bunzip2 -c | tar -xvop -C / -f -
fi fi
if [ $dryRun -eq 0 -a ! -d "/Applications/ZeroTierOne_app.LATEST" ]; then if [ $dryRun -eq 0 -a ! -d "/Applications/ZeroTier One_app.LATEST" ]; then
echo 'Archive extraction failed, cannot find zerotier-one binary.' echo 'Archive extraction failed, cannot find zerotier-one binary.'
exit 2 exit 2
fi fi
@ -69,16 +69,16 @@ if [ -d "$ztapp" ]; then
currentAppGroup=`stat -f '%g' "$ztapp"` currentAppGroup=`stat -f '%g' "$ztapp"`
if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then if [ ! -z "$currentAppOwner" -a ! -z "$currentAppGroup" ]; then
rm -rf "$ztapp" rm -rf "$ztapp"
mv -f "/Application/ZeroTierOne_app.LATEST" "$ztapp" mv -f "/Application/ZeroTier One_app.LATEST" "$ztapp"
chown -R $currentAppOwner "$ztapp" chown -R $currentAppOwner "$ztapp"
chgrp -R $currentAppGroup "$ztapp" chgrp -R $currentAppGroup "$ztapp"
else else
rm -rf "$ztapp" rm -rf "$ztapp"
mv -f "/Application/ZeroTierOne_app.LATEST" "$ztapp" mv -f "/Application/ZeroTier One_app.LATEST" "$ztapp"
fi fi
else else
# If there is no existing app, just drop the shipped one into place # If there is no existing app, just drop the shipped one into place
mv -f "/Applications/ZeroTierOne_app.LATEST" "/Applications/ZeroTierOne.app" mv -f "/Applications/ZeroTier One_app.LATEST" "/Applications/ZeroTier One.app"
fi fi
echo 'Installing zerotier-cli command line utility...' echo 'Installing zerotier-cli command line utility...'

View File

@ -41,7 +41,7 @@ mac-ui: FORCE
cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4 cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4
strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One" strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One"
cp -Rv ZeroTierUI/helpers "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources" cp -Rv ZeroTierUI/helpers "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources"
cd build-ZeroTierUI-release ; codesign -f -s '3rd Party Mac Developer Application: ZeroTier Networks LLC' "ZeroTier One.app" # cd build-ZeroTierUI-release ; codesign -f -s '3rd Party Mac Developer Application: ZeroTier Networks LLC' "ZeroTier One.app"
install-mac-tap: FORCE install-mac-tap: FORCE
mkdir -p /Library/Application\ Support/ZeroTier/One mkdir -p /Library/Application\ Support/ZeroTier/One
@ -50,6 +50,6 @@ install-mac-tap: FORCE
chown -R root:wheel /Library/Application\ Support/ZeroTier/One/tap.kext chown -R root:wheel /Library/Application\ Support/ZeroTier/One/tap.kext
clean: clean:
rm -rf *.dSYM build-ZeroTierUI-* $(OBJS) file2lz4c zerotier-* installer-build zt1-*-install rm -rf *.dSYM build-* $(OBJS) zerotier-* ZeroTierOneInstaller-*
FORCE: FORCE: