@ -110,7 +110,6 @@ install() {
# Check for root access and proceed if it is present
# Check for root access and proceed if it is present
if [ " $UID " -eq " $ROOT_UID " ] ; then
if [ " $UID " -eq " $ROOT_UID " ] ; then
clear
clear
if [ [ " ${ custom_background } " = = "custom-background" ] ] ; then
if [ [ " ${ custom_background } " = = "custom-background" ] ] ; then
@ -133,28 +132,29 @@ install() {
# Copy theme
# Copy theme
prompt -i " \n Installing ${ name } ${ icon } ${ screen } theme... "
prompt -i " \n Installing ${ name } ${ icon } ${ screen } theme... "
cp -a " ${ REO_DIR } /common/ " { *.png,*.pf2} " ${ THEME_DIR } / ${ name } "
# Don't preserve ownership because the owner will be root, and that causes the script to crash if it is ran from terminal by sudo
cp -a " ${ REO_DIR } /config/theme- ${ screen } .txt " " ${ THEME_DIR } / ${ name } /theme.txt "
cp -a --no-preserve= ownership " ${ REO_DIR } /common/ " { *.png,*.pf2} " ${ THEME_DIR } / ${ name } "
cp -a --no-preserve= ownership " ${ REO_DIR } /config/theme- ${ screen } .txt " " ${ THEME_DIR } / ${ name } /theme.txt "
if [ [ ${ custom_background } = = "background.jpg" ] ] || [ [ ${ custom_background } = = "custom-background.jpg" ] ] ; then
if [ [ ${ custom_background } = = "background.jpg" ] ] || [ [ ${ custom_background } = = "custom-background.jpg" ] ] ; then
if [ [ -f " $custom_background " ] ] ; then
if [ [ -f " $custom_background " ] ] ; then
prompt -i " \n Using ${ custom_background } as background image... "
prompt -i " \n Using ${ custom_background } as background image... "
cp -a " ${ REO_DIR } / ${ custom_background } " " ${ THEME_DIR } / ${ name } /background.jpg "
cp -a --no-preserve= ownership " ${ REO_DIR } / ${ custom_background } " " ${ THEME_DIR } / ${ name } /background.jpg "
convert -auto-orient " ${ THEME_DIR } / ${ name } /background.jpg " " ${ THEME_DIR } / ${ name } /background.jpg "
convert -auto-orient " ${ THEME_DIR } / ${ name } /background.jpg " " ${ THEME_DIR } / ${ name } /background.jpg "
else
else
prompt -e " $custom_background couldn't be found, exiting "
prompt -e " $custom_background couldn't be found, exiting "
exit 0
exit 0
fi
fi
else
else
cp -a " ${ REO_DIR } /backgrounds/ ${ screen } /background- ${ theme } .jpg " " ${ THEME_DIR } / ${ name } /background.jpg "
cp -a --no-preserve= ownership " ${ REO_DIR } /backgrounds/ ${ screen } /background- ${ theme } .jpg " " ${ THEME_DIR } / ${ name } /background.jpg "
fi
fi
if [ [ ${ screen } = = '1080p_21:9' ] ] ; then
if [ [ ${ screen } = = '1080p_21:9' ] ] ; then
cp -a " ${ REO_DIR } /assets/assets- ${ icon } /icons-1080p " " ${ THEME_DIR } / ${ name } /icons "
cp -a --no-preserve= ownership " ${ REO_DIR } /assets/assets- ${ icon } /icons-1080p " " ${ THEME_DIR } / ${ name } /icons "
cp -a " ${ REO_DIR } /assets/assets- ${ icon } /select-1080p/ " *.png " ${ THEME_DIR } / ${ name } "
cp -a --no-preserve= ownership " ${ REO_DIR } /assets/assets- ${ icon } /select-1080p/ " *.png " ${ THEME_DIR } / ${ name } "
else
else
cp -a " ${ REO_DIR } /assets/assets- ${ icon } /icons- ${ screen } " " ${ THEME_DIR } / ${ name } /icons "
cp -a --no-preserve= ownership " ${ REO_DIR } /assets/assets- ${ icon } /icons- ${ screen } " " ${ THEME_DIR } / ${ name } /icons "
cp -a " ${ REO_DIR } /assets/assets- ${ icon } /select- ${ screen } / " *.png " ${ THEME_DIR } / ${ name } "
cp -a --no-preserve= ownership " ${ REO_DIR } /assets/assets- ${ icon } /select- ${ screen } / " *.png " ${ THEME_DIR } / ${ name } "
fi
fi
# Set theme
# Set theme
@ -206,41 +206,71 @@ install() {
updating_grub
updating_grub
prompt -w " \n * At the next restart of your computer you will see your new Grub theme: ' $theme ' "
prompt -w " \n * At the next restart of your computer you will see your new Grub theme: ' $theme ' "
else
else
# Error message
#Check if password is cached (if cache timestamp not expired yet)
prompt -e "\n [ Error! ] -> Run me as root! "
sudo -n true 2> /dev/null && echo
if [ [ $? = = 0 ] ] ; then
#No need to ask for password
sudo " $0 " --${ theme } --${ icon } --${ screen }
else
#Ask for password
# Persistent execution of the script as root
if [ [ -n ${ tui_root_login } ] ] ; then
if [ [ -n ${ tui_root_login } ] ] ; then
if [ [ -n " ${ theme } " && -n " ${ screen } " ] ] ; then
if [ [ -n " ${ theme } " && -n " ${ screen } " ] ] ; then
sudo -S <<< ${ tui_root_login } $0 --${ theme } --${ icon } --${ screen }
sudo -S $0 --${ theme } --${ icon } --${ screen } <<< ${ tui_root_login }
fi
fi
else
else
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${ MAX_DELAY } -s
read -p " [ Trusted ] Specify the root password : " -t ${ MAX_DELAY } -s
[ [ -n " $REPLY " ] ] && {
if [ [ -n " ${ theme } " && -n " ${ screen } " ] ] ; then
sudo -S echo <<< $REPLY 2> /dev/null && echo
sudo -S <<< $REPLY " $0 " --${ theme } --${ icon } --${ screen }
if [ [ $? = = 0 ] ] ; then
#Correct password, use with sudo's stdin
sudo -S " $0 " --${ theme } --${ icon } --${ screen } <<< ${ REPLY }
else
#block for 3 seconds before allowing another attempt
sleep 3
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
fi
fi
} || {
operation_canceled
}
fi
fi
fi
fi
}
}
run_dialog( ) {
run_dialog( ) {
if [ [ -x /usr/bin/dialog ] ] ; then
if [ [ -x /usr/bin/dialog ] ] ; then
if [ [ " $UID " -ne " $ROOT_UID " ] ] ; then
#Check if password is cached (if cache timestamp not expired yet)
sudo -n true 2> /dev/null && echo
if [ [ $? = = 0 ] ] ; then
#No need to ask for password
sudo $0
else
#Ask for password
tui_root_login = $( dialog --backtitle ${ Project_Name } \
tui_root_login = $( dialog --backtitle ${ Project_Name } \
--title "ROOT LOGIN" \
--title "ROOT LOGIN" \
--insecure \
--insecure \
--passwordbox "require root permission" 8 50 \
--passwordbox "require root permission" 8 50 \
--output-fd 1 )
--output-fd 1 )
[ [ -z ${ tui_root_login } ] ] && exit ${ UID }
sudo -S <<< $tui_root_login $0
sudo -S echo <<< $tui_root_login 2> /dev/null && echo
test $? -eq 0 || {
prompt -e "\n [ Error! ] -> wrong passwords"
if [ [ $? = = 0 ] ] ; then
#Correct password, use with sudo's stdin
sudo -S " $0 " <<< $tui_root_login
else
#block for 3 seconds before allowing another attempt
sleep 3
clear
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
exit 1
}
fi
fi
fi
tui = $( dialog --backtitle ${ Project_Name } \
tui = $( dialog --backtitle ${ Project_Name } \
--radiolist "Choose your Grub theme : " 15 40 5 \
--radiolist "Choose your Grub theme : " 15 40 5 \
@ -357,18 +387,30 @@ remove() {
updating_grub
updating_grub
else
else
# Error message
#Check if password is cached (if cache timestamp not expired yet)
prompt -e "\n [ Error! ] -> Run me as root "
sudo -n true 2> /dev/null && echo
if [ [ $? = = 0 ] ] ; then
#No need to ask for password
sudo " $0 " " ${ PROG_ARGS [@] } "
else
#Ask for password
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${ MAX_DELAY } -s
# Persistent execution of the script as root
sudo -S echo <<< $REPLY 2> /dev/null && echo
read -p "[ trusted ] specify the root password : " -t${ MAX_DELAY } -s
[ [ -n " $REPLY " ] ] && {
if [ [ $? = = 0 ] ] ; then
if [ [ -n " ${ theme } " ] ] ; then
#Correct password, use with sudo's stdin
sudo -S <<< $REPLY " $0 " " ${ PROG_ARGS [@] } "
sudo -S " $0 " " ${ PROG_ARGS [@] } " <<< $REPLY
else
#block for 3 seconds before allowing another attempt
sleep 3
clear
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
fi
fi
} || {
operation_canceled
}
fi
fi
}
}
@ -378,16 +420,29 @@ if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]] && [[ -x /usr/bin/dialog ]] ; then
fi
fi
if [ [ $# -lt 1 ] ] && [ [ $UID -ne $ROOT_UID ] ] && [ [ ! -x /usr/bin/dialog ] ] ; then
if [ [ $# -lt 1 ] ] && [ [ $UID -ne $ROOT_UID ] ] && [ [ ! -x /usr/bin/dialog ] ] ; then
# Error message
# Check if password is cached (if cache timestamp not expired yet)
prompt -e "\n [ Error! ] -> Run me as root! "
sudo -n true 2> /dev/null && echo
# persisted execution of the script as root
if [ [ $? = = 0 ] ] ; then
#No need to ask for password
exec sudo $0
else
#Ask for password
prompt -e "\n [ Error! ] -> Run me as root! "
read -p " [ Trusted ] Specify the root password : " -t ${ MAX_DELAY } -s
read -p " [ Trusted ] Specify the root password : " -t ${ MAX_DELAY } -s
[ [ -n " $REPLY " ] ] && {
exec sudo -S <<< $REPLY $0
sudo -S echo <<< $REPLY 2> /dev/null && echo
} || {
operation_canceled
if [ [ $? = = 0 ] ] ; then
}
#Correct password, use with sudo's stdin
sudo $0 <<< $REPLY
else
#block for 3 seconds before allowing another attempt
sleep 3
prompt -e "\n [ Error! ] -> Incorrect password!\n"
exit 1
fi
fi
fi
fi
while [ [ $# -ge 1 ] ] ; do
while [ [ $# -ge 1 ] ] ; do