diff options
author | crupest <crupest@outlook.com> | 2024-02-09 22:24:36 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-02-09 22:24:36 +0800 |
commit | 07ae0f955721866287bf56de478164cc83aaf9e1 (patch) | |
tree | c0e69ae84d4dc2eaea1daf580c1c994547cfcc1d /docker/debian-dev/bootstrap | |
parent | 7e2870588fb804aa58dcea88f8b8c3d070fea9dd (diff) | |
download | crupest-07ae0f955721866287bf56de478164cc83aaf9e1.tar.gz crupest-07ae0f955721866287bf56de478164cc83aaf9e1.tar.bz2 crupest-07ae0f955721866287bf56de478164cc83aaf9e1.zip |
docker(debian-dev): use an ordinary user rather than root.
Diffstat (limited to 'docker/debian-dev/bootstrap')
-rwxr-xr-x | docker/debian-dev/bootstrap/apt-source/get-domain.bash | 1 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/apt-source/setup.bash | 5 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/setup-user.bash | 9 | ||||
-rwxr-xr-x | docker/debian-dev/bootstrap/setup.bash | 1 |
4 files changed, 12 insertions, 4 deletions
diff --git a/docker/debian-dev/bootstrap/apt-source/get-domain.bash b/docker/debian-dev/bootstrap/apt-source/get-domain.bash index c9b93b1..d44ea65 100755 --- a/docker/debian-dev/bootstrap/apt-source/get-domain.bash +++ b/docker/debian-dev/bootstrap/apt-source/get-domain.bash @@ -3,4 +3,3 @@ set -e sed "s|.*https\?://\([-_.a-zA-Z0-9]\+\)/.*|\\1|;q" /etc/apt/sources.list - diff --git a/docker/debian-dev/bootstrap/apt-source/setup.bash b/docker/debian-dev/bootstrap/apt-source/setup.bash index 36065f6..60e635b 100755 --- a/docker/debian-dev/bootstrap/apt-source/setup.bash +++ b/docker/debian-dev/bootstrap/apt-source/setup.bash @@ -2,12 +2,11 @@ set -e -dir=$(dirname $0) +dir=$(dirname "$0") if [[ -n $IN_CHINA ]]; then - "$dir/replace-domain.bash" $(cat "$dir/china-source.txt") + "$dir/replace-domain.bash" "$(cat "$dir/china-source.txt")" fi "$dir/install-apt-https.bash" "$dir/replace-http.bash" - diff --git a/docker/debian-dev/bootstrap/setup-user.bash b/docker/debian-dev/bootstrap/setup-user.bash new file mode 100755 index 0000000..0eccde4 --- /dev/null +++ b/docker/debian-dev/bootstrap/setup-user.bash @@ -0,0 +1,9 @@ +#! /usr/bin/env bash + +set -e + +apt-get install -y sudo + +sed -i.bak 's|%sudo[[:space:]]\+ALL=(ALL:ALL)[[:space:]]\+ALL|%sudo ALL=(ALL:ALL) NOPASSWD: ALL|' /etc/sudoers + +useradd -m -G sudo -s /usr/bin/bash "$USERNAME" diff --git a/docker/debian-dev/bootstrap/setup.bash b/docker/debian-dev/bootstrap/setup.bash index 2aa88e0..c72db87 100755 --- a/docker/debian-dev/bootstrap/setup.bash +++ b/docker/debian-dev/bootstrap/setup.bash @@ -5,6 +5,7 @@ set -e export DEBIAN_FRONTEND=noninteractive /bootstrap/apt-source/setup.bash +/bootstrap/setup-user.bash /bootstrap/setup-base.bash /bootstrap/setup-dev.bash |