2022-02-25 16:22:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
PRIMARY="\033[0;35m"
|
|
|
|
LOG="\033[0;36m"
|
|
|
|
SUCCESS="\033[0;32m"
|
|
|
|
NC="\033[0m"
|
|
|
|
BRAND="[stow]"
|
|
|
|
|
|
|
|
function log {
|
|
|
|
echo -e "${PRIMARY}${BRAND} ${LOG}$1${NC}"
|
|
|
|
}
|
|
|
|
|
|
|
|
function success {
|
|
|
|
echo -e "${PRIMARY}${BRAND} ${SUCCESS}$1${NC}"
|
|
|
|
}
|
|
|
|
|
2023-07-18 23:41:28 +02:00
|
|
|
DEFAULT_STOW_PKGS="alacritty flatpak-sync systemd picom bash fish zsh stumpwm qutebrowser redshift neovim dunst x"
|
2022-02-25 16:22:57 +01:00
|
|
|
STOW_PKGS=${STOW_PKGS:=$DEFAULT_STOW_PKGS}
|
|
|
|
|
2022-02-25 17:06:11 +01:00
|
|
|
WORK_DOTFILES="${WORK_DOTFILES:=$(pwd)/dot-work}"
|
2022-02-25 16:22:57 +01:00
|
|
|
DEFAULT_WORK_STOW_PKGS="mbsync msmtp ssh passwords"
|
|
|
|
WORK_STOW_PKGS="${WORK_STOW_PKGS:=$DEFAULT_WORK_STOW_PKGS}"
|
|
|
|
|
2022-02-25 17:06:11 +01:00
|
|
|
PRIVATE_DOTFILES="${PRIVATE_DOTFILES:=$(pwd)/dot-private}"
|
2022-02-25 16:22:57 +01:00
|
|
|
DEFAULT_PRIVATE_STOW_PKGS="mbsync msmtp ssh git"
|
|
|
|
PRIVATE_STOW_PKGS="${PRIVATE_STOW_PKGS:=$DEFAULT_PRIVATE_STOW_PKGS}"
|
|
|
|
|
|
|
|
WORK_MACHINE="knuth"
|
|
|
|
CURRENT_MACHINE="$(hostname)"
|
|
|
|
|
|
|
|
log "Stowing general packages."
|
|
|
|
for pkg in $STOW_PKGS
|
|
|
|
do
|
|
|
|
log "Stowing $pkg package."
|
|
|
|
stow $@ "$pkg"
|
|
|
|
done
|
|
|
|
log "Finished stowing general packages."
|
|
|
|
|
|
|
|
if [[ "$WORK_MACHINE" == "$CURRENT_MACHINE" ]]
|
|
|
|
then
|
|
|
|
log "Detected work system. Stowing relevant files."
|
|
|
|
for pkg in $WORK_STOW_PKGS
|
|
|
|
do
|
|
|
|
log "Stowing $pkg package."
|
|
|
|
stow $@ -d "$WORK_DOTFILES" -t "$HOME" "$pkg"
|
|
|
|
done
|
|
|
|
log "Finished stowing work packages."
|
|
|
|
else
|
|
|
|
log "Detected personal system. Stowing relevant packages."
|
|
|
|
for pkg in $PRIVATE_STOW_PKGS
|
|
|
|
do
|
|
|
|
log "Stowing $pkg package."
|
|
|
|
stow $@ -d "$PRIVATE_DOTFILES" -t "$HOME" "$pkg"
|
|
|
|
done
|
|
|
|
log "Finished stowing private packages."
|
|
|
|
fi
|
|
|
|
|
|
|
|
success "Finished stowing files."
|