31 lines
841 B
Bash
Executable File
31 lines
841 B
Bash
Executable File
#!/bin/bash
|
|
|
|
TMP_FILE=$(mktemp)
|
|
|
|
# Ask for username
|
|
dialog --backtitle "Add User" --inputbox "Enter new username:" 10 40 2>"$TMP_FILE"
|
|
USERNAME=$(<"$TMP_FILE")
|
|
|
|
# Ask for password (input will be hidden)
|
|
dialog --backtitle "Add User" --insecure --passwordbox "Enter password for $USERNAME:" 10 40 2>"$TMP_FILE"
|
|
PASSWORD=$(<"$TMP_FILE")
|
|
|
|
|
|
|
|
# 3) Call the external script and capture output
|
|
# adjust the path (“../add_smb_user.sh”) as needed
|
|
TMP_OUT=$(mktemp)
|
|
bash $SMB_TOOLS_PATH/functions/add_smb_user.sh "$USERNAME" "$PASSWORD" >"$TMP_OUT" 2>&1
|
|
|
|
# 4) Display the result (use --msgbox for short, --textbox for multiline)
|
|
dialog --backtitle "Add SMB User" \
|
|
--title "Result" \
|
|
--textbox "$TMP_OUT" 20 60
|
|
|
|
rm -f "$TMP_OUT"
|
|
|
|
|
|
# dialog --msgbox "User '$USERNAME' with given password would be created." 8 50
|
|
|
|
rm -f "$TMP_FILE"
|