diff --git a/network/zerotier-one/README b/network/zerotier-one/README new file mode 100644 index 0000000000..695b7df0e1 --- /dev/null +++ b/network/zerotier-one/README @@ -0,0 +1,25 @@ +ZeroTier One allows systems to join and participate in ZeroTier +virtual networks. + +ZeroTier One is a client application that enables devices to join +ZeroTier virtual networks (typically configured and managed by a +network controller). It provides an encrypted and secure network +connectivity solution that can be used for a variety of purposes, +including VPN alternatives, remote access, distributed +applications, and more. + +Since zerotier-one needs the tun module to be loaded in order to +work, that is done in the start function of rc.zerotier-one. +If you wish you can make the module load from rc.modules.local. + +The following can be used to start/stop NordVPN automatically: +/etc/rc.d/rc.local + + if [ -x /etc/rc.d/rc.zerotier-one ]; then + /etc/rc.d/rc.zerotier-one start + fi + +/etc/rc.d/rc.local_shutdown + if [ -x /etc/rc.d/rc.zerotier-one ]; then + /etc/rc.d/rc.zerotier-one stop + fi diff --git a/network/zerotier-one/doinst.sh b/network/zerotier-one/doinst.sh new file mode 100644 index 0000000000..6840d728b4 --- /dev/null +++ b/network/zerotier-one/doinst.sh @@ -0,0 +1,27 @@ +#!/bin/sh -x + +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.zerotier-one.new diff --git a/network/zerotier-one/rc.zerotier-one.new b/network/zerotier-one/rc.zerotier-one.new new file mode 100644 index 0000000000..5c1d00295e --- /dev/null +++ b/network/zerotier-one/rc.zerotier-one.new @@ -0,0 +1,51 @@ +#!/bin/sh + +# Slackware init script for zerotier-one + +# To change the default options, edit /etc/default/zerotier-one +if [ -r /etc/default/zerotier-one ]; then + . /etc/default/zerotier-one +fi + +# Start zerotier-one +start_zerotier() { + if ! lsmod | grep -q "^tun " ; then + echo "Loading tun module..." + /sbin/modprobe tun + fi + + if ! /usr/bin/pgrep --ns $$ --euid root -f "^/usr/sbin/zerotier-one" 1> /dev/null 2> /dev/null ; then + echo "Starting zerotier-one: /usr/sbin/zerotier-one $ZEROTIER_OPTS" + /usr/sbin/zerotier-one $ZEROTIER_OPTS & + echo $! > /var/run/zerotier-one.pid + fi +} + +# Stop zerotier-one +stop_zerotier() { + echo "Stopping zerotier-one." + kill $(cat /var/run/zerotier-one.pid) + rm -f /var/run/zerotier-one.pid +} + +# Restart zerotier-one +restart_zerotier() { + stop_zerotier + sleep 1 + start_zerotier +} + +# Parse command line parameters +case "$1" in +'start') + start_zerotier + ;; +'stop') + stop_zerotier + ;; +'restart') + restart_zerotier + ;; +*) + echo "usage $0 start|stop|restart" +esac diff --git a/network/zerotier-one/slack-desc b/network/zerotier-one/slack-desc new file mode 100644 index 0000000000..af006e06b7 --- /dev/null +++ b/network/zerotier-one/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +zerotier-one: zerotier-one (vpn client application) +zerotier-one: +zerotier-one: ZeroTier One is a client application that enables devices to join +zerotier-one: ZeroTier virtual networks (typically configured and managed by a +zerotier-one: network controller). It provides an encrypted and secure network +zerotier-one: connectivity solution that can be used for a variety of purposes, +zerotier-one: including VPN alternatives, remote access, distributed +zerotier-one: applications, and more. +zerotier-one: +zerotier-one: +zerotier-one: Homepage: https://www.zerotier.com/ diff --git a/network/zerotier-one/zerotier-one.SlackBuild b/network/zerotier-one/zerotier-one.SlackBuild new file mode 100644 index 0000000000..72a0bcc7a7 --- /dev/null +++ b/network/zerotier-one/zerotier-one.SlackBuild @@ -0,0 +1,107 @@ +#!/bin/bash + +# Slackware build script for zerotier-one + +# Copyright 2024 Georgi Kolev, Bulgaria +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=zerotier-one +GH_NAME=ZeroTierOne +VERSION=${VERSION:-1.6.2} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + LIBDIRSUFFIX="64" +else + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $GH_NAME-$VERSION +tar xvf $CWD/$GH_NAME-$VERSION.tar.gz +cd $GH_NAME-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +make +make selftest + +make DESTDIR=$PKG install + +rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG -name perllocal.pod \ + -o -name ".packlist" \ + -o -name "*.bs" \ + | xargs rm -f + +mv $PKG/usr/share/man $PKG/usr/ +rm -r $PKG/usr/share +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/etc/rc.d +install -m 0644 $CWD/rc.$PRGNAM.new $PKG/etc/rc.d/rc.$PRGNAM.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/network/zerotier-one/zerotier-one.info b/network/zerotier-one/zerotier-one.info new file mode 100644 index 0000000000..684db72c4a --- /dev/null +++ b/network/zerotier-one/zerotier-one.info @@ -0,0 +1,10 @@ +PRGNAM="zerotier-one" +VERSION="1.6.2" +HOMEPAGE="https://zerotier.com" +DOWNLOAD="https://github.com/zerotier/ZeroTierOne/archive/1.6.2/ZeroTierOne-1.6.2.tar.gz" +MD5SUM="179ff408997e8aacaf37343d5b4b2473" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Georgi kolev" +EMAIL="georgi.kolev (at) gmail.com"