]>
Commit | Line | Data |
---|---|---|
189288f7 | 1 | #!/bin/sh |
d9362f34 | 2 | |
7197cc5c | 3 | #NOTE: .zshenv XDG paths are hardcoded to allow non-zsh install |
4 | ||
1f8bf106 | 5 | # test |
f993e922 | 6 | devnull=/dev/null |
7197cc5c | 7 | if [ "$1" = "test" ]; then |
f993e922 | 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" | |
9938f1e2 | 17 | alias ln="echo ln" |
18 | alias rm="echo rm" | |
f993e922 | 19 | alias sh="echo sh" |
9938f1e2 | 20 | fi |
21 | ||
fef6b2b5 | 22 | # create preferred folder structure |
ba63cd01 | 23 | cd ~ |
f993e922 | 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 | |
5b39422d | 27 | |
a568f7fa | 28 | # ensure ostype |
3daa445f | 29 | if [ -z "$OSTYPE" ]; then |
f7960c69 | 30 | OSTYPE=`uname -s | tr '[:upper:]' '[:lower:]'` |
3daa445f | 31 | fi |
a568f7fa | 32 | |
33 | # accomodate multiple userlands | |
34 | lnargs=-sfnv | |
ba63cd01 | 35 | case "$OSTYPE" in |
f993e922 | 36 | freebsd*) lnargs=-sFhv;; |
7197cc5c | 37 | netbsd|openbsd*) lnargs=-sfhv;; |
138de127 | 38 | esac |
39 | ||
9938f1e2 | 40 | l() { |
f29cd560 | 41 | # TODO: use install? |
f993e922 | 42 | [ -L "$1" -o \! -e "$1" ] && ln $lnargs "${2:-$PWD/$x}" "$1" || \ |
43 | echo "!!! File exists and is not a link: $1" | |
9938f1e2 | 44 | } |
45 | ||
1f8bf106 | 46 | # link files |
f993e922 | 47 | find base -mindepth 1 -maxdepth 1 | while read -r x; do |
9938f1e2 | 48 | l "$HOME/`basename "$x"`" |
49 | done | |
c502db45 | 50 | # requires existing source tree and `make dabuild` |
496e2ee3 | 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 | |
ba63cd01 | 57 | find bin share -mindepth 1 -maxdepth 1 | while read -r x; do |
f993e922 | 58 | l "$HOME/$x" |
f29cd560 | 59 | done |
f993e922 | 60 | find xdg -mindepth 1 -maxdepth 1 | while read -r x; do |
7197cc5c | 61 | l "$HOME/etc/`basename "$x"`" |
7f0acd88 | 62 | done |
3fb394c5 | 63 | find urxvt-ext -mindepth 1 -maxdepth 2 -type f -perm -111 | while read -r x; do |
9938f1e2 | 64 | l "$HOME/.urxvt/ext/`basename $x`" |
805ce2dc | 65 | done |
3fb394c5 | 66 | find xorg/icons -mindepth 1 -maxdepth 2 -type d | while read -r x; do |
a568f7fa | 67 | if [ -e "$x/index.theme" ]; then |
fc768c23 | 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 | |
a568f7fa | 72 | fi |
90595fd4 | 73 | done |
3fb394c5 | 74 | find xorg/themes -mindepth 1 -maxdepth 1 -type d | while read -r x; do |
90595fd4 | 75 | l "$HOME/.themes/`basename "$x"`" |
7197cc5c | 76 | done |
3fb394c5 | 77 | find fonts -mindepth 1 -maxdepth 1 -type d | while read -r x; do |
7197cc5c | 78 | l "$HOME/share/fonts/`basename "$x"`" |
f7960c69 | 79 | done |
f993e922 | 80 | #XXX: potential bug with newlines in profile name (if ff even takes it) |
3fb394c5 | 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`" | |
f993e922 | 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 | |
7f0acd88 | 92 | |
fef6b2b5 | 93 | # run .zprofile to set up tmp |
3fb394c5 | 94 | # .zprofile also sources .zshenv for compatibility |
a568f7fa | 95 | zsh ~/.zprofile |