save auth prefered

master
Can202 2021-09-07 21:00:55 -03:00
parent ee3d64af63
commit a07c18add4
4 changed files with 53 additions and 13 deletions

View File

@ -11,21 +11,25 @@ then
exit
fi
echo "Do you want to use sudo? (Y/n)"
read rootcommand
if [ $rootcommand = Y ] || [ $rootcommand = y ]
if [ -f "$HOME/.config/boxpackage/auth" ]
then
sudo /usr/lib64/boxpackage/init $1
exit
Auth=$(cat $HOME/.config/boxpackage/auth)
if [ Auth = "sudo" ]
then
sudo /usr/lib64/boxpackage/init $1
fi
if [ Auth = "pkexec" ]
then
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/lib64/boxpackage/init
fi
if [ Auth = "su" ]
then
su root -c '/usr/lib64/boxpackage/init'
fi
else
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/lib64/boxpackage/init
fi
echo "Do you want to use su? (Y/n)"
read rootcommand
if [ $rootcommand = Y ] || [ $rootcommand = y ]
then
su root -c '/usr/lib64/boxpackage/init $1'
exit
fi
echo "Error, no root"
else
echo "Error, waiting \$1"
fi

View File

@ -2,4 +2,16 @@
xdg-mime default boxpackage.desktop application/vnd.debian.binary-package
if [ ! -d "$HOME/.config/boxpackage/" ]
then
mkdir $HOME/.config/boxpackage/
fi
if [ -f "$HOME/.config/boxpackage/auth" ]
then
rm -f $HOME/.config/boxpackage/auth
fi
touch $HOME/.config/boxpackage/auth
echo "pkexec" > $HOME/.config/boxpackage/auth
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/lib64/boxpackage/init

View File

@ -2,4 +2,16 @@
xdg-mime default boxpackage.desktop application/vnd.debian.binary-package
if [ ! -d "$HOME/.config/boxpackage/" ]
then
mkdir $HOME/.config/boxpackage/
fi
if [ -f "$HOME/.config/boxpackage/auth" ]
then
rm -f $HOME/.config/boxpackage/auth
fi
touch $HOME/.config/boxpackage/auth
echo "su" > $HOME/.config/boxpackage/auth
su root -c '/usr/lib64/boxpackage/init'

View File

@ -2,4 +2,16 @@
xdg-mime default boxpackage.desktop application/vnd.debian.binary-package
if [ ! -d "$HOME/.config/boxpackage/" ]
then
mkdir $HOME/.config/boxpackage/
fi
if [ -f "$HOME/.config/boxpackage/auth" ]
then
rm -f $HOME/.config/boxpackage/auth
fi
touch $HOME/.config/boxpackage/auth
echo "sudo" > $HOME/.config/boxpackage/auth
sudo /usr/lib64/boxpackage/init