From 6f0de40ec3092594f9362386905ba038bfabf0a8 Mon Sep 17 00:00:00 2001 From: GianLuca Vagnuzzi Date: Fri, 2 Jan 2026 08:22:01 +0100 Subject: [PATCH] Defined CMD in Dockerfile; ENTRYPOINT now supports user-provided commands --- .gitignore | 2 ++ Dockerfile | 1 + README.md | 3 +++ rootfs/entrypoint.sh | 60 +++++++++++++++++++++++++++++++------------- 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 43535ac..cb86a78 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .directory build.sh deploy.sh +compose-test.yml +data diff --git a/Dockerfile b/Dockerfile index 4403b73..3850629 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,3 +25,4 @@ RUN set -xe && \ ADD rootfs / ENTRYPOINT ["/entrypoint.sh"] +CMD ["smbd", "-F", "--no-process-group", "--debug-stdout", "-d", "3", "--configfile=/data/smb.conf"] diff --git a/README.md b/README.md index 828b7eb..62e1b6a 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,9 @@ services: ``` ## Changelog +v1.232.22-2 - 02.01.2026 +- Defined CMD in Dockerfile; ENTRYPOINT now supports user-provided commands + v1.232.22-1 - 31.12.2025 - Modified cmd in entrypoint file for more log diff --git a/rootfs/entrypoint.sh b/rootfs/entrypoint.sh index c720a21..51e7161 100755 --- a/rootfs/entrypoint.sh +++ b/rootfs/entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +set -e [ ! -d /data ] && mkdir /data @@ -71,24 +71,48 @@ if [ -e /tmp/groups.db ]; then done fi -function custom_bashrc { -echo ' +custom_bashrc() { +cat <<'EOF' export LS_OPTIONS="--color=auto" -alias "ls=ls $LS_OPTIONS" -alias "ll=ls $LS_OPTIONS -la" -alias "l=ls $LS_OPTIONS -lA" -' +alias ls='ls $LS_OPTIONS' +alias ll='ls $LS_OPTIONS -la' +alias l='ls $LS_OPTIONS -lA' + +# prompt SOLO per shell interattive +if [[ $- == *i* ]]; then + if [ "$(id -u)" -eq 0 ]; then + PS1="\[\e[35m\][\[\e[31m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]# " + else + PS1="\[\e[35m\][\[\e[33m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]$ " + fi + export PS1 +fi +EOF } -function _bashrc { -echo "-----------------------------------------" -echo " .bashrc file setup..." -echo "-----------------------------------------" -custom_bashrc | tee /root/.bashrc -echo 'export PS1="\[\e[35m\][\[\e[31m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]# "' >> /root/.bashrc -for i in $(ls /home); do echo 'export PS1="\[\e[35m\][\[\e[33m\]\u\[\e[36m\]@\[\e[32m\]\h\[\e[90m\] \w\[\e[35m\]]\[\e[0m\]$ "' >> /home/${i}/.bashrc; done -} -_bashrc +setup_bashrc() { + for home in /root /home/*; do + [ -d "$home" ] || continue + bashrc="$home/.bashrc" -#smbd -F -d 2 --configfile=/data/smb.conf -smbd -F --debug-stdout -d 3 --configfile=/data/smb.conf + # crea se manca + [ -f "$bashrc" ] || touch "$bashrc" + + # evita duplicazioni + grep -q '### CUSTOM BASHRC ###' "$bashrc" && continue + + { + echo '' + echo '### CUSTOM BASHRC ###' + custom_bashrc + } >> "$bashrc" + done +} + +setup_bashrc + +# print cmd that will be executed +echo "Starting: $*" >&2 + +# launch CMD +exec "$@"