Compare commits

...

6 Commits

Author SHA1 Message Date
dabruh 8c8da29a23 Set host-specific brew packages 2022-12-15 19:12:38 +01:00
dabruh 6d4db248e9 Add Docker 2022-12-15 17:08:11 +01:00
dabruh adfac7d0e7 Add git-review 2022-12-15 16:36:39 +01:00
dabruh fc0262ec48 Add user to video group 2022-12-15 16:02:45 +01:00
dabruh 11b5dac016 Redo PATH manipulations 2022-12-15 16:01:39 +01:00
dabruh 71ce725bf5 Remove duplicate line 2022-12-15 10:01:34 +01:00
4 changed files with 108 additions and 31 deletions

View File

@ -34,20 +34,74 @@ export LESS_TERMCAP_us=$'\E[01;36m'
# Other program settings:
export DISPLAY_DPI=96
PATHS=(
# Remove an entry from PATH
rm_path_entry() {
local shell="${SHELL##*/}" rm_entry="${1:?Entry not set}" new_path path_arr
if [[ "$shell" == "zsh" ]]; then
IFS=" " read -A path_arr <<<"${PATH//:/ }"
else
IFS=" " read -a path_arr <<<"${PATH//:/ }"
fi
for path_entry in "${path_arr[@]}"; do
grep -Eq "^$rm_entry$" <<<"$path_entry" && continue
new_path="$new_path:$path_entry"
done
PATH="${new_path#:}"
}
# Remove one or more entries from PATH
rm_path_entries() {
local rm_entry
for rm_entry in "$@"; do
rm_path_entry "$rm_entry"
done
}
# Prepend one or more entries to PATH.
# The order of the supplied args will be kept, e.g. PATH="$1:$2:$PATH"
prepend_path_with_entries() {
local addl_paths entry
for entry in "$@"; do
! [ -d "$entry" ] && continue
addl_paths="$addl_paths:$entry"
done
PATH="${addl_paths#:}:$PATH"
}
# Append one or more entries to PATH.
# The order of the supplied args will be kept, e.g. PATH="$PATH:$1:$2"
append_path_with_entries() {
local addl_paths entry
for entry in "$@"; do
! [ -d "$entry" ] && continue
addl_paths="$addl_paths:$entry"
done
PATH="$PATH:${addl_paths#:}"
}
prepend_paths=(
"$HOME/bin"
"$HOME/.local/bin"
"$HOME/.cargo/bin"
"${KREW_ROOT:-$HOME/.krew}/bin"
)
append_paths=()
for DIR in "${PATHS[@]}"; do
! [ -d "$DIR" ] && continue
export PATH="$PATH:$DIR"
done
[ -f "$HOME/homebrew/bin/brew" ] && eval "$("$HOME/homebrew/bin/brew" shellenv)"
[ -n "$HOMEBREW_PREFIX" ] && append_paths+=("$HOMEBREW_PREFIX/bin" "$HOMEBREW_PREFIX/sbin")
rm_path_entries "${prepend_paths[@]}" "${append_paths[@]}" # Ensure we clean up first
prepend_path_with_entries "${prepend_paths[@]}"
append_path_with_entries "${append_paths[@]}"
# Add the profile-extras file yourself if you wish to override anything:
PROFILE_EXTRAS="${XDG_CONFIG_HOME:-$HOME/.config}/shell/profile-extras"
[ -f "$PROFILE_EXTRAS" ] && . "$PROFILE_EXTRAS"
[ -f "$HOME/homebrew/bin/brew" ] && eval "$("$HOME/homebrew/bin/brew" shellenv)"

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
@ -17,8 +18,8 @@ apt-any:libpam-u2f # For YubiKey
apt-type-hasbattery:brightnessctl
pip-any:flashfocus
brew-host-5cg9521pyj:azure-cli
brew-any:kubectl helm shellcheck velero azure/kubelogin/kubelogin derailed/k9s/k9s fluxcd/tap/flux weaveworks/tap/gitops # Kubernetes related
brew-any:kubectl helm shellcheck velero derailed/k9s/k9s fluxcd/tap/flux # Kubernetes related
brew-any:zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting # ZSH related
brew-host-5cg9521pyj:weaveworks/tap/gitops azure/kubelogin/kubelogin azure-cli git-review
krew-any:ctx krew ns slice stern tree

View File

@ -90,5 +90,4 @@ function override_bg() {
install
override_bg
"$SCRIPT_DIR/.local/bin/i3-config-builder"
i3-config-builder
echo "Done! 👌"

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,34 +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
for group in video docker; do
echo "Adding $USER to '$group' group."
sudo usermod -aG "$group" "$USER"
done
echo "Setup finished."