various fixes
[distro-setup] / gitslink
1 #!/bin/bash
2
3 source /a/bin/errhandle/err
4
5 e() { echo "$*"; "$@"; }
6 lnf() { /a/bin/lnf/lnf "$@"; }
7
8 shopt -s nullglob
9 shopt -s extglob
10
11 cd /a/exe
12 declare -A existing
13 for f in *; do
14 existing[$f]=t
15 done
16 cd /a/bin
17
18 # sourcing instead of calling script changes runtime from .47s to .36s
19 source /a/bin/lnf/lnf >/dev/null ||:
20
21 for x in !(unused|distro-setup|unfinished|queue|bash-template|buildscripts|crons|data|examples|log-quiet); do
22 [[ -e $x/.git ]] || continue
23 for y in $x/*; do
24 f=${y##*/}
25 if [[ -x $y && ! -d $y ]]; then
26 unset "existing[$f]"
27 lnf -v /a/bin/$y /a/exe
28 fi
29 done
30 done
31 for x in *; do
32 if [[ ! -d $x && -x $x ]]; then
33 unset "existing[$x]"
34 lnf -v /a/bin/$x /a/exe
35 fi
36 done
37
38 cd /a/exe
39 for f in ${!existing[@]}; do
40 echo want to do rm -fv $f
41 done
42
43
44
45 # things we don't want to run in /a, because
46 # they are long running and could get in the way of
47 # btrfs remounting
48 e /a/bin/distro-setup/install-my-scripts