Fix script-user-remove

This commit is contained in:
2021-10-22 15:46:59 -04:00
parent 1cccdc457c
commit 7f0d847d3a

View File

@@ -28,16 +28,19 @@ fi
ask_ok "Make user $username an admin?" && \ ask_ok "Make user $username an admin?" && \
group_str="wheel" group_str="wheel"
ask_ok "Enable shared file access for user $username?" && \ samba="no"
group_str+=",smbgrp" && \ ask_ok "Enable shared file access for user $username?" && group_str+=",smbgrp" && samba="yes"
(echo "$password"; echo "$password") | smbpasswd -a -s "$username"
useradd_cmd+=("-G" "$group_str") useradd_cmd+=("-G" "$group_str")
useradd_cmd+=("$username") useradd_cmd+=("$username")
echo "Command: ${useradd_cmd[*]}" echo "Command: ${useradd_cmd[*]}"
"${useradd_cmd[@]}" "${useradd_cmd[@]}"
if [[ "$samba" == "yes" ]]; then
(echo "$password"; echo "$password") | smbpasswd -a -s "$username"
fi
if [[ "$restore" == "yes" ]]; then if [[ "$restore" == "yes" ]]; then
if rsync -av --progress=info2 /mnt/array/home-retired/"$username" /home/"$username"; then if rsync -av --progress=info2 /mnt/array/home-retired/"$username" /home/"$username"; then
ask_ok "User $username's files successfully restored, remove backup at /mnt/array/home-retired/$username?" && \ ask_ok "User $username's files successfully restored, remove backup at /mnt/array/home-retired/$username?" && \