fixes and improvements
[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 lnf -v /p/bin/* /a/exe
39
40 cd /a/exe
41 if (( ${#existing[@]} )); then
42 echo run manually:
43 fi
44 for f in ${!existing[@]}; do
45 echo rm -fv $f
46 done
47
48
49
50 # things we don't want to run in /a, because
51 # they are long running and could get in the way of
52 # btrfs remounting
53 e /a/bin/distro-setup/install-my-scripts