blob: ac6d861e7e34b2818947ba52281794ae14ed5bb0 (
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
|
#!/bin/sh
set -e
CDPATH='' cd -- "$(dirname -- "$0")" || exit
TARGET=${TARGET:-$HOME}
if [ -r .installed ]; then
read -r DOTFILES_INSTALLED <.installed
export DOTFILES_INSTALLED
fi
printf "%s: Stowing packages\n" "$0"
# shellcheck disable=SC2086
stow -R "$@" ${1:-*}/ 2>&1 | awk '
/^UNLINK:/ { stdout[NR] = $0; unlinked[$2] = NR; next }
/\(reverts previous action\)$/ { delete stdout[unlinked[$2]]; next }
/^LINK:/ { stdout[NR] = $0; next }
{ stderr[NR] = $0 }
END {
for (out in stdout) { print stdout[out] };
for (err in stderr) { print stderr[err] > "/dev/stderr" }
if ( length(stderr) > 0 ) { exit 1 }
}
'
printf "%s: Installing packages\n" "$0"
for f in ${1:-*}/install.sh; do
$f
done
git rev-parse ^@ >.installed
|