X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=conflink;h=38aacf02ac885a8a8c2ff0da27043c007373f457;hb=15f043c2c297176bd623d8a8602e2dc5d67eacd6;hp=6a9e4ff975c40de0ed248cde96a60a27475c249a;hpb=e1413c8bd07f92ec8e1209db83225b56bc39055d;p=distro-setup diff --git a/conflink b/conflink index 6a9e4ff..38aacf0 100755 --- a/conflink +++ b/conflink @@ -49,30 +49,13 @@ common-file-setup() { local dir fs x bdir f dst for dir in "$@"; do fs=$dir/filesystem - if [[ -e $fs && $USER == ian ]]; then + if [[ -e $fs && $USER =~ ^iank?$ ]]; then # note, symlinks get resolved, not copied. - m s cp -RLT --preserve=mode,timestamps $fs / - fi - - # one program so far does not work with a symlink, - # so we have to use a bind mount - bdir=$dir/binds - if [[ -e $bdir && $USER == ian ]]; then - for f in $(find $bdir -type f); do - dst=/home/ian/${f##$bdir} - if [[ ! -e $dst || $(stat -c%i $f $dst |uniq -u) ]]; then - if mountpoint -q $dst; then - s umount $dst - fi - # note: in future, may need to mkdir also - [[ -e $dst ]] || touch $dst - s mount --bind $f $dst - fi - done + s tar --mode=g-s --owner=0 --group=0 -cz -C $fs . | s tar -xz -C / fi if [[ -e $dir/subdir_files ]]; then - subdir-link-r $dir/subdir_files + m subdir-link-r $dir/subdir_files fi local x=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.) ) (( ${#x[@]} >= 1 )) || continue @@ -89,16 +72,32 @@ done c_dirs=(/a/c{,/machine_specific/$HOSTNAME}) case $USER in - ian) + ian|iank) # p needs to go first so .ssh link is created, then config link inside it - common-file-setup ${all_dirs[@]} + m common-file-setup ${all_dirs[@]} + + #### begin special extra stuff #### + install -d -m700 ~/gpg-agent-socket if [[ -d /etc/bind/bind-writable ]]; then - s chgrp bind /etc/bind/bind-writable + # need bind writable dir for nsupdate, or else we get + # named[20823]: /etc/bind/db.iank.pw.jnl: create: permission denied + m s chgrp bind /etc/bind/bind-writable + fi + files=(/etc/bind/[Kk]*) + if [[ -e $files ]]; then + m s chgrp bind ${files[@]} fi - sudo -u traci "$BASH_SOURCE" + if [[ -e /etc/davpass ]] && getent group www-data &>/dev/null; then + s chgrp www-data /etc/davpass + fi + ##### end special extra stuff ##### + + + + m sudo -H -u traci "$BASH_SOURCE" ;; traci) - common-file-setup ${c_dirs[@]} + m common-file-setup ${c_dirs[@]} ;; *) echo "$0: error: unexpected user"; exit 1