mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-20 09:46:13 +00:00
Linux install and uninstall seem to work.
This commit is contained in:
parent
15375ef6b9
commit
165bc589fd
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@ mac-tap/tuntap/tap.kext
|
||||
*.tlog
|
||||
/installer-build
|
||||
/zt1-*-install
|
||||
/file2lz4c
|
||||
|
@ -38,6 +38,9 @@ idtool: $(OBJS)
|
||||
file2lz4c: ext/lz4/lz4hc.o FORCE
|
||||
$(CXX) $(CXXFLAGS) -o file2lz4c file2lz4c.cpp node/Utils.cpp node/Salsa20.cpp ext/lz4/lz4hc.o
|
||||
|
||||
installer: one FORCE
|
||||
./buildinstaller.sh
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS) file2lz4c zerotier-* zt1-*-install
|
||||
rm -rf installer-build
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
make -j 4 one file2lz4c
|
||||
make file2lz4c
|
||||
|
||||
if [ ! -f file2lz4c ]; then
|
||||
echo "Build of file2lz4c utility failed, aborting installer build."
|
||||
@ -8,7 +8,7 @@ if [ ! -f file2lz4c ]; then
|
||||
fi
|
||||
|
||||
if [ ! -f zerotier-one ]; then
|
||||
echo "Build of zerotier-one failed, aborting installer build."
|
||||
echo "Could not find 'zerotier-one' binary, please build before running this script."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
@ -50,10 +50,10 @@ case "$system" in
|
||||
./file2lz4c installer/linux/uninstall.sh uninstall_sh >installer-build/uninstall_sh.h
|
||||
./file2lz4c installer/linux/init.d/zerotier-one linux__init_d__zerotier_one >installer-build/linux__init_d__zerotier_one.h
|
||||
|
||||
ls -l installer-build
|
||||
|
||||
g++ -Os -o "zt1-${vmajor}_${vminor}_${revision}-linux-${machine}-install" installer.cpp ext/lz4/lz4.o ext/lz4/lz4hc.o
|
||||
|
||||
ls -l zt1-*-install
|
||||
|
||||
;;
|
||||
|
||||
Darwin)
|
||||
|
@ -69,8 +69,8 @@ int main(int argc,char **argv)
|
||||
for(int i=0;i<complen;++i) {
|
||||
if (!(i % 15))
|
||||
std::cout << std::endl << '\t';
|
||||
Utils::snprintf(tmp,sizeof(tmp),"%.2x",(unsigned int)compbuf[i]);
|
||||
std::cout << "0x" << tmp;
|
||||
Utils::snprintf(tmp,sizeof(tmp),"0x%.2x",(unsigned int)compbuf[i]);
|
||||
std::cout << tmp;
|
||||
if (i != (complen - 1))
|
||||
std::cout << ',';
|
||||
}
|
||||
|
@ -90,7 +90,7 @@
|
||||
static unsigned char *_unlz4(const void *lz4,int decompressedLen)
|
||||
{
|
||||
unsigned char *buf = new unsigned char[decompressedLen];
|
||||
if (LZ4_decompress_fast((const char *)lz4,(char *)buf,decompressedLen) != decompressedLen) {
|
||||
if (LZ4_decompress_fast((const char *)lz4,(char *)buf,decompressedLen) <= 0) {
|
||||
delete [] buf;
|
||||
return (unsigned char *)0;
|
||||
}
|
||||
@ -173,6 +173,10 @@ int main(int argc,char **argv)
|
||||
chown(buf,0,0);
|
||||
printf("write %s\n",buf);
|
||||
|
||||
unlink("/usr/bin/zerotier-cli");
|
||||
symlink(buf,"/usr/bin/zerotier-cli");
|
||||
printf("link %s /usr/bin/zerotier-cli\n",buf);
|
||||
|
||||
sprintf(buf,"%s/uninstall.sh",zthome);
|
||||
if (!putBlob(uninstall_sh,buf)) {
|
||||
printf("! unable to write %s\n",buf);
|
||||
@ -236,6 +240,8 @@ int main(int argc,char **argv)
|
||||
printf("link /etc/init.d/zerotier-one /etc/rc4.d/S11zerotier-one\n");
|
||||
symlink("/etc/init.d/zerotier-one","/etc/rc5.d/S11zerotier-one");
|
||||
printf("link /etc/init.d/zerotier-one /etc/rc5.d/S11zerotier-one\n");
|
||||
symlink("/etc/init.d/zerotier-one","/etc/rc6.d/S11zerotier-one");
|
||||
printf("link /etc/init.d/zerotier-one /etc/rc6.d/S11zerotier-one\n");
|
||||
#endif
|
||||
|
||||
printf("# Done!\n");
|
||||
|
@ -56,7 +56,7 @@ fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ $running -eq 0 ]; then
|
||||
if [ $running -gt 0 ]; then
|
||||
echo "ZeroTier One already running."
|
||||
exit 0
|
||||
fi
|
||||
|
@ -9,7 +9,7 @@ fi
|
||||
|
||||
echo
|
||||
|
||||
echo "Going to uninstall zerotier-one, hit CTRL+C to abort."
|
||||
echo "This will uninstall ZeroTier One, hit CTRL+C to abort."
|
||||
echo "Waiting 5 seconds..."
|
||||
sleep 5
|
||||
|
||||
@ -18,15 +18,18 @@ killall -q -TERM zerotier-one
|
||||
sleep 2
|
||||
killall -q -KILL zerotier-one
|
||||
|
||||
echo "Erasing binary and support files..."
|
||||
cd /var/lib/zerotier-one
|
||||
rm -fv zerotier-one *.persist authtoken.secret identity.public *.log
|
||||
rm -rfv updates.d networks.d iddb.d
|
||||
|
||||
echo "Removing init items..."
|
||||
echo "Removing SysV init items..."
|
||||
rm -fv /etc/init.d/zerotier-one
|
||||
find /etc/rc*.d -name '???zerotier-one' -print0 | xargs -0 rm -fv
|
||||
|
||||
echo "Erasing binary and support files..."
|
||||
cd /var/lib/zerotier-one
|
||||
rm -fv zerotier-one *.persist authtoken.secret identity.public *.log *.pid
|
||||
rm -rfv updates.d networks.d iddb.d
|
||||
|
||||
echo "Erasing anything installed into system bin directories..."
|
||||
rm -fv /usr/local/bin/zerotier-* /usr/bin/zerotier-*
|
||||
|
||||
echo "Done."
|
||||
echo
|
||||
echo "Your ZeroTier One identity is still preserved in /var/lib/zerotier-one"
|
||||
|
Loading…
x
Reference in New Issue
Block a user