-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.zsh
executable file
·71 lines (48 loc) · 1.38 KB
/
install.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env zsh
# set common variables
FOX_DEN="${0:h:A}"
FOX_DEN_SETUP="$FOX_DEN/setup"
DEN="$(dirname "$(dirname "${0:h:A}")")"
INSTALL_OK="$DEN/.ok"
[ -f "$INSTALL_OK" ] && echo "den is already installed." && exit 0
. "$FOX_DEN/base/functions.zsh"
. "$FOX_DEN_SETUP/fn.zsh"
den::source usr/burrow/rc.zsh
den::install::checkExists 'etc' "$HOME"
den::install::checkExists 'usr' "$HOME"
den::install::checkExists 'var' "$HOME"
echo "clean environment. can continue."
echo "making dir '$HOME/opt' (if it does not already exist)."
[ ! -d "$HOME/opt" ] && mkdir "$HOME/opt"
# link etc
den::install::link 'etc'
# link usr
den::install::link 'usr'
HOME_VAR="$HOME/var"
# make var dir and subdirs
mkdir "$HOME_VAR"
mkdir "$HOME_VAR/cache"
mkdir "$HOME_VAR/history"
if den::is::linux; then
mkdir -p "$HOME/.local"
den::install::checkBackupHome '.local/share'
ln -s "$HOME_VAR" "$HOME/.local/share"
fi
den::install::checkBackupHome '.cache'
ln -s "$HOME_VAR/cache" "$HOME/.cache"
# source environment
den::install::source 'zshenv'
# source rc
den::install::source 'zshrc'
# load paths variables
den::source 'etc/zsh/zshenv'
echo "running install scripts from '$FOX_DEN_SETUP/plans'."
for i in "$FOX_DEN_SETUP/plans/"*.zsh; do
echo "*** running script '$i'. ***"
. "$i"
done
echo "done with scripts."
# set the flag
touch "$INSTALL_OK"
echo "den installation complete. enjoy!"
# all done