mirror of
https://github.com/serghey-rodin/vesta.git
synced 2025-08-19 21:04:06 -07:00
change shell - improved verification
This commit is contained in:
parent
bc1864225d
commit
6628a9b3af
2 changed files with 7 additions and 6 deletions
|
@ -40,9 +40,6 @@ is_user_suspended
|
||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Changing user shell
|
|
||||||
update_user_value "$user" '$SHELL' "$shell"
|
|
||||||
|
|
||||||
# Get shell full path
|
# Get shell full path
|
||||||
shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
|
shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
|
||||||
|
|
||||||
|
@ -50,10 +47,14 @@ shell_path=$(/usr/bin/chsh --list-shells | grep -w "$shell" )
|
||||||
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
|
/usr/bin/chsh -s "$shell_path" "$user" >/dev/null 2>&1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Vesta #
|
# Vesta #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Changing user shell
|
||||||
|
update_user_value "$user" '$SHELL' "$shell"
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
log_event 'system' "$V_EVENT"
|
log_event 'system' "$V_EVENT"
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,10 @@ format_validation() {
|
||||||
|
|
||||||
# Checking shell
|
# Checking shell
|
||||||
check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" )
|
check_shell=$(/usr/bin/chsh --list-shells | grep -w "$val" )
|
||||||
if [ -z "$check_shell" ]; then
|
if [ -z "$1"] || [ -z "$check_shell" ]; then
|
||||||
echo "Error: shell not found"
|
echo "Error: shell not found"
|
||||||
log_event 'debug' "$E_INVALID $V_EVENT"
|
log_event 'debug' "$E_NOTEXIST $V_EVENT"
|
||||||
exit $E_INVALID
|
exit $E_NOTEXIST
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue