#!/bin/csh -f #H# Update an account with my shell config. Usage: #H# shellupdate.csh localhost This updates the local account $2 based #H# on your login #H# shellupdate.csh This updates the account on the remote #H# host based on your login #H# shellupdate.csh This updates the current account #H# based on kmk@sanitarium.net if ($1 == "-h") then grep ^\#H\#\ $0 | sed -e 's/\#H\#\ //' exit endif set User=`whoami` if ($1 == "localhost") then set SourceUser=`who am i | awk '{print $1}' | sed -e 's/.*\\!//'` echo "Updating local account $2 using local account $SourceUser..." cp -fv ~${SourceUser}/.tcshrc ~${SourceUser}/.dir_colors ~${2}/ rsync -va --itemize-changes --progress --delete ~${SourceUser}/.os ~${2}/ if ($2 == "root") then chown 0:0 /root/.tcshrc /root/.dir_colors chown -R 0:0 /root/.os endif exec echo done. endif if ($1 != "") then echo "Updating tcsh settings on ${2}@${1} using the current account..." rsync -va --itemize-changes --delete ~/.tcshrc ~/.dir_colors ~/.os ${2}@${1}: if ($2 == "root") then ssh $1 -l root chown -R 0:0 /root/.tcshrc /root/.dir_colors /root/.os endif else echo "Updating tcsh settings on current account from kmk@hellmouth.sanitarium.net..." #scp -p kmk@hellmouth.sanitarium.net:.tcshrc kmk@hellmouth.sanitarium.net:.dir_colros ~/ rsync -va --itemize-changes --progress --delete kmk@hellmouth.sanitarium.net:.os :.tcshrc :.dir_colors ~/ if ($User == "root") then chown 0:0 /root/.tcshrc /root/.dir_colors chown -R 0:0 /root/.os endif endif