mirror of
https://github.com/km4ack/patmenu2.git
synced 2025-05-29 13:00:11 -07:00
x86 initial
This commit is contained in:
parent
feb1bbd007
commit
d716cc747b
42
patmenu
42
patmenu
@ -44,11 +44,48 @@ fi
|
||||
#get name of current config file
|
||||
source $MYPATH/.currentconf
|
||||
CONFIG=$(echo $CONF | sed 's/.config//')
|
||||
CURRENT_GRID=$(grep locator $XDG_CONFIG_HOME/pat/config.json | sed 's/"locator": "//;s/ //g;s/",//')
|
||||
if [ -z $CONFIG ]; then
|
||||
CONFIG=default
|
||||
fi
|
||||
|
||||
########################
|
||||
#get sudo pw
|
||||
########################
|
||||
if [ ! -f /run/user/$UID/.patmenu ]; then
|
||||
PW=$(yad --title="sudo password" --width=400 --height=100 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
||||
--center --form --text="Please enter your sudo password" \
|
||||
--field="Password":H \
|
||||
--button=gtk-ok)
|
||||
PASS=$(echo $PW | awk -F "|" '{print $1}')
|
||||
echo $PASS | base64 > /run/user/$UID/.patmenu
|
||||
echo '#!/bin/bash' > /run/user/$UID/.pmpw
|
||||
echo 'PASS=$(base64 -d /run/user/$UID/.patmenu)' >> /run/user/$UID/.pmpw
|
||||
echo 'echo $PASS' >> /run/user/$UID/.pmpw
|
||||
chmod +x /run/user/$UID/.pmpw
|
||||
export SUDO_ASKPASS=/run/user/$UID/.pmpw
|
||||
#reset sudo timer to prevent false positive
|
||||
sudo -k
|
||||
echo "Checking SUDO credentials....standby"
|
||||
sudo -A touch /run/user/$UID/sutest 2>&1 </dev/null
|
||||
|
||||
if [ $? = 1 ]; then
|
||||
echo "Wrong sudo password entered. Can't continue! Exiting"
|
||||
yad --title="Wrong Password" --width=400 --height=100 \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --text-align=center \
|
||||
--center --form --text="Wrong Password. Can't continue'" \
|
||||
--button="Exit"
|
||||
rm /run/user/$UID/.patmenu /run/user/$UID/.pmpw
|
||||
exit
|
||||
else
|
||||
echo "Credentials check out....continuing"
|
||||
fi
|
||||
|
||||
else
|
||||
export SUDO_ASKPASS=/run/user/$UID/pmpw
|
||||
fi
|
||||
############################
|
||||
|
||||
yad --form --width=420 --text-align=center --center --title="Pat Menu" --text-align=center \
|
||||
--image $LOGO --window-icon=$LOGO --image-on-top --separator="|" --item-separator="|" \
|
||||
--text="<b>Pat Menu</b> by KM4ACK\rv$VERSION" \
|
||||
@ -62,8 +99,7 @@ yad --form --width=420 --text-align=center --center --title="Pat Menu" --text-al
|
||||
--field="Settings/Config":fbtn 'bash -c "kill -USR1 $YAD_PID; $MYPATH/manage-menu"' \
|
||||
--field="Quick Stats":fbtn 'bash -c "kill -USR1 $YAD_PID; source $MYPATH/pat-functions; STATS"' \
|
||||
--field="My Call - $MYCALLSIGN":LBL \
|
||||
--field="Config - $CONFIG":LBL \
|
||||
--field="Grid - $CURRENT_GRID":LBL \
|
||||
--field="Config=$CONFIG":LBL \
|
||||
--button="QUIT":1
|
||||
|
||||
BUT=$?
|
||||
|
Loading…
x
Reference in New Issue
Block a user