11 usage: $0 [ <options> ] [ <files> ]
13 -f Update files in current directory from configuration files in home.
14 -t Update configuration files from files in current directory; make backups.
15 -T Like ‘-t’ but don’t make any backups.
16 -y Assume ‘y’ to all questions, i.e. overwrite any changed files w/o asking.
17 -n Assume ‘n’ to all questions, i.e. only copy new files; leave existing be.
36 while arg
=${arg#?}; [ -n "$arg" ]; do
38 f
*) direction
=from
; backup
=false
;;
39 t
*) direction
=to
; backup
=true
;;
40 T
*) direction
=to
; backup
=false
;;
41 y
*) ask
=if_different
;;
52 if ! which tput >/dev
/null
2>&1; then
67 echo 'Updating files in current directory from configuration files'
73 echo 'Updating configuration files from files in current directory'
101 ## Interactive asking
103 if diff=$
(which cdiff
2>&1); then
111 set -- "$@" "$(readlink "$2")" "$(readlink "$3")"
113 if [ x
"$4" = x
"$5" ]; then
114 if [ -n "$4" ] ||
cmp -s "$2" "$3"; then
119 if [ x
"$1" != x-v
]; then
121 elif [ -z "$4$5" ]; then
122 "$diff" -u -- "$3" "$2"
127 printf '%s\n' "--- $3"
128 printf '%s\n' "+++ $2"
146 if equal
-v "$1" "$2"; then
160 read answer ||
exit 0
174 ## Emacs files handling
177 if [ -n "$(which emacs 2>/dev/null)" ]; then
182 emacs
--batch -f batch-byte-compile
"$1"
191 case $3 in *@
) set -- "$1" "$2" "${3%@}${2##*/}"; esac
194 [ -d "${3%/*}" ] ||
return 0
195 set -- "$1" "$3" "$2"
198 if [ -h "$3" ] ||
[ -e "$3" ]; then
199 if ! $ask "$2" "$3" <&3; then
207 mkdir
-p -- "${3%/*}"
211 case "$direction:$3" in to
:*.el
)
216 while read pattern destination
; do
217 for file in $pattern; do
218 case "$file" in *\~|
*/\
#*|*\#|*/.*)
221 if ! match
"$@"; then
223 elif [ -h "$file" ] ||
[ -f "$file" ]; then
224 handle
"$direction" "$file" "$HOME/$destination"
225 elif ! [ -e "$file" ]; then
226 echo "update: $file: missing, skipping" >&2
232 emacs/* .config/emacs/@
235 irssi.theme .irssi/mina.theme
236 libexec/* .local/libexec/@
239 sawfishrc .sawfish/rc
242 x/80-char.png .urxvt/@
243 x/Xresources .config/@
244 x/gtk-3.0.ini .config/gtk-3.0/settings.ini
246 x/local.keymap .config/xkb/keymap/local
247 x/local.symbols .config/xkb/symbols/local