diff options
-rw-r--r-- | network/nordvpn/README | 20 | ||||
-rw-r--r-- | network/nordvpn/doinst.sh | 2 | ||||
-rw-r--r-- | network/nordvpn/nordvpn.SlackBuild | 76 | ||||
-rw-r--r-- | network/nordvpn/nordvpn.info | 10 | ||||
-rw-r--r-- | network/nordvpn/rc.nordvpn | 61 |
5 files changed, 115 insertions, 54 deletions
diff --git a/network/nordvpn/README b/network/nordvpn/README index 7e00584469f48..b4f3ba5626534 100644 --- a/network/nordvpn/README +++ b/network/nordvpn/README @@ -5,6 +5,12 @@ More than 5000 servers worldwide. No logs of your online activity. Secure up to 6 devices with a single account. Access online content securely, with no restrictions. +This script requires a 'nordvpn' group to exist before running. +You can create this group like this (Run these as root): + groupadd -g 373 nordvpn + usermod -aG nordvpn $USER (Replace $USER with your username) +Then log out of the system and login again. + The following can be used to start/stop NordVPN automatically: /etc/rc.d/rc.local if [ -x /etc/rc.d/rc.nordvpn ]; then @@ -17,13 +23,17 @@ The following can be used to start/stop NordVPN automatically: fi NOTE: NordVPN has implemented NordLynx (WireGuard protocol) into the -app. It is still under heavy development. You can switch to -NordLynx with the following command: +app. Dependencies already satisfied at full install. +In case of any issue, you need to reinstall following packages: + +wireguard-linux-compat +wireguard-tools - 'nordvpn set technology NordLynx' +Then you can switch to NordLynx with the following command: +'nordvpn set technology NordLynx' And connect using: - 'nordvpn c' +'nordvpn c' You can always switch back to OpenVPN using this command: - 'nordvpn set technology OpenVPN' +'nordvpn set technology OpenVPN' diff --git a/network/nordvpn/doinst.sh b/network/nordvpn/doinst.sh index 3f2e7491ca574..4283e18ffc035 100644 --- a/network/nordvpn/doinst.sh +++ b/network/nordvpn/doinst.sh @@ -9,5 +9,5 @@ if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then fi if [ -x /etc/rc.d/rc.nordvpn ]; then - /etc/rc.d/rc.nordvpn restart + /etc/rc.d/rc.nordvpn restart > /dev/null fi diff --git a/network/nordvpn/nordvpn.SlackBuild b/network/nordvpn/nordvpn.SlackBuild index 0aa8b745aaeff..399f74f5cf2ca 100644 --- a/network/nordvpn/nordvpn.SlackBuild +++ b/network/nordvpn/nordvpn.SlackBuild @@ -1,8 +1,8 @@ #!/bin/bash # -# Slackware build script for nordvpn. +# Slackware build script for NordVPN # -# Copyright 2019 Reza Talebi, Shahin Shahr, Iran. +# Copyright 2019-2021 Reza Talebi, Shahin Shahr, Iran. # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,68 +22,92 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# Modified by Pouria Rezaei <Pouria.rz@outlook.com> + cd $(dirname $0) ; CWD=$(pwd) PRGNAM=nordvpn -VERSION=${VERSION:-3.8.6} +VERSION=${VERSION:-3.12.5} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} +# Select nordvpn's default group +NORD_GROUP=${NORD_GROUP:-nordvpn} + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + + if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i586 ;; + x86_64) ARCH=amd64 ;; + i?86) ARCH=i386 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi -# If the variable PRINT_PACKAGE_NAME is set, then this script will report what -# the name of the created package would be, and then exit. This information -# could be useful to other scripts. -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} -SRCNAM=$PRGNAM-stable - set -e -if [ "$ARCH" = "x86_64" ]; then +if [ "$ARCH" = "i386" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "amd64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" - BITS="amd64" else echo "Package for $(uname -m) architecture is not available." exit 1 fi +bailout() { + echo " You must have a $NORD_GROUP group to run this script. " + echo " Something like this should suffice for most systems (Run as root): " + echo " # groupadd -g 373 $NORD_GROUP " + echo " # usermod -aG $NORD_GROUP \$USER (Replace \$USER with your username)" + echo " Then log out of the system and login again." + exit 1 +} + +# Bail if group isn't valid on your system. +if ! grep -q "^$NORD_GROUP:" /etc/group; then + bailout +fi + rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-${VERSION} -mkdir -p $PRGNAM-${VERSION} +rm -rf $PRGNAM-$VERSION +mkdir -p $PRGNAM-$VERSION + cd $PKG -rpm2cpio $CWD/$PRGNAM-${VERSION}-${BUILD}.${ARCH}.rpm | cpio -idmv -rm -rf etc -rm -rf usr/lib +ar p $CWD/${PRGNAM}_${VERSION}_${ARCH}.deb data.tar.gz | tar zxv + +rm -fR etc usr/lib -mv $PKG/usr/share/man $PKG/usr/ +# Move man where the man likes +mv usr/share/man usr/ -mkdir -p usr/doc/$PRGNAM-$VERSION +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cat $CWD/doinst.sh > $PKG/install/doinst.sh -mkdir -p $PKG/etc/rc.d/ -cp $CWD/rc.nordvpn $PKG/etc/rc.d/rc.nordvpn +mkdir -p $PKG/etc/rc.d +install -m 0755 $CWD/rc.$PRGNAM $PKG/etc/rc.d/rc.$PRGNAM + +if [ "$ARCH" = "amd64" ]; then + ARCH="x86_64" +fi cd $PKG -/sbin/makepkg -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE +/sbin/makepkg -l y -p -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/network/nordvpn/nordvpn.info b/network/nordvpn/nordvpn.info index 1943e15c83115..ac7393d03bcd2 100644 --- a/network/nordvpn/nordvpn.info +++ b/network/nordvpn/nordvpn.info @@ -1,10 +1,10 @@ PRGNAM="nordvpn" -VERSION="3.8.6" +VERSION="3.12.5" HOMEPAGE="https://www.nordvpn.com/" -DOWNLOAD="UNSUPPORTED" -MD5SUM="" -DOWNLOAD_x86_64="https://repo.nordvpn.com/yum/nordvpn/centos/x86_64/Packages/n/nordvpn-3.8.6-1.x86_64.rpm" -MD5SUM_x86_64="16b9f8b5ea5224e445427a4b1dbf4093" +DOWNLOAD="https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn_3.12.5_i386.deb" +MD5SUM="fe56eae13fe83ffd49946943806a6f39" +DOWNLOAD_x86_64="https://repo.nordvpn.com/deb/nordvpn/debian/pool/main/nordvpn_3.12.5_amd64.deb" +MD5SUM_x86_64="f34a4a809b6e6312710a106404943b6d" REQUIRES="" MAINTAINER="Reza Talebi" EMAIL="reza.talebi.73@outlook.com" diff --git a/network/nordvpn/rc.nordvpn b/network/nordvpn/rc.nordvpn index c59bb600739ae..bc1eb255a46c8 100644 --- a/network/nordvpn/rc.nordvpn +++ b/network/nordvpn/rc.nordvpn @@ -3,28 +3,58 @@ # Short-Description: Protect your privacy online and access media content with no regional restrictions. Strong encryption and no-log policy with 3000+ servers in 60+ countries. ### END INIT INFO +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin -PRGNAM=nordvpn -PID=/var/run/$PRGNAM.pid -DAEMON=/usr/sbin/${PRGNAM}d -SOCK=/run/${PRGNAM}d.sock +BASE=nordvpn +DAEMON=/usr/sbin/${BASE}d +PID=/var/run/$BASE.pid +SOCK=/run/$BASE/${BASE}d.sock +SOCKDIR=/run/$BASE +create_socket_dir() { + if [[ -d $SOCKDIR ]]; then + return + fi + mkdir -m 0770 $SOCKDIR + chown root:$BASE $SOCKDIR +} + +checkuser() { + status=0 + for u in $(who | awk '{print $1}' | sort | uniq) + do + if [ "$u" == "$1" ]; then + return 0 + fi + done + return 1 +} # # Function that starts the daemon # nordvpnd_start() { + checkuser + create_socket_dir rm -rf $SOCK if [ -s $PID ]; then - echo "$PRGNAM is already running: $(cat $PID)" + echo "$BASE is already running: $(cat $PID)" exit 1 fi if [ -x $DAEMON ]; then - echo "Starting $PRGNAM" - $DAEMON & + echo "Starting $BASE" + sleep 1 + # $DAEMON start-stop-daemon --start --quiet -g "nordvpn" --pidfile $PID --exec $DAEMON + $DAEMON > /dev/null & pidof $DAEMON > $PID + sleep 10 + if [ -S "$SOCK" ]; then + echo "$BASE has been started." + else + echo "$BASE failed to start. Please restart the daemon." + fi fi } @@ -34,11 +64,14 @@ nordvpnd_start() nordvpnd_stop() { if [ -s $PID ]; then + echo "Stopping $BASE" + sleep 1 kill $(cat $PID) rm -rf $PID $SOCK - echo "$PRGNAM has been stopped." + sleep 1 + echo "$BASE has been stopped." else - echo "$PRGNAM is not running." + echo "$BASE is not running." fi } @@ -47,15 +80,9 @@ nordvpnd_stop() # nordvpnd_restart() { - echo "Stopping $PRGNAM" - sleep 1 nordvpnd_stop - echo "$PRGNAM has been stopped." - sleep 1 - echo "Restarting $PRGNAM" sleep 1 nordvpnd_start - echo "$PRGNAM has been restarted." } # @@ -64,9 +91,9 @@ nordvpnd_restart() nordvpnd_status() { if [ -s $PID ]; then - echo "$PRGNAM is running: $(cat $PID)" + echo "$BASE is running: $(cat $PID)" else - echo "$PRGNAM is not running." + echo "$BASE is not running." fi } |