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 which 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;;
45 [ -L "$1" -o \! -e "$1" ] && ln $lnargs "$SRC/${2:-$x}" "$DEST/${1:-$x}" ||
46 echo "!!! File exists and is not a link: $1"
50 find base -mindepth 1 -maxdepth 1 | while read -r x; do l "${x#base/}"; done
51 find bin etc share -mindepth 1 -maxdepth 1 | while read -r x; do l; done
53 # xorg/wayland resources
54 find gui -mindepth 1 -maxdepth 1 | while read -r x; do
55 if [ "$x" = gui/fonts ]; then
56 find $x -mindepth 1 -maxdepth 2 -type d | while read -r x; do
57 which mkfontscale >$devnull 2>&1 && mkfontscale "$x"
58 which mkfontdir >$devnull 2>&1 && mkfontdir "$x"
59 [ "$(head -1 "$x/fonts.scale" >$devnull 2>&1)" = 0 ] &&
61 [ "$(head -1 "$x/fonts.dir" >$devnull 2>&1)" = 0 ] &&
64 elif [ "$x" = gui/icons ]; then
65 find $x -mindepth 1 -maxdepth 2 -type d | while read -r x; do
66 [ ! -e "$x/index.theme" ] && continue
67 which gtk-update-icon-cache >$devnull 2>&1 &&
68 gtk-update-icon-cache "$x"
71 find "$x" -mindepth 1 -maxdepth 1 | while read -r x; do
77 if which gpg >$devnull 2>&1; then
78 mkdir -p "$DEST/etc/gnupg"
79 find gnupg -mindepth 1 -maxdepth 1 \! -name '*.gpg' | while read -r x; do
82 find gnupg -mindepth 1 -maxdepth 1 -name '*.gpg' | while read -r x; do
88 find ssh -mindepth 1 -maxdepth 1 | while read -r x; do
91 # termux, assume it if android
92 if [ $(uname -o) = 'Android' ]; then
93 mkdir -p "$DEST/.termux"
94 find termux -mindepth 1 -maxdepth 1 | while read -r x; do
96 l ".termux/font.ttf" 'share/fonts/Dina-ttf/Dina.ttf'