workspace/arch-user/install.sh

61 lines
1.4 KiB
Bash

#!/bin/bash
# config/ - configuration files (including shell and profile)
# data/ - resource files used by configured system
# bin/ - scripts used either by configured system or by user
set -e
cd "$(dirname "$0")"
umask 002
[[ "$(id -u)" == "0" ]] && echo "ERROR: wrong user" >&1 && exit 1
####### file structure #########
USER_DIRS=(
##### xdg #####
~/.config # bkp=weak
~/.local/bin # bkp=weak
~/.local/share # bkp=weak
~/.local/state
~/.cache
# app
~/.local/state/sway
################
##### user #####
# core knowledge base
~/know # bkp=true,roam=true
# large blobs for knowledge base
~/know-lfs # Large blobs for knowledge base. bkp=weak
# temp files with manual bulk cleanup
~/tmp
# downloads
~/dl # bkp=weak
# development - external vcs, tons of deps, etc.
~/dev # bkp=weak
################
)
mkdir -p "${USER_DIRS[@]}"
################################
########## scripts #############
cp -rf bin/* ~/.local/bin
################################
########### config #############
gomplate --input-dir config \
--output-map "$HOME/.config/{{ .in | strings.ReplaceAll \".tmpl\" \"\" }}" \
--exclude-processing "!*.tmpl" \
--plugin jq=/bin/jq \
-c theme=config/theme.json
ln -sf ~/.config/bash/bashrc ~/.bashrc
ln -sf ~/.config/profile ~/.profile
################################
############# data ############
cp -rf data/* ~/.local/share
###############################
swaymsg reload || true
echo ok