Просмотр исходного кода

change shell - improved verification

Serghey Rodin 14 лет назад
Родитель
Сommit
6628a9b3af
2 измененных файлов с 7 добавлено и 6 удалено
  1. 4 3
      bin/v_change_user_shell
  2. 3 3
      func/shared.func

+ 4 - 3
bin/v_change_user_shell

@@ -40,9 +40,6 @@ is_user_suspended
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Changing user shell
-update_user_value "$user" '$SHELL' "$shell"
-
 # Get shell full path
 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
 
 
+
 #----------------------------------------------------------#
 #                       Vesta                              #
 #----------------------------------------------------------#
 
+# Changing user shell
+update_user_value "$user" '$SHELL' "$shell"
+
 # Logging
 log_event 'system' "$V_EVENT"
 

+ 3 - 3
func/shared.func

@@ -61,10 +61,10 @@ format_validation() {
 
         # Checking shell
         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"
-            log_event 'debug' "$E_INVALID $V_EVENT"
-            exit $E_INVALID
+            log_event 'debug' "$E_NOTEXIST $V_EVENT"
+            exit $E_NOTEXIST
         fi
     }