3 source /a
/bin
/errhandle
/errcatch-function
4 source /a
/bin
/errhandle
/bash-trace-function
13 lnf
() { /a
/exe
/lnf
"$@"; }
17 shopt -s extglob
# note, already set with bash -l
19 # If we make a link back to the root, we stop going deeper into subdir_files.
20 # This makes it so we can do subdir directories.
22 # Also note, under filesystem/, symlinks are expanded.
28 targets
=( "$2"/!(.git|..|.
) )
30 for f
in "$1"/!(.git|..|.
); do
31 [[ -d $f ]] && targets
+=("$f") ||
:
34 local below
="$( readlink -f "$root/..
")"
35 for path
in "${targets[@]}"; do
36 local fullpath
="$(readlink -f "$path")"
37 #e $fullpath $below # debug
38 if [[ -f $path || $
(dirname $
(readlink
-f "$fullpath")) == "$below" ]]; then
39 m lnf
-T "$path" "$HOME/${path#$root/}"
40 elif [[ -d "$path" ]]; then
41 subdir-link-r
"$root" "$path"
49 local dir fs x bdir f dst
52 if [[ -e $fs && $USER == ian
]]; then
53 # note, symlinks get resolved, not copied.
54 m s
cp -RLT --preserve=mode
,timestamps
$fs /
57 # one program so far does not work with a symlink,
58 # so we have to use a bind mount
60 if [[ -e $bdir && $USER == ian
]]; then
61 for f
in $
(find $bdir -type f
); do
62 dst
=/home
/ian
/${f##$bdir}
63 if [[ ! -e $dst || $
(stat
-c%i
$f $dst |
uniq -u) ]]; then
64 if mountpoint
-q $dst; then
67 # note: in future, may need to mkdir also
68 [[ -e $dst ]] ||
touch $dst
69 s mount
--bind $f $dst
74 if [[ -e $dir/subdir_files
]]; then
75 subdir-link-r
$dir/subdir_files
77 local x
=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.
) )
78 (( ${#x[@]} >= 1 )) ||
continue
83 all_dirs
=({/a
/c
,/p
/c
}{,/machine_specific
/$HOSTNAME})
84 # note, we assume a group of hosts does not have the
85 # same name as a single host, which is no problem on our scale.
86 for x
in /p
/c
/machine_specific
/*.hosts
; do
87 if grep -qxF $HOSTNAME $x; then all_dirs
+=( ${x%.hosts} ); fi
90 c_dirs
=(/a
/c
{,/machine_specific
/$HOSTNAME})
93 # p needs to go first so .ssh link is created, then config link inside it
94 common-file-setup
${all_dirs[@]}
95 if [[ -d /etc
/bind
/bind-writable
]]; then
96 s chgrp
bind /etc
/bind
/bind-writable
98 sudo
-u traci
"$BASH_SOURCE"
101 common-file-setup
${c_dirs[@]}
104 echo "$0: error: unexpected user"; exit 1