From 77024f677b1885d16683a148ccd1f04cfa886990 Mon Sep 17 00:00:00 2001 From: nikurasu Date: Fri, 31 May 2024 23:53:47 +0200 Subject: [PATCH] fix(shell): few prepareServer fixes --- shell/scripts/prepareServer.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/shell/scripts/prepareServer.sh b/shell/scripts/prepareServer.sh index 42cfa0b..9b338a4 100644 --- a/shell/scripts/prepareServer.sh +++ b/shell/scripts/prepareServer.sh @@ -115,7 +115,7 @@ install_acl_apt() { group_add_docker() { sh_c="$( exec_command )" - if command_exists usermod; then + if [ -f /sbin/usermod ]; then $sh_c "usermod -aG docker $(id -un)" else cat >&2 <<-'EOF' @@ -149,13 +149,13 @@ mk_docker_dir() { fi $sh_c "mkdir -p $docker_root/docker/ $docker_root/docker/compose $docker_root/docker/data" $sh_c "chgrp docker $docker_root/docker" - $sh_c "chmod g+s $docker_root/docker" - $sh_c "setfactl -R -m u::rwx,g::rwx $docker_root/docker" - $sh_c "setfacl -d --set u::rwx,g::rwx,o::r-x $docker_root/docker" + $sh_c "chmod -R g+s $docker_root/docker" + $sh_c "setfacl -R -m u::rwx,g::rwx $docker_root/docker" + $sh_c "setfacl -R -d --set u::rwx,g::rwx,o::r-x $docker_root/docker" ) } -install() { +install_docker() { sh_c="$( exec_command )" distro="$( check_distro )" version="" @@ -173,7 +173,12 @@ install() { esac } -install +read -p "Install docker? (y/N) " if_docker_group +case $(to_lower $if_docker_group) in + "yes" | "y" | "yeah" | 1) + install docker + ;; +esac read -p "Add $(id -un) to docker group? (y/N) " if_docker_group case $(to_lower $if_docker_group) in "yes" | "y" | "yeah" | 1)