From 2c07f93ffbf5f1dd87687de07722da7ad6ca7bed Mon Sep 17 00:00:00 2001 From: "Sebastian N. Fernandez" Date: Sat, 8 Oct 2022 23:12:57 +0100 Subject: [PATCH 1/3] adding force user and group --- entrypoint.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 06a400e..1362fc7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -16,8 +16,6 @@ create mask = 0664 directory mask = 0775 force create mode = 0664 force directory mode = 0775 -#force user = smbuser -#force group = smbuser load printers = no printing = bsd printcap name = /dev/null @@ -30,7 +28,16 @@ local master = no dns proxy = no EOT fi - while getopts ":u:s:h" opt; do + while getopts ":f:u:s:h" opt; do + case $opt in + f) + echo -n "Add force user and group " + IFS=: read username groupname <<<"$OPTARG" + echo -n "'$username' and '$groupname'" + echo "force user = \"$username\"" >>"$CONFIG_FILE" + echo "force group = \"$groupname\"" >>"$CONFIG_FILE" + echo "DONE" + ;; case $opt in h) cat < Date: Sat, 8 Oct 2022 23:28:49 +0100 Subject: [PATCH 2/3] fixing second case, and newline --- entrypoint.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 1362fc7..48ba963 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,12 +33,11 @@ fi f) echo -n "Add force user and group " IFS=: read username groupname <<<"$OPTARG" - echo -n "'$username' and '$groupname'" + echo "'$username' and '$groupname'" echo "force user = \"$username\"" >>"$CONFIG_FILE" echo "force group = \"$groupname\"" >>"$CONFIG_FILE" echo "DONE" ;; - case $opt in h) cat < Date: Sat, 8 Oct 2022 23:56:32 +0100 Subject: [PATCH 3/3] fixing force user/group to the [global] section --- entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/entrypoint.sh b/entrypoint.sh index 48ba963..fb587cd 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -34,6 +34,7 @@ fi echo -n "Add force user and group " IFS=: read username groupname <<<"$OPTARG" echo "'$username' and '$groupname'" + echo "[global]" >>"$CONFIG_FILE" echo "force user = \"$username\"" >>"$CONFIG_FILE" echo "force group = \"$groupname\"" >>"$CONFIG_FILE" echo "DONE"