diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-12-16 22:30:37 -0800 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-12-16 22:30:37 -0800 |
commit | eadd69f8431e96becf970e82228753a325193953 (patch) | |
tree | 5ec0a74e16e2b5d29d72421500945d799efd1914 | |
parent | 99213ef59a676c26c11c1f77be3ffb97bcacb1e0 (diff) | |
download | infinitytier-eadd69f8431e96becf970e82228753a325193953.tar.gz infinitytier-eadd69f8431e96becf970e82228753a325193953.zip |
Mac installer... almost done.
-rwxr-xr-x | buildinstaller.sh | 5 | ||||
-rw-r--r-- | installer.c | 85 | ||||
-rw-r--r-- | make-mac.mk | 5 |
3 files changed, 46 insertions, 49 deletions
diff --git a/buildinstaller.sh b/buildinstaller.sh index 19778222..c2778d65 100755 --- a/buildinstaller.sh +++ b/buildinstaller.sh @@ -76,6 +76,11 @@ case "$system" in ./file2lz4c ext/installfiles/mac/com.zerotier.one.plist mac__com_zerotier_one_plist >installer-build/mac__com_zerotier_one_plist.h ./file2lz4c ext/bin/tap-mac/tap.kext/Contents/Info.plist tap_mac__Info_plist >installer-build/tap_mac__Info_plist.h ./file2lz4c ext/bin/tap-mac/tap.kext/Contents/MacOS/tap tap_mac__tap >installer-build/tap_mac__tap.h + ./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/Info.plist" mac_ui__contents_info_plist >installer-build/mac_ui__contents_info_plist.h + ./file2lz4c "build-ZeroTierUI-release/ZeroTier One.app/Contents/PkgInfo" mac_ui__contents_pkginfo >installer-build/mac_ui__contents_pkginfo.h + ./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 + ./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 + ./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" diff --git a/installer.c b/installer.c index 76542ca6..c9f540d3 100644 --- a/installer.c +++ b/installer.c @@ -71,11 +71,17 @@ #include "installer-build/linux__init_d__zerotier_one.h" #endif -/* Apple Tap device driver and /Applications app */ +/* Apple Tap device driver, launchd plist, and /Applications app */ #ifdef __APPLE__ -#include "installer-build/mac__launch_sh.h" #include "installer-build/tap_mac__Info_plist.h" #include "installer-build/tap_mac__tap.h" +#include "installer-build/mac__launch_sh.h" +#include "installer-build/mac__com_zerotier_one_plist.h" +#include "installer-build/mac_ui__contents_info_plist.h" +#include "installer-build/mac_ui__contents_macos_zerotier_one.h" +#include "installer-build/mac_ui__contents_pkginfo.h" +#include "installer-build/mac_ui__contents_resources_empty_lproj.h" +#include "installer-build/mac_ui__contents_resources_zt1icon_icns.h" #endif /* Windows Tap device drivers for x86 and x64 (installer will be x86) */ @@ -194,11 +200,7 @@ int main(int argc,char **argv) /* Write main ZT1 binary */ sprintf(buf,"%s/zerotier-one",zthome); - if (!putBlob(zerotier_one,buf,1,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(zerotier_one,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Create command line interface symlink */ unlink("/usr/bin/zerotier-cli"); @@ -207,59 +209,48 @@ int main(int argc,char **argv) /* Write uninstall script into home folder */ sprintf(buf,"%s/uninstall.sh",zthome); - if (!putBlob(uninstall_sh,buf,1,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(uninstall_sh,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); #ifdef __APPLE__ /* Write launcher script for Mac */ sprintf(buf,"%s/launch.sh",zthome); - if (!putBlob(mac__launch_sh,buf,1,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(mac__launch_sh,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Add mac to launchd */ sprintf(buf,"/Library/LaunchDaemons/com.zerotier.one.plist"); - if (!putBlob(mac__com_zerotier_one_plist,buf,0,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(mac__com_zerotier_one_plist,buf,0,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Write tap.kext into home folder */ sprintf(buf,"%s/tap.kext",zthome); - mkdir(buf,0755); - chmod(buf,0755); - chown(buf,0,0); - printf("mkdir %s\n",buf); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); sprintf(buf,"%s/tap.kext/Contents",zthome); - mkdir(buf,0755); - chmod(buf,0755); - chown(buf,0,0); - printf("mkdir %s\n",buf); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); sprintf(buf,"%s/tap.kext/Contents/MacOS",zthome); - mkdir(buf,0755); - chmod(buf,0755); - chown(buf,0,0); - printf("mkdir %s\n",buf); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); sprintf(buf,"%s/tap.kext/Contents/Info.plist",zthome); - if (!putBlob(tap_mac__Info_plist,buf,0,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(tap_mac__Info_plist,buf,0,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); sprintf(buf,"%s/tap.kext/Contents/MacOS/tap",zthome); - if (!putBlob(tap_mac__tap,buf,1,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(tap_mac__tap,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Write or update GUI application into /Applications */ + sprintf(buf,"/Applications/ZeroTier One.app"); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents"); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/MacOS"); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/Resources"); + mkdir(buf,0755); chmod(buf,0755); chown(buf,0,0); printf("mkdir %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/Info.plist"); + if (!putBlob(mac_ui__contents_info_plist,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/MacOS/ZeroTier One"); + if (!putBlob(mac_ui__contents_macos_zerotier_one,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/PkgInfo"); + if (!putBlob(mac_ui__contents_pkginfo,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/Resources/empty.lproj"); + if (!putBlob(mac_ui__contents_resources_empty_lproj,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); + sprintf(buf,"/Applications/ZeroTier One.app/Contents/Resources/zt1icon.icns"); + if (!putBlob(mac_ui__contents_resources_zt1icon_icns,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Load script into launchctl, start ZeroTier One */ printf("exec launchctl load /Library/LaunchDaemons/com.zerotier.one.plist"); fflush(stdout); @@ -279,11 +270,7 @@ int main(int argc,char **argv) #ifdef __LINUX__ /* Write Linux init script */ sprintf(buf,"/etc/init.d/zerotier-one"); - if (!putBlob(linux__init_d__zerotier_one,buf,1,0,0)) { - printf("! unable to write %s\n",buf); - return 1; - } - printf("write %s\n",buf); + if (!putBlob(linux__init_d__zerotier_one,buf,1,0,0)) { printf("! unable to write %s\n",buf); return 1; } printf("write %s\n",buf); /* Erase any previous startup/shutdown links */ for(int rl=0;rl<=6;++rl) { diff --git a/make-mac.mk b/make-mac.mk index 607873a9..8a034ab3 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -33,6 +33,11 @@ selftest: $(OBJS) $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.cpp $(OBJS) $(LIBS) $(STRIP) zerotier-selftest +mac-ui: FORCE + mkdir -p build-ZeroTierUI-release + cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4 + strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One" + install-mac-tap: FORCE mkdir -p /Library/Application\ Support/ZeroTier/One rm -rf /Library/Application\ Support/ZeroTier/One/tap.kext |