fix(shell): few prepareServer fixes

This commit is contained in:
nikurasu 2024-05-31 23:53:47 +02:00
parent 4ad3a58af5
commit 77024f677b
Signed by: Nikurasu
GPG key ID: 9E7F14C03EF1F271

View file

@ -115,7 +115,7 @@ install_acl_apt() {
group_add_docker() { group_add_docker() {
sh_c="$( exec_command )" sh_c="$( exec_command )"
if command_exists usermod; then if [ -f /sbin/usermod ]; then
$sh_c "usermod -aG docker $(id -un)" $sh_c "usermod -aG docker $(id -un)"
else else
cat >&2 <<-'EOF' cat >&2 <<-'EOF'
@ -149,13 +149,13 @@ mk_docker_dir() {
fi fi
$sh_c "mkdir -p $docker_root/docker/ $docker_root/docker/compose $docker_root/docker/data" $sh_c "mkdir -p $docker_root/docker/ $docker_root/docker/compose $docker_root/docker/data"
$sh_c "chgrp docker $docker_root/docker" $sh_c "chgrp docker $docker_root/docker"
$sh_c "chmod g+s $docker_root/docker" $sh_c "chmod -R g+s $docker_root/docker"
$sh_c "setfactl -R -m u::rwx,g::rwx $docker_root/docker" $sh_c "setfacl -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 "setfacl -R -d --set u::rwx,g::rwx,o::r-x $docker_root/docker"
) )
} }
install() { install_docker() {
sh_c="$( exec_command )" sh_c="$( exec_command )"
distro="$( check_distro )" distro="$( check_distro )"
version="" version=""
@ -173,7 +173,12 @@ install() {
esac 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 read -p "Add $(id -un) to docker group? (y/N) " if_docker_group
case $(to_lower $if_docker_group) in case $(to_lower $if_docker_group) in
"yes" | "y" | "yeah" | 1) "yes" | "y" | "yeah" | 1)