.lib/sh/stubexec.sh

changeset 1002
8284b9cac608
parent 995
ef237971026b
child 1110
e4edb1419e3f
equal deleted inserted replaced
1001:0597cb8f2d07 1002:8284b9cac608
17 esac 17 esac
18 echo "$binpath" 18 echo "$binpath"
19 done 19 done
20 } 20 }
21 21
22 age_check() {
23 local subject=''
24 read subject
25 find "$subject" -mtime -${age_limit:-90} -print
26 }
27
22 realbin() { 28 realbin() {
23 local bn="$(basename $1)" 29 local bn="$(basename $1)"
24 which -a "$bn" | 30 which -a "$bn" |
25 grep -v "$(realpath $1)" | 31 grep -v "$(realpath $1)" |
26 shim_filter "$bn" | 32 shim_filter "$bn" |
27 head -n 1 33 head -n 1
28 } 34 }
29 35
30 stubexec() { 36 stubexec() {
31 local real_bin="$(realbin "$0")" 37 local real_bin="$(realbin "$0" | age_check)"
32 if [ -x "$real_bin" ]; then 38 if [ -x "$real_bin" ]; then
33 exec "$real_bin" "$@" 39 exec "$real_bin" "$@"
34 fi 40 fi
35 install_it 41 install_it
42 touch "$(realbin "$0")" # In case of no updates
36 stubexec "$@" 43 stubexec "$@"
37 } 44 }
38 45
39 stubexec "$@" 46 stubexec "$@"

mercurial