diff options
author | crupest <crupest@outlook.com> | 2022-10-31 20:14:32 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-10-31 20:14:32 +0800 |
commit | 16bc28ac505aabd9da7dce085054a86db7904d6e (patch) | |
tree | 373c34c6cc699ddde1d09e5755666b1ae260c27c /docker/code-server/archlinux-setup.bash | |
parent | efdfc6feb5744d8ad4bd07e35fa8d662925e3e96 (diff) | |
download | crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.tar.gz crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.tar.bz2 crupest-16bc28ac505aabd9da7dce085054a86db7904d6e.zip |
...
Diffstat (limited to 'docker/code-server/archlinux-setup.bash')
-rwxr-xr-x | docker/code-server/archlinux-setup.bash | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/docker/code-server/archlinux-setup.bash b/docker/code-server/archlinux-setup.bash deleted file mode 100755 index c926384..0000000 --- a/docker/code-server/archlinux-setup.bash +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash - -# check if we are in docker by CRUPEST_IN_DOCKER -if [ "${CRUPEST_IN_DOCKER}" != "true" ]; then - echo "This script is intended to be run in a docker container." - exit 1 -fi - -# check if we are root -if [ "$(id -u)" != "0" ]; then - echo "This script must be run as root." - exit 1 -fi - -# CRUPEST_USER, CRUPEST_UID, CRUPEST_GID must be defined -if [ -z "$CRUPEST_USER" ] || [ -z "$CRUPEST_UID" ] || [ -z "$CRUPEST_GID" ]; then - echo "CRUPEST_USER, CRUPEST_UID, CRUPEST_GID must be defined." - exit 1 -fi - -# if we are in China (by checking USE_CHINA_MIRROR), use the mirror in China -if [ "$USE_CHINA_MIRROR" = "true" ]; then - echo "You have set USE_CHINA_MIRROR to true, using mirror ${CHINA_MIRROR_URL} (set by CHINA_MIRROR_URL) in China." - echo "Server = ${CHINA_MIRROR_URL}" > /etc/pacman.d/mirrorlist -fi - -# from now on, we don't allow error -set -e - -# Update the system and I need python3 -pacman -Syu --noconfirm python - -# execute the restore pacman config script -python3 ./restore-pacman-conf.py - -# reinstall all installed packages -pacman -Qnq | pacman -S --noconfirm --overwrite=* - - -# install new packages -echo "base-devel git ${CRUPEST_PACKAGES}" | tr " " "\n" | pacman -S --noconfirm --needed - - -# if GROUP not defined, set it the same to USER -if [ -z "$CRUPEST_GROUP" ]; then - CRUPEST_GROUP="$CRUPEST_USER" -fi - -# check if GROUP exists. if not create it with GID -if ! grep -q "^${CRUPEST_GROUP}:" /etc/group; then - groupadd -g "$CRUPEST_GID" "$CRUPEST_GROUP" -fi - -# create user for UID and GID -useradd -m -u "${CRUPEST_UID}" -g "${CRUPEST_GID}" "${CRUPEST_USER}" - -# add the user to sudo -echo "${CRUPEST_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers - -# create data directory and change the permission -mkdir -p /data -chown "${CRUPEST_USER}":"${CRUPEST_GROUP}" /data -chmod 700 /data |