From ff4bebdc530b9c3b96e1a80da5e2c8ec22589fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 28 Jun 2025 15:14:49 +0300 Subject: [PATCH] Move wi-restricted function to base and fix bash version execution --- init.sh | 21 +++++++++------------ src/base.sh | 12 +++++++++--- src/functions/restricted.sh | 8 -------- 3 files changed, 18 insertions(+), 23 deletions(-) delete mode 100644 src/functions/restricted.sh diff --git a/init.sh b/init.sh index 4b232ea..f4433a4 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,15 @@ #!/bin/bash if [ ! "$BASH_VERSION" ] ; then - bash $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 + sudo curl https://waren.io/init.sh -o $PWD/init.sh + sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 + exit 1 +fi + +if [[ $USER != "root" ]] +then + sudo curl https://waren.io/init.sh -o $PWD/init.sh + sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 exit 1 fi @@ -292,15 +300,6 @@ wx-repeat() { printf "%s" "${spaces// /$str}" } -wi-restricted(){ - if [[ $USER != "root" ]] - then - sudo curl https://waren.io/init.sh -o $PWD/init.sh - sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 - exit 1 - fi -} - wi-start(){ wi-header "Warén Init" h1 @@ -326,8 +325,6 @@ wi-stop (){ } -wi-restricted "$0 $1 $2" - if [[ ! -f /bin/jq ]] then apt update &> /dev/null diff --git a/src/base.sh b/src/base.sh index 6e3510f..1239746 100644 --- a/src/base.sh +++ b/src/base.sh @@ -1,7 +1,15 @@ #!/bin/bash if [ ! "$BASH_VERSION" ] ; then - bash $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 + sudo curl https://waren.io/init.sh -o $PWD/init.sh + sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 + exit 1 +fi + +if [[ $USER != "root" ]] +then + sudo curl https://waren.io/init.sh -o $PWD/init.sh + sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 exit 1 fi @@ -18,8 +26,6 @@ wiNormal=$(tput sgr0) {{ CODES }} -wi-restricted "$0 $1 $2" - if [[ ! -f /bin/jq ]] then apt update &> /dev/null diff --git a/src/functions/restricted.sh b/src/functions/restricted.sh deleted file mode 100644 index 041e567..0000000 --- a/src/functions/restricted.sh +++ /dev/null @@ -1,8 +0,0 @@ -wi-restricted(){ - if [[ $USER != "root" ]] - then - sudo curl https://waren.io/init.sh -o $PWD/init.sh - sudo bash $PWD/init.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 - exit 1 - fi -}