blob: 7fecfde9863438d9f9b692f48b90ca101b4c61d9 (
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
|
#!/bin/sh
trap "exit 1" EXIT INT
test "$(id -u)" != 0 && sudo=sudo
die() {
echo "$@" 1>&2
}
if ! stow --version >/dev/null 2>&1; then
die "stow not installed or not found."
die "install stow? (arch)"
die -n ">"
test "y" = "$(head -n 1)" &&
$sudo pacman -Sy stow ||
exit 1
fi
if [ -n "${MACH:=$1}" ]; then
die "I: stowing for $MACH"
else
die "E: MACH not set"
die "Enter valid value for 'MACH'"
die "d(esktop) | s(erver) | l(aptop)"
die -n ">"
read MACH
fi
mkdir -p "$HOME/bin"
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.local/share"
ln -sf "$(realpath "$0")" $HOME/bin/
cd "$(dirname "$(realpath "$0")")" || exit 1
case "$MACH" in
"desktop" | "d" | "laptop" | "l")
stow -d bin/ -t "$HOME/bin" -R common guiscripts menuscripts extra
stow -d config/ -t "$HOME/.config" -R essentials common extra X theme wayland
stow -d config/ -t "$HOME/" -R home
stow share/ -t "$HOME/.local/share"
;;
"server" | "s")
stow -d bin/ -t "$HOME/bin" -R common serverscripts menuscripts
stow -d config/ -t "$HOME/.config" -R essentials common
stow -d config/ -t "$HOME/" -R home
stow share/ -t "$HOME/.local/share"
;;
*)
die "E: invalid value for 'MACH'"
break
;;
esac
|