POL_Function_RootCommand

Informations

Créateur Messages
GNU_Raziel

Information

Cet installateur a été accepté par l'équipe.

Informations

Plate-formes :
Téléchargements : 71194
Wine: System

Retours d'expérience

Description

Français :
Cette fonction permet d'avertir l'utilisateur de la nécéssiter d'utiliser des commandes root dans les scripts POL, ex :
POL_Function_RootCommand "sudo apt-get install cowsay"

English :
This function allow you alert user of the necessity to use root commands in POL scripts, ex :
POL_Function_RootCommand "sudo apt-get install cowsay"

Code source

#!/bin/bash
#Creator : GNU_Raziel
# Accepted by Tinou

COMMAND="$*"

if [ "$COMMAND" == "" ]; then
        POL_SetupWindow_message "$(eval_gettext 'No root command specified, abording installation.')" "$TITLE"
        exit 0
else        
        # Setting warning
        if [ "$POL_OS" == "Linux" ]; then
                WARNING_NOTE="$(eval_gettext 'PlayOnLinux/PlayOnMac philosophy is to never ask super-user password, however, for this script, it s mandatory. So, we give you the command you must type yourself for this installation to go on :')"
        else
cat << EOF > "$POL_USER_ROOT/tmp/note.bash"
#!/bin/bash
echo "$(eval_gettext 'PlayOnLinux/PlayOnMac philosophy is to never ask super-user password, however, for this script, it s mandatory. So, we give you the command you must type yourself for this installation to go on :')"
echo "$COMMAND"
bash
EOF
                chmod +x  "$POL_USER_ROOT/tmp/note.bash"
        fi

        # Displaying command
        [ "$POL_OS" == "Mac" ] && xterm -e "$POL_USER_ROOT/tmp/note.bash"
        [ "$POL_OS" == "Linux" ] && xterm -e "echo \"$WARNING_NOTE\"; echo \"$COMMAND\"; bash"
fi

Contributions

Filters:

Contribuer
Membre Messages