29 lines
715 B
Plaintext
29 lines
715 B
Plaintext
|
#!/bin/bash
|
||
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
||
|
|
||
|
function display_help() {
|
||
|
uecho "$scriptname: devenir l'utilisateur root, avec 'sudo' si possible, ou 'su' si
|
||
|
'sudo' n'est pas installé"
|
||
|
}
|
||
|
|
||
|
source "$(dirname "$0")/ulib/ulib" &&
|
||
|
urequire base ||
|
||
|
exit 1
|
||
|
|
||
|
parse_opts "${PRETTYOPTS[@]}" \
|
||
|
--help '$exit_with display_help' \
|
||
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
||
|
|
||
|
user="$scriptname"
|
||
|
if [ "${user#_}" != "$user" ]; then
|
||
|
user="${user:1}"
|
||
|
fi
|
||
|
|
||
|
if is_yes "$UTOOLS_USES_SU" || ! progexists sudo; then
|
||
|
eecho "Entrez le mot de passe de $user"
|
||
|
exec su - "$user"
|
||
|
else
|
||
|
eecho "Si demandé, entrez le mot de passe de $USER"
|
||
|
exec sudo su - "$user"
|
||
|
fi
|