From c3d64f08e46e975422a787b74262abcafe1d45e6 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 12 May 2016 23:15:30 -0700 Subject: [PATCH] fix running for traci homedir --- conflink | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/conflink b/conflink index e263e06..a4a32da 100755 --- a/conflink +++ b/conflink @@ -32,14 +32,7 @@ subdir-link-r() { local fullpath="$(readlink -f "$path")" #e $fullpath $below # debug if [[ -f $path || $(dirname $(readlink -f "$fullpath")) == "$below" ]]; then - if [[ $dir == /p/* ]]; then - homes=(/home/ian) - else - homes=(/home/*) - fi - for user in ${homes[@]}; do - sysv lnf -T "$path" "$user/${path#$root/}" - done + sysv lnf -T "$path" "$HOME/${path#$root/}" elif [[ -d "$path" ]]; then subdir-link-r "$root" "$path" fi @@ -54,12 +47,26 @@ common-file-setup() { (( ${#x[@]} >= 1 )) || return 0 sysv lnf ${x[@]} ~ # as of this writing, it doesn't exist in /a/c, but I've used it in the past. - if [[ -e $1/filesystem ]]; then + if [[ -e $1/filesystem && $USER == ian ]]; then sysv s cp -R $1/filesystem/* / fi } -# p needs to go first so .ssh link is created, then config link inside it -for dir in {/a/c,/p/c}{,/machine_specific/$HOSTNAME}; do - common-file-setup $dir -done +case $USER in + ian) + # p needs to go first so .ssh link is created, then config link inside it + for dir in {/a/c,/p/c}{,/machine_specific/$HOSTNAME}; do + common-file-setup $dir + done + sudo -u traci "$BASH_SOURCE" + ;; + traci) + for dir in /a/c{,/machine_specific/$HOSTNAME}; do + common-file-setup $dir + done + ;; + *) + echo "$0: error: run as ian or traci" + exit 1 + ;; +esac -- 2.30.2