mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 12:06:55 +02:00
Installer work for mac.
This commit is contained in:
parent
50ef47cf0a
commit
27a5237462
2 changed files with 36 additions and 5 deletions
|
@ -67,7 +67,9 @@ case "$system" in
|
|||
Darwin)
|
||||
echo "Assembling mac installer for x86/x64 (combined) and ZT1 version $vmajor.$vminor.$revision"
|
||||
|
||||
./file2lz4c ext/installfiles/linux/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h
|
||||
./file2lz4c ext/installfiles/mac/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h
|
||||
./file2lz4c ext/installfiles/mac/launch.sh mac__launch_sh >installer-build/mac__launch_sh.h
|
||||
./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
|
||||
|
||||
|
|
37
installer.c
37
installer.c
|
@ -72,6 +72,7 @@
|
|||
|
||||
/* Apple Tap device driver 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"
|
||||
#endif
|
||||
|
@ -212,6 +213,22 @@ int main(int argc,char **argv)
|
|||
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);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Write tap.kext into home folder */
|
||||
sprintf(buf,"%s/tap.kext",zthome);
|
||||
mkdir(buf,0755);
|
||||
|
@ -243,7 +260,19 @@ int main(int argc,char **argv)
|
|||
|
||||
/* Write or update GUI application into /Applications */
|
||||
|
||||
/* Write Apple startup item stuff, set to start on boot */
|
||||
/* Load script into launchctl, start ZeroTier One */
|
||||
printf("exec launchctl load /Library/LaunchDaemons/com.zerotier.one.plist"); fflush(stdout);
|
||||
long launchctlpid = (long)vfork();
|
||||
if (launchctlpid == 0) {
|
||||
execl("/bin/launchctl","/bin/launchctl","load","/Library/LaunchDaemons/com.zerotier.one.plist",(char *)0);
|
||||
execlp("launchctl","launchctl","load","/Library/LaunchDaemons/com.zerotier.one.plist",(char *)0); /* reached if execl() with full path fails */
|
||||
exit(0); /* never reached on successful execl() or execlp() */
|
||||
}
|
||||
if (launchctlpid > 0) {
|
||||
int exitcode = 0;
|
||||
waitpid(launchctlpid,&exitcode,0);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
#ifdef __LINUX__
|
||||
|
@ -272,12 +301,12 @@ int main(int argc,char **argv)
|
|||
|
||||
printf("# Done!\n");
|
||||
|
||||
/* -s causes this to (re?)start ZeroTier One after install/update */
|
||||
/* -s causes this to exec() itself to ZeroTier One after install/update */
|
||||
if ((argc > 1)&&(!strcmp(argv[1],"-s"))) {
|
||||
sprintf(buf,"%s/zerotier-one",zthome);
|
||||
printf("> -s specified, proceeding to exec(%s)\n",zthome);
|
||||
printf("# -s specified, proceeding to exec(%s)\n",zthome);
|
||||
execl(buf,buf,(char *)0);
|
||||
return 3;
|
||||
return 3; /* never reached on successful execl() */
|
||||
}
|
||||
|
||||
#endif /* __UNIX_LIKE__ ****************************************************/
|
||||
|
|
Loading…
Add table
Reference in a new issue