workspace/arch-user/install.sh
2025-01-01 01:33:20 +00:00

49 lines
1.1 KiB
Bash

#!/bin/bash
set -e
cd "$(dirname "$0")"
umask 002
[[ "$(id -u)" == "0" ]] && echo "ERROR: wrong user" >&1 && exit 1
####### file structure #########
mkdir -p ~/tmp ~/know ~/scripts ~/dev
################################
########## scripts #############
cp -rf scripts/* ~/scripts
################################
########### config #############
source config/theme.sh
VARS=$(printenv | \
grep -E 'THEME_.*' | \
sed -e 's/[= ].*//g' | sed -e 's/^/\$/' | tr '\n' ' '
)
cp_subst() {
mkdir -p "$(dirname "$2")"
envsubst "$VARS" < "$1" > "$2"
}
# xdg simple
cp -rf config/i3blocks ~/.config
cp -rf config/git ~/.config
cp -rf config/vim ~/.config
cp -rf config/xkb ~/.config
cp -rf config/qutebrowser ~/.config
# non-xdg
cp -rf config/bash/bashrc ~/.bashrc
# templated
cp_subst config/sway/config.tmpl ~/.config/sway/config
cp_subst config/foot/foot.ini.tmpl ~/.config/foot/foot.ini
# dynamic
cp -rf config/profile ~/.profile
# shellcheck disable=SC2129
echo -e "\n# GENERATED" >> ~/.profile
sed '/^#/d' config/theme.sh >> ~/.profile
sed '/^#/d' config/bemenu/config.sh >> ~/.profile
################################
swaymsg reload