smb_utilities/gui/dialog_share_create.sh
2025-05-25 06:06:21 +00:00

29 lines
749 B
Bash
Executable File

#!/bin/bash
TMP_FILE=$(mktemp)
# Ask for username
dialog --backtitle "Create SMB share" --inputbox "Enter share name:" 10 40 2>"$TMP_FILE"
SHARE_NAME=$(<"$TMP_FILE")
# Ask for password (input will be hidden)
dialog --backtitle "Create SMB share" --inputbox "Enter associated username:" 10 40 2>"$TMP_FILE"
USERNAME=$(<"$TMP_FILE")
# 3) Call the external script and capture output
# adjust the path (“../add_smb_user.sh”) as needed
TMP_OUT=$(mktemp)
bash ./../create_user_share.sh "$SHARE_NAME" "$USERNAME" >"$TMP_OUT" 2>&1
# 4) Display the result (use --msgbox for short, --textbox for multiline)
dialog --backtitle "Create SMB share" \
--title "Result" \
--textbox "$TMP_OUT" 20 60
rm -f "$TMP_OUT"
rm -f "$TMP_FILE"