summaryrefslogtreecommitdiffstatshomepage
path: root/install.sh
blob: 9bf276d71503106dba10db99b20c87f3f47fb914 (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
#!/bin/sh
# shellcheck disable=SC2035,SC2016

set -e

CDPATH='' cd -- "$(dirname -- "$0")" || exit

printf "%s: Removing bad links\n" "$0"
(
	git diff-tree --no-commit-id --name-status e6051a3..HEAD -r
	git diff --no-commit-id --name-status -r
) |
	grep -oP 'D\t[^/]+/\K(.*)' |
	while read -r f; do
		if [ -L "../$f" ] && [ ! -e "../$f" ]; then
			rm -v "../$f"
		fi
	done

printf "%s: Stowing packages\n" "$0"
stow "$@" */

for f in */install.sh; do
	$f
done