blob: f54b249eee0dd4a56810836c5fc1dacc86cdc7e9 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#!/bin/sh
set -e
cd "$(dirname "$0")"
I_PREFIX=/
U_BASE=true
U_BASH=false
U_ZSH=false
U_DESKTOP=false
while [ $# -gt 0 ]; do
case "$1" in
--help|-h)
echo "Usage: $0 [OPTION].."
echo
echo "Options:"
echo " -h, --help"
echo " Print this help text."
echo " -d, --desktop"
echo " Install desktop specific configuration extensions for shellrc"
echo " -b, --bash"
echo " Install bash configuration"
echo " -z, --zsh"
echo " Install zsh configuration"
echo " --no-base"
echo " Do not install base only bash or zsh or desktop is installed"
echo " --prefix PATH"
echo " Install prefix (in default set to /)"
exit 0
;;
--bash|-b)
U_BASH=true
;;
--zsh|-z)
U_ZSH=true
;;
--no-base)
U_BASE=false
;;
-d|--desktop)
U_DESKTOP=true
;;
--prefix)
shift
I_PREFIX="$1"
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
shift
done
# Install shellrc
if $U_BASE; then
mkdir -p "$I_PREFIX/usr/share/shellrc"
cp -r shellrc.d/. "$I_PREFIX/usr/share/shellrc/"
fi
if $U_DESKTOP; then
mkdir -p "$I_PREFIX/usr/share/shellrc"
cp -r shellrc-desktop.d/. "$I_PREFIX/usr/share/shellrc/"
fi
if $U_BASH; then
mkdir -p "$I_PREFIX/etc/bash"
cp -r bashrc.d/. "$I_PREFIX/etc/bash/bashrc.d"
cat >"$I_PREFIX/etc/bash/bashrc.d/shellrc" <<-"EOF"
for sh in /usr/share/shellrc/*; do
[ -r "$sh" ] && . "$sh"
done
EOF
mkdir -p "$I_PREFIX/usr/share/bash-completion/completions"
cp -r bash-completion/. "$I_PREFIX/usr/share/bash-completion/completions/"
fi
if $U_ZSH; then
mkdir -p "$I_PREFIX/etc/zsh"
cat >"$I_PREFIX/etc/zsh/zshrc" <<-"EOF"
[[ -o interactive ]] || return # skip on initialization if not interactive
for sh in /etc/zsh/zshrc.d/*; do
[ -r "$sh" ] && . "$sh"
done
EOF
cp -r zshrc.d/. "$I_PREFIX/etc/zsh/zshrc.d"
cat >"$I_PREFIX/etc/zsh/zshrc.d/shellrc" <<-"EOF"
for sh in /usr/share/shellrc/*; do
[ -r "$sh" ] && . "$sh"
done
EOF
mkdir -p "$I_PREFIX/usr/share/zsh/site-functions"
cp -r zsh-completion/. "$I_PREFIX/usr/share/zsh/site-functions"
fi
|