Move wi-restricted function to base and fix bash version execution

This commit is contained in:
Christer Warén
2025-06-28 15:14:49 +03:00
parent d9a7864199
commit ff4bebdc53
3 changed files with 18 additions and 23 deletions

21
init.sh
View File

@ -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

View File

@ -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

View File

@ -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
}