3 source /a
/bin
/errhandle
/err
10 lnf
() { /a
/exe
/lnf
"$@"; }
14 shopt -s extglob
# note, already set with bash -l
16 # If we make a link back to the root, we stop going deeper into subdir_files.
17 # This makes it so we can do subdir directories.
19 # Also note, under filesystem/, symlinks are expanded.
25 targets
=( "$2"/!(.git|..|.
) )
27 for f
in "$1"/!(.git|..|.
); do
28 [[ -d $f ]] && targets
+=("$f") ||
:
31 local below
="$( readlink -f "$root/..
")"
32 for path
in "${targets[@]}"; do
33 local fullpath
="$(readlink -f "$path")"
34 #e $fullpath $below # debug
35 if [[ -f $path || $
(dirname $
(readlink
-f "$fullpath")) == "$below" ]]; then
36 m lnf
-T "$path" "$HOME/${path#$root/}"
37 elif [[ -d "$path" ]]; then
38 subdir-link-r
"$root" "$path"
46 local dir fs x bdir f dst
49 if [[ -e $fs && $USER =~ ^iank?$
]]; then
50 # note, symlinks get resolved, not copied.
51 s
tar --mode=g-s
--owner=0 --group=0 -cz -C $fs . | s
tar -xz -C /
54 if [[ -e $dir/subdir_files
]]; then
55 m subdir-link-r
$dir/subdir_files
57 local x
=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.
) )
58 (( ${#x[@]} >= 1 )) ||
continue
63 all_dirs
=({/a
/c
,/p
/c
}{,/machine_specific
/$HOSTNAME})
64 # note, we assume a group of hosts does not have the
65 # same name as a single host, which is no problem on our scale.
66 for x
in /p
/c
/machine_specific
/*.hosts
; do
67 if grep -qxF $HOSTNAME $x; then all_dirs
+=( ${x%.hosts} ); fi
70 c_dirs
=(/a
/c
{,/machine_specific
/$HOSTNAME})
73 # p needs to go first so .ssh link is created, then config link inside it
74 m common-file-setup
${all_dirs[@]}
76 #### begin special extra stuff ####
77 install -d -m700 ~
/gpg-agent-socket
80 if [[ -e $files ]]; then
81 # reset to the original permissions.
82 m s chgrp
-R bind ${files[@]}
83 m s
chmod g
+w
${files[@]}
85 if [[ -e /etc
/davpass
]] && getent group www-data
&>/dev
/null
; then
86 s chgrp www-data
/etc
/davpass
88 if [[ -e /var
/lib
/znc
]] && getent group znc
; then
89 s chown
-R znc
:znc
/var
/lib
/znc
91 /a
/exe
/lnf
-T /p
/arbtt-capture.log ~
/.arbtt
/capture.log
92 ##### end special extra stuff #####
94 sudo bash
-c 'cd /etc/openvpn; for f in client/*; do ln -sf $f .; done'
95 sudo bash
-c 'chmod 600 /etc/openvpn/client/*.key'
97 m sudo
-H -u traci
"$BASH_SOURCE"
100 m common-file-setup
${c_dirs[@]}
103 echo "$0: error: unexpected user"; exit 1