3 #NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install
5 : ${DEST:=$(realpath "$HOME")}
6 : ${SRC:=$(dirname "$(realpath "$0")")}
10 if [ "$1" = "test" ]; then
11 echo "Running test -- no changes will be applied"
19 alias mkdir="echo -- mkdir"
25 # create preferred folder structure
27 mkdir -p bin etc share/fonts share/themes share/icons >$devnull 2>&1
28 command -v vim >$devnull 2>&1 && mkdir -pm 700 var/tmp/vim >$devnull 2>&1
32 if [ -z "$OSTYPE" ]; then
33 OSTYPE=$(uname -s | tr '[:upper:]' '[:lower:]')
36 # accomodate multiple userlands
39 freebsd*) lnargs=-sFhv;;
40 netbsd|openbsd*) lnargs=-sfhv;;
46 [ -L "$d" -o \! -e "$d" ] && ln $lnargs "$SRC/${2:-$x}" "$d" ||
47 echo "!!! File exists and is not a link: $1"
51 find base -mindepth 1 -maxdepth 1 | while read -r x; do l "${x#base/}"; done
52 find bin etc share -mindepth 1 -maxdepth 1 | while read -r x; do l; done
54 # xorg/wayland resources
55 find gui -mindepth 1 -maxdepth 1 | while read -r y; do
58 find "$y" -mindepth 1 -maxdepth 2 -type d | while read -r x; do
59 [ ! -e "$x/index.theme" ] && continue
60 command -v gtk-update-icon-cache >$devnull 2>&1 &&
61 gtk-update-icon-cache -f "$x"
62 l "share${y#gui}/$(basename "$x")"
66 find "$y" -mindepth 1 -maxdepth 2 -type d | while read -r x; do
67 command -v mkfontscale >$devnull 2>&1 && mkfontscale "$x"
68 command -v mkfontdir >$devnull 2>&1 && mkfontdir "$x"
69 [ "$(head -1 "$x/fonts.scale" >$devnull 2>&1)" = 0 ] &&
71 [ "$(head -1 "$x/fonts.dir" >$devnull 2>&1)" = 0 ] &&
73 l "share${y#gui}/$(basename "$x")"
77 find "$y" -mindepth 1 -maxdepth 1 | while read -r x; do
85 if command -v gpg >$devnull 2>&1; then
86 mkdir -p "$DEST/etc/gnupg"
87 find gnupg -mindepth 1 -maxdepth 1 \! -name '*.gpg' | while read -r x; do
90 find gnupg -mindepth 1 -maxdepth 1 -name '*.gpg' | while read -r x; do
96 find ssh -mindepth 1 -maxdepth 1 | while read -r x; do
99 # termux, assume it if android
100 if [ $(uname -o) = 'Android' ]; then
101 mkdir -p "$DEST/.termux"
102 find termux -mindepth 1 -maxdepth 1 | while read -r x; do
104 l ".termux/font.ttf" 'share/fonts/Dina-ttf/Dina.ttf'