]>
Commit | Line | Data |
---|---|---|
1b8a4102 | 1 | #!/bin/sh |
03bc64c4 | 2 | |
8720834f | 3 | #NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install |
4 | ||
84251d17 | 5 | # test |
fef7b7c4 | 6 | devnull=/dev/null |
8720834f | 7 | if [ "$1" = "test" ]; then |
fef7b7c4 | 8 | echo "Running test -- no changes will be applied" |
9 | devnull=/dev/stdout | |
10 | _cd() { | |
11 | cd $*; | |
12 | echo " cd $*"; | |
13 | echo "\$PWD=$PWD"; | |
14 | } | |
15 | alias cd="_cd" | |
16 | alias mkdir="echo mkdir" | |
7f359c8a | 17 | alias ln="echo ln" |
18 | alias rm="echo rm" | |
fef7b7c4 | 19 | alias sh="echo sh" |
7f359c8a | 20 | fi |
21 | ||
d50f11d1 | 22 | # create preferred folder structure |
d877aef2 | 23 | cd ~ |
fef7b7c4 | 24 | mkdir -p bin etc share share/fonts .urxvt/ext .icons .themes >$devnull 2>&1 |
25 | mkdir -pm 700 var/tmp var/tmp/vim >$devnull 2>&1 | |
26 | cd - >$devnull | |
1873e725 | 27 | |
dcac60d9 | 28 | # ensure ostype |
74024535 | 29 | if [ -z "$OSTYPE" ]; then |
ff1a2414 | 30 | OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'` |
74024535 | 31 | fi |
dcac60d9 | 32 | |
33 | # accomodate multiple userlands | |
34 | lnargs=-sfnv | |
d877aef2 | 35 | case "$OSTYPE" in |
fef7b7c4 | 36 | freebsd*) lnargs=-sFhv;; |
8720834f | 37 | netbsd|openbsd*) lnargs=-sfhv;; |
cf9ecb6f | 38 | esac |
39 | ||
7f359c8a | 40 | l() { |
1390d028 | 41 | # TODO: use install? |
fef7b7c4 | 42 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \ |
43 | echo "!!! File exists and is not a link: $1" | |
7f359c8a | 44 | } |
45 | ||
84251d17 | 46 | # link files |
fef7b7c4 | 47 | find base -mindepth 1 -maxdepth 1 | while read -r x; do |
7f359c8a | 48 | l "$HOME/`basename "$x"`" |
49 | done | |
a615ef3e | 50 | # requires existing source tree and `make dabuild` |
52c8e291 | 51 | for x in dabuild dabuild-admin; do |
52 | x="$HOME/src/docker-abuild/$x" | |
53 | if [ -e "$x" ]; then | |
54 | l "$HOME/bin/`basename "$x"`" "$x" | |
55 | fi | |
56 | done | |
d877aef2 | 57 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
fef7b7c4 | 58 | l "$HOME/$x" |
1390d028 | 59 | done |
fef7b7c4 | 60 | find xdg -mindepth 1 -maxdepth 1 | while read -r x; do |
8720834f | 61 | l "$HOME/etc/`basename "$x"`" |
04ff96a4 | 62 | done |
c72b1cbd | 63 | find urxvt-ext -mindepth 1 -maxdepth 2 -type f -perm -111 | while read -r x; do |
7f359c8a | 64 | l "$HOME/.urxvt/ext/`basename $x`" |
82151901 | 65 | done |
c72b1cbd | 66 | find xorg/icons -mindepth 1 -maxdepth 2 -type d | while read -r x; do |
dcac60d9 | 67 | if [ -e "$x/index.theme" ]; then |
152474f6 | 68 | d="$HOME/.icons/`basename "$x"`" |
69 | l $d | |
70 | which gtk-update-icon-cache >/dev/null 2>&1 && gtk-update-icon-cache -qtf $d | |
71 | unset d | |
dcac60d9 | 72 | fi |
7796231b | 73 | done |
c72b1cbd | 74 | find xorg/themes -mindepth 1 -maxdepth 1 -type d | while read -r x; do |
7796231b | 75 | l "$HOME/.themes/`basename "$x"`" |
8720834f | 76 | done |
c72b1cbd | 77 | find fonts -mindepth 1 -maxdepth 1 -type d | while read -r x; do |
8720834f | 78 | l "$HOME/share/fonts/`basename "$x"`" |
ff1a2414 | 79 | done |
fef7b7c4 | 80 | #XXX: potential bug with newlines in profile name (if ff even takes it) |
c72b1cbd | 81 | #XXX: only uses first profile folder, read from profiles.ini |
82 | ffdir="`find "$HOME/.mozilla/firefox" -mindepth 1 -maxdepth 1 -type d | head -1 2>$devnull`" | |
fef7b7c4 | 83 | if [ -d "$ffdir" ]; then |
84 | find firefox -mindepth 1 -maxdepth 1 | while read -r x; do | |
85 | l "$ffdir/`basename "$x"`" | |
86 | done | |
87 | cd "$ffdir" | |
88 | echo "Updating user.js" | |
89 | sh ./user-js-updater.sh | |
90 | cd - >$devnull | |
91 | fi | |
04ff96a4 | 92 | |
d50f11d1 | 93 | # run .zprofile to set up tmp |
c72b1cbd | 94 | # .zprofile also sources .zshenv for compatibility |
dcac60d9 | 95 | zsh ~/.zprofile |