mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-14 18:48:36 -07:00
Stash old Linux binary installer stuff in attic. This is going away.
This commit is contained in:
parent
4d13ddd48c
commit
506c74270c
8 changed files with 0 additions and 264 deletions
|
@ -1,12 +0,0 @@
|
|||
Package: zerotier-one
|
||||
Architecture: __ARCH__
|
||||
Maintainer: ZeroTier, Inc. <contact@zerotier.com>
|
||||
Priority: optional
|
||||
Version: __VERSION__
|
||||
Installed-Size: 1024
|
||||
Homepage: https://github.com/zerotier/ZeroTierOne
|
||||
Description: ZeroTier One network virtualization service
|
||||
ZeroTier One is a fast, secure, and easy to use peer to peer network
|
||||
virtualization engine that provides global-scale software defined
|
||||
networking to any device or application. Visit https://www.zerotier.com/
|
||||
for more information.
|
|
@ -1,24 +0,0 @@
|
|||
This folder contains two spec files which enable building of various RPM packages for ZeroTier.
|
||||
|
||||
#zerotier-one.spec.in
|
||||
This file contains the information to build an RPM from the bash based binary installer of ZeroTier. The resulting RPM cannot be recompiled to different architectures.
|
||||
|
||||
#zerotier.spec
|
||||
This spec file is a “standard” RPM spec file. It fits to the common rpmbuild process, SRPM and differnt architectures are supported too. The spec file can be used to build two packages: the standard zerotier and the zerotier-controller. It supports some of the build options exposed in the original Linux makefile:
|
||||
|
||||
> `rpmbuild -ba zerotier.spec` #builds the standard zerotier package, this is what you need in most of the cases
|
||||
|
||||
> `rpmbuild -ba zerotier.spec --with controller` #builds the zerotier-controller package
|
||||
|
||||
> `rpmbuild -ba zerotier.spec --with debug` #builds the zerotier package with debug enable<>d
|
||||
|
||||
> `rpmbuild -ba zerotier.spec --with miniupnpc` #builds the zerotier package with miniupnpc enabled
|
||||
|
||||
> `rpmbuild -ba zerotier.spec --with cluster` #builds the zerotier package with cluster enabled
|
||||
|
||||
|
||||
####Build environment preparation
|
||||
As zerotier is not distributed in tar.gz format at the moment, the %prep section of the spec file takes care about the prepartion of an rpmbuild compatible tar.gz.
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
Name: zerotier-one
|
||||
Summary: ZeroTier One network virtualization service
|
||||
Version: __VERSION__
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3
|
||||
URL: https://www.zerotier.com/
|
||||
|
||||
%description
|
||||
ZeroTier One creates virtual Ethernet networks that work anywhere and everywhere.
|
||||
Visit https://www.zerotier.com/ for more information.
|
||||
|
||||
%prep
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/zerotier-one/updates.d
|
||||
cp -f $OLDPWD/__INSTALLER__ $RPM_BUILD_ROOT/var/lib/zerotier-one/updates.d
|
||||
|
||||
%pre
|
||||
mkdir -p /var/lib/zerotier-one/updates.d
|
||||
|
||||
%files
|
||||
/var/lib/zerotier-one/updates.d/__INSTALLER__
|
||||
|
||||
%post
|
||||
chmod 0755 /var/lib/zerotier-one/updates.d/__INSTALLER__
|
||||
/var/lib/zerotier-one/updates.d/__INSTALLER__ >>/dev/null 2>&1
|
||||
|
||||
%preun
|
||||
if [ "$1" -lt 1 ]; then
|
||||
/var/lib/zerotier-one/uninstall.sh >>/dev/null 2>&1
|
||||
fi
|
||||
|
||||
%clean
|
||||
cp -f %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm $OLDPWD
|
||||
rm -f %{_rpmdir}/%{_arch}/%{name}-%{version}-%{release}.%{_arch}.rpm
|
||||
rm -rf $RPM_BUILD_ROOT
|
|
@ -1,194 +0,0 @@
|
|||
# add --with controller option to build controller (builds zerotier-controller package)
|
||||
%bcond_with controller
|
||||
# add --with miniupnpc option to enable the miniupnpc option during build
|
||||
%bcond_with miniupnpc
|
||||
# add --with cluster option to enable the cluster option during build
|
||||
%bcond_with cluster
|
||||
# add --with debug option to enable the debug option during build
|
||||
%bcond_with debug
|
||||
%if %{with controller}
|
||||
Name:zerotier-controller
|
||||
Conflicts:zerotier
|
||||
%else
|
||||
Name:zerotier
|
||||
Conflicts:zerotier-controller
|
||||
%endif
|
||||
Version: 1.1.4
|
||||
Release: 1
|
||||
Summary: Network Virtualization Everywhere https://www.zerotier.com/
|
||||
Group: network
|
||||
License: GPLv3
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
Provides: zerotier-one
|
||||
Source0: http:///download/%{name}-%{version}.tar.gz
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
%if %{with server}
|
||||
BuildRequires: sqlite-devel
|
||||
BuildRequires: wget
|
||||
BuildRequires: unzip
|
||||
Requires: sqlite
|
||||
%endif
|
||||
%description
|
||||
ZeroTier One creates virtual Ethernet networks that work anywhere and everywhere.
|
||||
Visit https://www.zerotier.com/ for more information.
|
||||
|
||||
%prep
|
||||
cd `mktemp -d`
|
||||
wget -O master.zip https://github.com/zerotier/ZeroTierOne/archive/master.zip
|
||||
unzip master.zip
|
||||
mv ZeroTierOne-master zerotier-1.1.4
|
||||
ln -s zerotier-1.1.4 zerotier-controller-1.1.4
|
||||
tar zcvf zerotier-1.1.4.tar.gz zerotier-1.1.4 zerotier-controller-1.1.4
|
||||
ln -s zerotier-1.1.4.tar.gz zerotier-controller-1.1.4.tar.gz
|
||||
mv zero*.tar.gz ~/rpmbuild/SOURCES
|
||||
cd -
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%if %{with miniupnpc}
|
||||
ZT_USE_MINIUPNPC=1; export ZT_USE_MINIUPNPC;
|
||||
%endif
|
||||
|
||||
%if %{with controller}
|
||||
ZT_ENABLE_NETWORK_CONTROLLER=1; export ZT_ENABLE_NETWORK_CONTROLLER;
|
||||
%endif
|
||||
|
||||
%if %{with cluster}
|
||||
export ZT_ENABLE_CLUSTER=1
|
||||
%endif
|
||||
|
||||
%if %{with debug}
|
||||
export ZT_DEBUG=1
|
||||
%endif
|
||||
|
||||
make
|
||||
|
||||
%install
|
||||
|
||||
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
rm -f $RPM_BUILD_ROOT%{_prefix}/bin/zerotier-idtool $RPM_BUILD_ROOT%{_prefix}/bin/zerotier-idtool
|
||||
echo 'Install...'
|
||||
mkdir -p $RPM_BUILD_ROOT%{_vardir}/lib/zerotier-one/initfiles/{init.d,systemd}
|
||||
install -m 0755 -D zerotier-one -t $RPM_BUILD_ROOT%{_vardir}/lib/zerotier-one/
|
||||
install -m 0755 -D ext/installfiles/linux/init.d/* -t $RPM_BUILD_ROOT%{_vardir}/lib/zerotier-one/initfiles/init.d/
|
||||
install -m 0755 -D ext/installfiles/linux/systemd/* -t $RPM_BUILD_ROOT%{_vardir}/lib/zerotier-one/initfiles/systemd/
|
||||
|
||||
|
||||
|
||||
%posttrans
|
||||
echo -n 'Getting version of new install... '
|
||||
newVersion=`/var/lib/zerotier-one/zerotier-one -v`
|
||||
echo $newVersion
|
||||
|
||||
echo 'Creating symlinks...'
|
||||
|
||||
rm -f /usr/bin/zerotier-cli /usr/bin/zerotier-idtool
|
||||
ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-cli
|
||||
ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-idtool
|
||||
echo 'Installing zerotier-one service...'
|
||||
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
# Second check: test if systemd appears to actually be running. Apparently Ubuntu
|
||||
# thought it was a good idea to ship with systemd installed but not used. Issue #133
|
||||
if [ -d /var/run/systemd/system -o -d /run/systemd/system ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
# SYSTEMD
|
||||
|
||||
# If this was updated or upgraded from an init.d based system, clean up the old
|
||||
# init.d stuff before installing directly via systemd.
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
if [ -e /sbin/chkconfig -o -e /usr/sbin/chkconfig -o -e /bin/chkconfig -o -e /usr/bin/chkconfig ]; then
|
||||
chkconfig zerotier-one off
|
||||
fi
|
||||
rm -f /etc/init.d/zerotier-one
|
||||
fi
|
||||
|
||||
cp -f /var/lib/zerotier-one/initfiles/systemd/zerotier-one.service "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chown 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chgrp 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chmod 0755 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
|
||||
systemctl enable zerotier-one.service
|
||||
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo systemctl restart zerotier-one.service'
|
||||
else
|
||||
# SYSV INIT -- also covers upstart which supports SysVinit backward compatibility
|
||||
|
||||
cp -f /var/lib/zerotier-one/initfiles/init.d/zerotier-one /etc/init.d/zerotier-one
|
||||
chmod 0755 /etc/init.d/zerotier-one
|
||||
|
||||
if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /usr/bin/chkconfig -o -f /bin/chkconfig ]; then
|
||||
chkconfig zerotier-one on
|
||||
else
|
||||
# Yes Virginia, some systems lack chkconfig.
|
||||
if [ -d /etc/rc0.d ]; then
|
||||
rm -f /etc/rc0.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc0.d/K89zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc1.d ]; then
|
||||
rm -f /etc/rc1.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc1.d/K89zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc2.d ]; then
|
||||
rm -f /etc/rc2.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc2.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc3.d ]; then
|
||||
rm -f /etc/rc3.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc3.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc4.d ]; then
|
||||
rm -f /etc/rc4.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc4.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc5.d ]; then
|
||||
rm -f /etc/rc5.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc5.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc6.d ]; then
|
||||
rm -f /etc/rc6.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc6.d/K89zerotier-one
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo service zerotier-one restart'
|
||||
fi
|
||||
%preun
|
||||
/sbin/chkconfig --del zerotier-one
|
||||
rm -f /usr/bin/zerotier-cli /usr/bin/zerotier-idtool
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%files
|
||||
%{_vardir}/lib/zerotier-one/zerotier-one
|
||||
%{_vardir}/lib/zerotier-one/initfiles/systemd/zerotier-one.service
|
||||
%{_vardir}/lib/zerotier-one/initfiles/init.d/zerotier-one
|
||||
|
||||
%changelog
|
||||
* Fri Feb 26 2016 Kristof Imre Szabo <kristof.szabo@lxsystems.de> 1.1.4-1
|
||||
- initial package
|
|
@ -1,134 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script builds the installer for *nix systems. Windows must do everything
|
||||
# completely differently, as usual.
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
if [ ! -f zerotier-one ]; then
|
||||
echo "Could not find 'zerotier-one' binary, please build before running this script."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
machine=`uname -m`
|
||||
system=`uname -s`
|
||||
|
||||
vmajor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MAJOR | cut -d ' ' -f 3`
|
||||
vminor=`cat version.h | grep -F ZEROTIER_ONE_VERSION_MINOR | cut -d ' ' -f 3`
|
||||
revision=`cat version.h | grep -F ZEROTIER_ONE_VERSION_REVISION | cut -d ' ' -f 3`
|
||||
|
||||
if [ -z "$vmajor" -o -z "$vminor" -o -z "$revision" ]; then
|
||||
echo "Unable to extract version info from version.h, aborting installer build."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -rf build-installer
|
||||
mkdir build-installer
|
||||
|
||||
case "$system" in
|
||||
|
||||
Linux)
|
||||
# Canonicalize $machine for some architectures... we use x86
|
||||
# and x64 for Intel stuff. ARM and others should be fine if
|
||||
# we ever ship officially for those.
|
||||
debian_arch=$machine
|
||||
case "$machine" in
|
||||
i386|i486|i586|i686)
|
||||
machine="x86"
|
||||
debian_arch="i386"
|
||||
;;
|
||||
x86_64|amd64|x64)
|
||||
machine="x64"
|
||||
debian_arch="amd64"
|
||||
;;
|
||||
armv6l|arm|armhf|arm7l|armv7l)
|
||||
machine="armv6l"
|
||||
debian_arch="armhf"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Assembling Linux installer for $machine and version $vmajor.$vminor.$revision"
|
||||
|
||||
mkdir -p 'build-installer/var/lib/zerotier-one/ui'
|
||||
cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one'
|
||||
cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one'
|
||||
for f in ui/*.html ui/*.js ui/*.css ui/*.jsx ; do
|
||||
cp -fp "$f" 'build-installer/var/lib/zerotier-one/ui'
|
||||
done
|
||||
mkdir -p 'build-installer/tmp'
|
||||
cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/tmp/init.d_zerotier-one'
|
||||
cp -fp 'ext/installfiles/linux/systemd/zerotier-one.service' 'build-installer/tmp/systemd_zerotier-one.service'
|
||||
|
||||
targ="ZeroTierOneInstaller-linux-${machine}-${vmajor}_${vminor}_${revision}"
|
||||
# Use gzip in Linux since some minimal Linux systems do not have bunzip2
|
||||
rm -f build-installer-tmp.tar.gz
|
||||
cd build-installer
|
||||
tar -cf - * | gzip -9 >../build-installer-tmp.tar.gz
|
||||
cd ..
|
||||
rm -f $targ
|
||||
cat ext/installfiles/linux/install.tmpl.sh build-installer-tmp.tar.gz >$targ
|
||||
chmod 0755 $targ
|
||||
rm -f build-installer-tmp.tar.gz
|
||||
ls -l $targ
|
||||
|
||||
if [ -f /usr/bin/dpkg-deb -a "$UID" -eq 0 ]; then
|
||||
echo
|
||||
echo Found dpkg-deb and you are root, trying to build Debian package.
|
||||
|
||||
rm -rf build-installer-deb
|
||||
|
||||
debbase="build-installer-deb/zerotier-one_${vmajor}.${vminor}.${revision}_$debian_arch"
|
||||
debfolder="${debbase}/DEBIAN"
|
||||
mkdir -p $debfolder
|
||||
|
||||
cat 'ext/installfiles/linux/DEBIAN/control.in' | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}/" | sed "s/__ARCH__/${debian_arch}/" >$debfolder/control
|
||||
cat $debfolder/control
|
||||
cp -f 'ext/installfiles/linux/DEBIAN/conffiles' "${debfolder}/conffiles"
|
||||
|
||||
mkdir -p "${debbase}/var/lib/zerotier-one/updates.d"
|
||||
cp -f $targ "${debbase}/var/lib/zerotier-one/updates.d"
|
||||
|
||||
rm -f "${debfolder}/postinst" "${debfolder}/prerm"
|
||||
|
||||
echo '#!/bin/bash' >${debfolder}/postinst
|
||||
echo "/var/lib/zerotier-one/updates.d/${targ} >>/dev/null 2>&1" >>${debfolder}/postinst
|
||||
echo "/bin/rm -f /var/lib/zerotier-one/updates.d/*" >>${debfolder}/postinst
|
||||
chmod a+x ${debfolder}/postinst
|
||||
|
||||
echo '#!/bin/bash' >${debfolder}/prerm
|
||||
echo 'export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin' >>${debfolder}/prerm
|
||||
echo 'if [ "$1" != "upgrade" ]; then' >>${debfolder}/prerm
|
||||
echo ' /var/lib/zerotier-one/uninstall.sh >>/dev/null 2>&1' >>${debfolder}/prerm
|
||||
echo 'fi' >>${debfolder}/prerm
|
||||
chmod a+x ${debfolder}/prerm
|
||||
|
||||
dpkg-deb --build $debbase
|
||||
|
||||
mv -f build-installer-deb/*.deb .
|
||||
rm -rf build-installer-deb
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/rpmbuild ]; then
|
||||
echo
|
||||
echo Found rpmbuild, trying to build RedHat/CentOS package.
|
||||
|
||||
rm -f /tmp/zerotier-one.spec
|
||||
curr_dir=`pwd`
|
||||
cat ext/installfiles/linux/RPM/zerotier-one.spec.in | sed "s/__VERSION__/${vmajor}.${vminor}.${revision}/g" | sed "s/__INSTALLER__/${targ}/g" >/tmp/zerotier-one.spec
|
||||
|
||||
rpmbuild -ba /tmp/zerotier-one.spec
|
||||
|
||||
rm -f /tmp/zerotier-one.spec
|
||||
fi
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unsupported platform: $system"
|
||||
exit 2
|
||||
|
||||
esac
|
||||
|
||||
rm -rf build-installer
|
||||
|
||||
exit 0
|
|
@ -1,182 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
shopt -s expand_aliases
|
||||
|
||||
dryRun=0
|
||||
|
||||
echo "*** ZeroTier One install/update ***"
|
||||
echo
|
||||
|
||||
if [ "$UID" -ne 0 ]; then
|
||||
echo "Not running as root so doing dry run (no modifications to system)..."
|
||||
dryRun=1
|
||||
fi
|
||||
|
||||
if [ $dryRun -gt 0 ]; then
|
||||
alias ln="echo '>> ln'"
|
||||
alias rm="echo '>> rm'"
|
||||
alias mv="echo '>> mv'"
|
||||
alias cp="echo '>> cp'"
|
||||
alias chown="echo '>> chown'"
|
||||
alias chgrp="echo '>> chgrp'"
|
||||
alias chmod="echo '>> chmod'"
|
||||
alias chkconfig="echo '>> chkconfig'"
|
||||
alias zerotier-cli="echo '>> zerotier-cli'"
|
||||
alias service="echo '>> service'"
|
||||
alias systemctl="echo '>> systemctl'"
|
||||
fi
|
||||
|
||||
scriptPath="`dirname "$0"`/`basename "$0"`"
|
||||
if [ ! -r "$scriptPath" ]; then
|
||||
scriptPath="$0"
|
||||
if [ ! -r "$scriptPath" ]; then
|
||||
echo "Installer cannot determine its own path; $scriptPath is not readable."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for systemd vs. old school SysV init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
# Second check: test if systemd appears to actually be running. Apparently Ubuntu
|
||||
# thought it was a good idea to ship with systemd installed but not used. Issue #133
|
||||
if [ -d /var/run/systemd/system -o -d /run/systemd/system ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the end of this script, which is where we have appended binary data.
|
||||
endMarkerIndex=`grep -a -b -E '^################' "$scriptPath" | head -c 16 | cut -d : -f 1`
|
||||
if [ "$endMarkerIndex" -le 100 ]; then
|
||||
echo 'Internal error: unable to find end of script / start of binary data marker.'
|
||||
exit 2
|
||||
fi
|
||||
blobStart=`expr $endMarkerIndex + 17`
|
||||
if [ "$blobStart" -le "$endMarkerIndex" ]; then
|
||||
echo 'Internal error: unable to find end of script / start of binary data marker.'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo -n 'Getting version of existing install... '
|
||||
origVersion=NONE
|
||||
if [ -x /var/lib/zerotier-one/zerotier-one ]; then
|
||||
origVersion=`/var/lib/zerotier-one/zerotier-one -v`
|
||||
fi
|
||||
echo $origVersion
|
||||
|
||||
echo 'Extracting files...'
|
||||
if [ $dryRun -gt 0 ]; then
|
||||
echo ">> tail -c +$blobStart \"$scriptPath\" | gunzip -c | tar -xvop -C / -f -"
|
||||
tail -c +$blobStart "$scriptPath" | gunzip -c | tar -t -f - | sed 's/^/>> /'
|
||||
else
|
||||
tail -c +$blobStart "$scriptPath" | gunzip -c | tar -xvop --no-overwrite-dir -C / -f -
|
||||
fi
|
||||
|
||||
if [ $dryRun -eq 0 -a ! -x "/var/lib/zerotier-one/zerotier-one" ]; then
|
||||
echo 'Archive extraction failed, cannot find zerotier-one binary in "/var/lib/zerotier-one".'
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo -n 'Getting version of new install... '
|
||||
newVersion=`/var/lib/zerotier-one/zerotier-one -v`
|
||||
echo $newVersion
|
||||
|
||||
echo 'Creating symlinks...'
|
||||
|
||||
rm -f /usr/bin/zerotier-cli /usr/bin/zerotier-idtool
|
||||
ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-cli
|
||||
ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-idtool
|
||||
|
||||
echo 'Installing zerotier-one service...'
|
||||
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
# SYSTEMD
|
||||
|
||||
# If this was updated or upgraded from an init.d based system, clean up the old
|
||||
# init.d stuff before installing directly via systemd.
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
if [ -e /sbin/chkconfig -o -e /usr/sbin/chkconfig -o -e /bin/chkconfig -o -e /usr/bin/chkconfig ]; then
|
||||
chkconfig zerotier-one off
|
||||
fi
|
||||
rm -f /etc/init.d/zerotier-one
|
||||
fi
|
||||
|
||||
cp -f /tmp/systemd_zerotier-one.service "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chown 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chgrp 0 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
chmod 0644 "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
|
||||
systemctl enable zerotier-one.service
|
||||
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo systemctl restart zerotier-one.service'
|
||||
else
|
||||
# SYSV INIT -- also covers upstart which supports SysVinit backward compatibility
|
||||
|
||||
cp -f /tmp/init.d_zerotier-one /etc/init.d/zerotier-one
|
||||
chmod 0755 /etc/init.d/zerotier-one
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
|
||||
if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /usr/bin/chkconfig -o -f /bin/chkconfig ]; then
|
||||
chkconfig zerotier-one on
|
||||
else
|
||||
# Yes Virginia, some systems lack chkconfig.
|
||||
if [ -d /etc/rc0.d ]; then
|
||||
rm -f /etc/rc0.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc0.d/K89zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc1.d ]; then
|
||||
rm -f /etc/rc1.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc1.d/K89zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc2.d ]; then
|
||||
rm -f /etc/rc2.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc2.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc3.d ]; then
|
||||
rm -f /etc/rc3.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc3.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc4.d ]; then
|
||||
rm -f /etc/rc4.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc4.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc5.d ]; then
|
||||
rm -f /etc/rc5.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc5.d/S11zerotier-one
|
||||
fi
|
||||
if [ -d /etc/rc6.d ]; then
|
||||
rm -f /etc/rc6.d/???zerotier-one
|
||||
ln -sf /etc/init.d/zerotier-one /etc/rc6.d/K89zerotier-one
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo 'Done! Installed and service configured to start at system boot.'
|
||||
echo
|
||||
echo "To start now or restart the service if it's already running:"
|
||||
echo ' sudo service zerotier-one restart'
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
# Do not remove the last line or add a carriage return to it! The installer
|
||||
# looks for an unterminated line beginning with 16 #'s in itself to find
|
||||
# the binary blob data, which is appended after it.
|
||||
|
||||
################
|
|
@ -1,76 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
|
||||
if [ "$UID" -ne 0 ]; then
|
||||
echo "Must be run as root; try: sudo $0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect systemd vs. regular init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Killing any running zerotier-one service..."
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
systemctl stop zerotier-one.service
|
||||
systemctl disable zerotier-one.service
|
||||
else
|
||||
if [ -f /sbin/service -o -f /usr/sbin/service -o -f /bin/service -o -f /usr/bin/service ]; then
|
||||
service zerotier-one stop
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
if [ -f /var/lib/zerotier-one/zerotier-one.pid ]; then
|
||||
kill -TERM `cat /var/lib/zerotier-one/zerotier-one.pid`
|
||||
sleep 1
|
||||
fi
|
||||
if [ -f /var/lib/zerotier-one/zerotier-one.pid ]; then
|
||||
kill -KILL `cat /var/lib/zerotier-one/zerotier-one.pid`
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
echo "Removing SysV init items..."
|
||||
if [ -f /sbin/chkconfig -o -f /usr/sbin/chkconfig -o -f /bin/chkconfig -o -f /usr/bin/chkconfig ]; then
|
||||
chkconfig zerotier-one off
|
||||
fi
|
||||
rm -f /etc/init.d/zerotier-one
|
||||
find /etc/rc*.d -type f -name '???zerotier-one' -print0 | xargs -0 rm -f
|
||||
fi
|
||||
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" -a -f "$SYSTEMDUNITDIR/zerotier-one.service" ]; then
|
||||
echo "Removing systemd service..."
|
||||
rm -f "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
fi
|
||||
|
||||
echo "Erasing binary and support files..."
|
||||
if [ -d /var/lib/zerotier-one ]; then
|
||||
cd /var/lib/zerotier-one
|
||||
rm -rf zerotier-one *.persist identity.public *.log *.pid *.sh updates.d networks.d iddb.d root-topology ui
|
||||
fi
|
||||
|
||||
echo "Erasing anything installed into system bin directories..."
|
||||
rm -f /usr/local/bin/zerotier-cli /usr/bin/zerotier-cli /usr/local/bin/zerotier-idtool /usr/bin/zerotier-idtool
|
||||
|
||||
echo "Done."
|
||||
echo
|
||||
echo "Your ZeroTier One identity is still preserved in /var/lib/zerotier-one"
|
||||
echo "as identity.secret and can be manually deleted if you wish. Save it if"
|
||||
echo "you wish to re-use the address of this node, as it cannot be regenerated."
|
||||
|
||||
echo
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue