Add Docker

This commit is contained in:
dabruh 2022-12-15 17:08:11 +01:00
parent adfac7d0e7
commit 6d4db248e9
2 changed files with 44 additions and 23 deletions

View file

@ -5,8 +5,9 @@ pacman-any:gst-libav phonon-qt5-gstreamer gst-plugins-good qt5-quickcontrols qt5
pacman-type-hasbattery:brightnessctl
aur-any:picom-git sddm-theme-aerial-git
apt-base:acpi wget curl # Required for setup_system.sh
apt-base:acpi wget curl ca-certificates gnupg lsb-release # Required for setup_system.sh
apt-any:i3 feh i3status nm-tray pasystray xautolock inotify-tools xss-lock fonts-noto-color-emoji fonts-hack-ttf xclip
apt-any:docker-ce docker-ce-cli containerd.io docker-compose-plugin
apt-any:chromium-browser zsh tmux codium vim ufw scrot dunst arandr ranger thunar flameshot
apt-any:libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-xinerama0-dev libxcb-glx0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl1-mesa-dev libpcre2-dev libpcre3-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev meson
apt-any:python3 python3-pip

View file

@ -5,6 +5,8 @@
#
upgrade_packages=false
os_id="$(grep ^ID= </etc/os-release | cut -d= -f2)"
os_id_like="$(grep ^ID_LIKE= </etc/os-release | cut -d= -f2)"
script_dir="$(
cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit 1
pwd -P
@ -285,12 +287,25 @@ function setup_arch() {
# Setup for Debian-like systems
#
function add_debian_keyring() {
local url="${1:?Missing key URL}" name="${2:?Missing key name}"
local file="/usr/share/keyrings/$name.gpg"
echo "Adding keyring for $name from $url."
wget -qO - "$url" | gpg --dearmor | sudo dd of="$file"
sudo chmod a+r "$file"
}
function setup_debian_repo_docker() {
echo "Setting up repository for Docker."
add_debian_keyring "https://download.docker.com/linux/$os_id/gpg" docker || return 1
echo "deb [ arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg ] https://download.docker.com/linux/$os_id $(lsb_release -cs) stable" |
sudo tee /etc/apt/sources.list.d/docker.list
}
function setup_debian_repo_vscodium() {
echo "Setting up repository for VSCodium."
wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg |
gpg --dearmor |
sudo dd of=/usr/share/keyrings/vscodium-archive-keyring.gpg
echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' |
add_debian_keyring https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg vscodium || return 1
echo "deb [ signed-by=/usr/share/keyrings/vscodium.gpg ] https://download.vscodium.com/debs vscodium main" |
sudo tee /etc/apt/sources.list.d/vscodium.list
}
@ -315,37 +330,42 @@ function setup_debian_with_git() {
function setup_debian() {
setup_debian_base_with_apt || return 1
setup_debian_repo_vscodium || return 2
setup_debian_with_apt || return 3
setup_pip_packages || return 4
setup_debian_with_git || return 5
configure_sddm || return 6
configure_ufw || return 7
setup_homebrew || return 8
setup_brew_formulas || return 9
setup_krew || return 10
setup_krew_plugins || return 11
change_shell || return 12
setup_debian_repo_docker || return 3
setup_debian_with_apt || return 4
setup_pip_packages || return 5
setup_debian_with_git || return 6
configure_sddm || return 7
configure_ufw || return 8
setup_homebrew || return 9
setup_brew_formulas || return 10
setup_krew || return 11
setup_krew_plugins || return 12
change_shell || return 13
}
#
# Main
#
if [ "$EUID" -eq 0 ]; then
echo "Don't run this script as root." 1>&2
exit 2
fi
ID_LIKE="$(grep ID_LIKE= </etc/os-release | cut -d= -f2)"
echo "Setting up ${os_id_like^:?}-like OS."
echo "Setting up ${ID_LIKE^:?}-like OS."
if [[ "$ID_LIKE" == "arch" ]]; then
if [[ "$os_id_like" == "arch" ]]; then
setup_arch || echo "Setup failed: $?"
elif [[ "$ID_LIKE" == "debian" ]]; then
elif [[ "$os_id_like" == "debian" ]]; then
setup_debian || echo "Setup failed: $?"
else
echo "ERROR: Unsupported system: ID_LIKE=$ID_LIKE"
echo "ERROR: Unsupported system: os_id_like=$os_id_like"
exit 3
fi
echo "Adding $USER to 'video' group."
sudo usermod -aG video "$USER"
for group in video docker; do
echo "Adding $USER to '$group' group."
sudo usermod -aG "$group" "$USER"
done
echo "Setup finished."