-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·60 lines (50 loc) · 976 Bytes
/
install.sh
File metadata and controls
executable file
·60 lines (50 loc) · 976 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
EXECUTABLE="${BASH_SOURCE:-$0}"
ROOT="$(dirname "$(readlink -f "$EXECUTABLE")")"
function usage() {
cat <<EOF
Usage: $EXECUTABLE [-h | --help]
Options:
-h, --help Show this page
EOF
}
function main() {
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
case "$1" in
-h | --help)
usage
exit
;;
--*)
error "Unrecognised option: $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}"
unset POSITIONAL_ARGS
symlink-files
}
function symlink-files() {
# Install home dotfiles
for f in "$ROOT"/home/.*; do
ln -siv "$f" ~/ || true
done
# Install config files
mkdir -p ~/.config/
for f in "$ROOT"/config/*; do
ln -siv "$f" ~/.config/ || true
done
# Install local bin
mkdir -p ~/.local/bin
for f in "$ROOT"/bin/*; do
ln -siv "$f" ~/.local/bin/ || true
done
}
main "$@"