[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XFree86 SVN commit: r2233 - trunk/debian



Author: branden
Date: 2005-04-06 15:43:28 -0500 (Wed, 06 Apr 2005)
New Revision: 2233

Modified:
   trunk/debian/CHANGESETS
   trunk/debian/TODO
   trunk/debian/changelog
   trunk/debian/shell-lib.sh
Log:
Stop using non-POSIX "local" keyword in shell-lib.sh (continuation of
r2166).


Modified: trunk/debian/CHANGESETS
===================================================================
--- trunk/debian/CHANGESETS	2005-04-06 15:12:28 UTC (rev 2232)
+++ trunk/debian/CHANGESETS	2005-04-06 20:43:28 UTC (rev 2233)
@@ -52,4 +52,7 @@
 Colpart for catching this.  (Closes: #287221)
     2226
 
+Stop using non-POSIX "local" keyword in shell-lib.sh.
+    2233
+
 vim:set ai et sts=4 sw=4 tw=80:

Modified: trunk/debian/TODO
===================================================================
--- trunk/debian/TODO	2005-04-06 15:12:28 UTC (rev 2232)
+++ trunk/debian/TODO	2005-04-06 20:43:28 UTC (rev 2233)
@@ -16,7 +16,6 @@
 
 4.3.0.dfsg.1-13
 ---------------
-* shell-lib.sh is still using the "local" keyword.  Get rid of it.
 * xdm doesn't remove default-display-manager if the corresponding debconf
   question is not registered -- fix its prerm script so it does
 * all packages that install anything to /usr/X11R6 need to depend on

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-04-06 15:12:28 UTC (rev 2232)
+++ trunk/debian/changelog	2005-04-06 20:43:28 UTC (rev 2233)
@@ -39,8 +39,10 @@
     non-transcoded counterpart packages are not installed.  Thanks to Gregory
     Colpart for catching this.  (Closes: #287221)
 
- -- Branden Robinson <branden@debian.org>  Sat, 26 Mar 2005 02:13:36 -0500
+  * Stop using non-POSIX "local" keyword in shell-lib.sh.
 
+ -- Branden Robinson <branden@debian.org>  Wed,  6 Apr 2005 15:39:56 -0500
+
 xfree86 (4.3.0.dfsg.1-12) unstable; urgency=medium
 
   * Urgency set to medium due to fix for release-critical bug #295175

Modified: trunk/debian/shell-lib.sh
===================================================================
--- trunk/debian/shell-lib.sh	2005-04-06 15:12:28 UTC (rev 2232)
+++ trunk/debian/shell-lib.sh	2005-04-06 20:43:28 UTC (rev 2233)
@@ -1,5 +1,10 @@
 # $Id$
 
+# Sadly, the "local" keyword is not POSIX.  Occurences of it are commented out
+# in this file, and the variables that would be local are renamed to prepend an
+# underscore ("_"), in the hope that Debian Policy eventually changes to allow
+# "local" in /bin/sh scripts anyway.
+
 SOURCE_VERSION=@SOURCE_VERSION@
 OFFICIAL_BUILD=@OFFICIAL_BUILD@
 
@@ -198,19 +203,19 @@
   # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin
   # Thanks to Randolph Chung for this clever hack.
 
-  local f g
+  #local f g
 
   while [ -n "$1" ]; do
     reject_whitespace "$1"
-    g=
+    _g=
     message "Analyzing $1:"
-    for f in $(echo "$1" | tr / \  ); do
-      if [ -e /$g$f ]; then
-        ls -dl /$g$f /$g$f.dpkg-* 2> /dev/null || true
-        g=$g$f/
+    for _f in $(echo "$1" | tr / \  ); do
+      if [ -e /$_g$_f ]; then
+        ls -dl /$_g$_f /$_g$_f.dpkg-* 2> /dev/null || true
+        _g=$_g$_f/
       else
-        message "/$g$f: nonexistent; directory contents of /$g:"
-        ls -l /$g
+        message "/$_g$_f: nonexistent; directory contents of /$_g:"
+        ls -l /$_g
         break
       fi
     done
@@ -219,27 +224,27 @@
 }
 
 find_culprits () {
-  local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \
-    msg
+  #local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \
+  #  msg
 
   reject_whitespace "$1"
   message "Searching for overlapping packages..."
-  dpkg_info_dir=/var/lib/dpkg/info
-  if [ -d $dpkg_info_dir ]; then
-    if [ "$(echo $dpkg_info_dir/*.list)" != "$dpkg_info_dir/*.list" ]; then
-      possible_culprits=$(ls -1 $dpkg_info_dir/*.list | egrep -v \
+  _dpkg_info_dir=/var/lib/dpkg/info
+  if [ -d $_dpkg_info_dir ]; then
+    if [ "$(echo $_dpkg_info_dir/*.list)" != "$_dpkg_info_dir/*.list" ]; then
+      _possible_culprits=$(ls -1 $_dpkg_info_dir/*.list | egrep -v \
         "(xbase-clients|xfree86-common|xfs|xlibs)")
-      if [ -n "$possible_culprits" ]; then
-        smoking_guns=$(grep -l "$1" $possible_culprits)
-        if [ -n "$smoking_guns" ]; then
-          bad_packages=$(printf "\\n")
-          for f in $smoking_guns; do
+      if [ -n "$_possible_culprits" ]; then
+        _smoking_guns=$(grep -l "$1" $_possible_culprits)
+        if [ -n "$_smoking_guns" ]; then
+          _bad_packages=$(printf "\\n")
+          for f in $_smoking_guns; do
             # too bad you can't nest parameter expansion voodoo
             p=${f%*.list}      # strip off the trailing ".list"
-            package=${p##*/}   # strip off the directories
-            bad_packages=$(printf "%s\n%s" "$bad_packages" "$package")
+            _package=${p##*/}   # strip off the directories
+            _bad_packages=$(printf "%s\n%s" "$_bad_packages" "$_package")
           done
-          msg=$(cat <<EOF
+          _msg=$(cat <<EOF
 The following packages appear to have file overlaps with the XFree86 packages;
 these packages are either very old, or in violation of Debian Policy.  Try
 upgrading each of these packages to the latest available version if possible:
@@ -251,17 +256,17 @@
 of the Debian Policy manual.
 EOF
 )
-          message "$msg"
-          message "The overlapping packages are: $bad_packages"
+          message "$_msg"
+          message "The overlapping packages are: $_bad_packages"
         else
           message "no overlaps found."
         fi
       fi
     else
-      message "cannot search; no matches for $dpkg_info_dir/*.list."
+      message "cannot search; no matches for $_dpkg_info_dir/*.list."
     fi
   else
-    message "cannot search; $dpkg_info_dir does not exist."
+    message "cannot search; $_dpkg_info_dir does not exist."
   fi
 }
 
@@ -283,7 +288,7 @@
   #
   # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb().
 
-  local symlink
+  #local symlink
 
   # validate arguments
   if [ $# -ne 1 ]; then
@@ -292,9 +297,9 @@
     exit $SHELL_LIB_USAGE_ERROR
   fi
 
-  symlink="$1"
+  _symlink="$1"
 
-  if [ "$(maplink "$symlink")" = "$(readlink "$symlink")" ]; then
+  if [ "$(maplink "$_symlink")" = "$(readlink "$_symlink")" ]; then
     return 0
   else
     return 1
@@ -309,7 +314,7 @@
   # Call this function from a preinst script in the event $1 is "upgrade" or
   # "install".
 
-  local errmsg symlink
+  #local errmsg symlink
 
   # validate arguments
   if [ $# -lt 1 ]; then
@@ -319,25 +324,25 @@
   fi
 
   while [ -n "$1" ]; do
-    symlink="$1"
-    if [ -L "$symlink" ]; then
-      if ! check_symlink "$symlink"; then
-        observe "$symlink symbolic link points to wrong location" \
-                "$(readlink "$symlink"); removing"
-        rm "$symlink"
+    _symlink="$1"
+    if [ -L "$_symlink" ]; then
+      if ! check_symlink "$_symlink"; then
+        observe "$_symlink symbolic link points to wrong location" \
+                "$(readlink "$_symlink"); removing"
+        rm "$_symlink"
       fi
-    elif [ -e "$symlink" ]; then
-      errmsg="$symlink exists and is not a symbolic link; this package cannot"
-      errmsg="$errmsg be installed until this"
-      if [ -f "$symlink" ]; then
-        errmsg="$errmsg file"
-      elif [ -d "$symlink" ]; then
-        errmsg="$errmsg directory"
+    elif [ -e "$_symlink" ]; then
+      _errmsg="$_symlink exists and is not a symbolic link; this package cannot"
+      _errmsg="$_errmsg be installed until this"
+      if [ -f "$_symlink" ]; then
+        _errmsg="$_errmsg file"
+      elif [ -d "$_symlink" ]; then
+        _errmsg="$_errmsg directory"
       else
-        errmsg="$errmsg thing"
+        _errmsg="$_errmsg thing"
       fi
-      errmsg="$errmsg is removed"
-      die "$errmsg"
+      _errmsg="$_errmsg is removed"
+      die "$_errmsg"
     fi
     shift
   done
@@ -350,7 +355,7 @@
   #
   # Call this function from a postinst script.
 
-  local problem symlink
+  #local problem symlink
 
   # validate arguments
   if [ $# -lt 1 ]; then
@@ -360,24 +365,24 @@
   fi
 
   while [ -n "$1" ]; do
-    problem=
-    symlink="$1"
-    if [ -L "$symlink" ]; then
-      if ! check_symlink "$symlink"; then
-        problem=yes
-        warn "$symlink symbolic link points to wrong location" \
-             "$(readlink "$symlink")"
+    _problem=
+    _symlink="$1"
+    if [ -L "$_symlink" ]; then
+      if ! check_symlink "$_symlink"; then
+        _problem=yes
+        warn "$_symlink symbolic link points to wrong location" \
+             "$(readlink "$_symlink")"
       fi
-    elif [ -e "$symlink" ]; then
-      problem=yes
-      warn "$symlink is not a symbolic link"
+    elif [ -e "$_symlink" ]; then
+      _problem=yes
+      warn "$_symlink is not a symbolic link"
     else
-      problem=yes
-      warn "$symlink symbolic link does not exist"
+      _problem=yes
+      warn "$_symlink symbolic link does not exist"
     fi
-    if [ -n "$problem" ]; then
-      analyze_path "$symlink" "$(readlink "$symlink")"
-      find_culprits "$symlink"
+    if [ -n "$_problem" ]; then
+      analyze_path "$_symlink" "$(readlink "$_symlink")"
+      find_culprits "$_symlink"
       die "bad symbolic links on system"
     fi
     shift
@@ -387,7 +392,7 @@
 font_update () {
   # run $UPDATECMDS in $FONTDIRS
 
-  local dir cmd shortcmd x_font_dir_prefix
+  #local dir cmd shortcmd x_font_dir_prefix
 
   x_font_dir_prefix="/usr/X11R6/lib/X11/fonts"
 
@@ -401,31 +406,31 @@
   reject_unlikely_path_chars "$UPDATECMDS"
   reject_unlikely_path_chars "$FONTDIRS"
 
-  for dir in $FONTDIRS; do
-    if [ -d "$x_font_dir_prefix/$dir" ]; then
-      for cmd in $UPDATECMDS; do
-        if which "$cmd" > /dev/null 2>&1; then
-          shortcmd=${cmd##*/}
-          observe "running $shortcmd in $dir font directory"
-          if [ "$shortcmd" = "xftcache" ]; then
-            if [ "$dir" = "Speedo" ]; then
+  for _dir in $FONTDIRS; do
+    if [ -d "$_x_font_dir_prefix/$_dir" ]; then
+      for _cmd in $UPDATECMDS; do
+        if which "$_cmd" > /dev/null 2>&1; then
+          _shortcmd=${_cmd##*/}
+          observe "running $_shortcmd in $_dir font directory"
+          if [ "$_shortcmd" = "xftcache" ]; then
+            if [ "$_dir" = "Speedo" ]; then
               # do nothing; xftcache SEGVs (*sometimes*) when asked to process
               # the Speedo directory
               CMD=:
             fi
             # KLUDGE: xftcache needs to be handed the full path; the command
             # goes away anyway in XFree86 4.3.0
-            dir="$x_font_dir_prefix/$dir"
+            _dir="$_x_font_dir_prefix/$_dir"
           fi
-          $cmd $dir || warn "$cmd $dir failed; font directory data may not" \
-                            "be up to date"
+          $_cmd $_dir || warn "$_cmd $_dir failed; font directory data may" \
+                              "not be up to date"
         else
-          warn "$cmd not found; not updating corresponding $dir font" \
+          warn "$_cmd not found; not updating corresponding $_dir font" \
                "directory data"
         fi
       done
     else
-      warn "$dir is not a directory; not updating font directory data"
+      warn "$_dir is not a directory; not updating font directory data"
     fi
   done
 }
@@ -444,7 +449,7 @@
   # version (or installed over a version removed-but-not-purged) prior to the
   # one in which the conffile was obsoleted.
 
-  local conffile current_checksum
+  #local conffile current_checksum
 
   # validate arguments
   if [ $# -lt 2 ]; then
@@ -456,16 +461,16 @@
   conffile="$1"
   shift
 
-  # does the conffile even exist?
-  if [ -e "$conffile" ]; then
+  # does the _conffile even exist?
+  if [ -e "$_conffile" ]; then
     # calculate its checksum
-    current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
+    _current_checksum=$(md5sum < "$_conffile" | sed 's/[[:space:]].*//')
     # compare it to each supplied checksum
     while [ -n "$1" ]; do
-      if [ "$current_checksum" = "$1" ]; then
+      if [ "$_current_checksum" = "$1" ]; then
         # we found a match; move the confffile and stop looking
-        observe "preparing obsolete conffile $conffile for removal"
-        mv "$conffile" "$conffile.$THIS_PACKAGE-tmp"
+        observe "preparing obsolete conffile $_conffile for removal"
+        mv "$_conffile" "$_conffile.$THIS_PACKAGE-tmp"
         break
       fi
       shift
@@ -481,7 +486,7 @@
   # Call this function from a postinst script after having used
   # remove_conffile_prepare() in the preinst.
 
-  local conffile
+  #local conffile
 
   # validate arguments
   if [ $# -ne 1 ]; then
@@ -490,12 +495,12 @@
     exit $SHELL_LIB_USAGE_ERROR
   fi
 
-  conffile="$1"
+  _conffile="$1"
 
   # if the temporary file created by remove_conffile_prepare() exists, remove it
-  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
-    observe "committing removal of obsolete conffile $conffile"
-    rm "$conffile.$THIS_PACKAGE-tmp"
+  if [ -e "$_conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "committing removal of obsolete conffile $_conffile"
+    rm "$_conffile.$THIS_PACKAGE-tmp"
   fi
 }
 
@@ -508,7 +513,7 @@
   # or "abort-install" is  after having used remove_conffile_prepare() in the
   # preinst.
 
-  local conffile
+  #local conffile
 
   # validate arguments
   if [ $# -ne 1 ]; then
@@ -517,13 +522,13 @@
     exit $SHELL_LIB_USAGE_ERROR
   fi
 
-  conffile="$1"
+  _conffile="$1"
 
   # if the temporary file created by remove_conffile_prepare() exists, move it
   # back
-  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
-    observe "rolling back removal of obsolete conffile $conffile"
-    mv "$conffile.$THIS_PACKAGE-tmp" "$conffile"
+  if [ -e "$_conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "rolling back removal of obsolete conffile $_conffile"
+    mv "$_conffile.$THIS_PACKAGE-tmp" "$_conffile"
   fi
 }
 
@@ -538,7 +543,7 @@
   # those cases the return value of the debconf command *must* be checked
   # before the string returned by debconf is used for anything.
 
-  local retval
+  #local retval
 
   # validate arguments
   if [ $# -lt 1 ]; then
@@ -547,10 +552,10 @@
     exit $SHELL_LIB_USAGE_ERROR
   fi
 
-  "$@" || retval=$?
+  "$@" || _retval=$?
 
-  if [ ${retval:-0} -ne 0 ]; then
-    observe "command \"$*\" exited with status $retval"
+  if [ ${_retval:-0} -ne 0 ]; then
+    observe "command \"$*\" exited with status $_retval"
   fi
 }
 
@@ -563,15 +568,15 @@
   # Call this function from the postinst script of a package that places a
   # shared library in /usr/X11R6/lib, before invoking ldconfig.
 
-  local dir ldsoconf
+  #local dir ldsoconf
 
-  dir="/usr/X11R6/lib"
-  ldsoconf="/etc/ld.so.conf"
+  _dir="/usr/X11R6/lib"
+  _ldsoconf="/etc/ld.so.conf"
 
   # is the line not already present?
-  if ! fgrep -qsx "$dir" "$ldsoconf"; then
-    observe "adding $dir directory to $ldsoconf"
-    echo "$dir" >> "$ldsoconf"
+  if ! fgrep -qsx "$_dir" "$_ldsoconf"; then
+    observe "adding $_dir directory to $_ldsoconf"
+    echo "$_dir" >> "$_ldsoconf"
   fi
 }
 
@@ -585,36 +590,36 @@
   # library in /usr/X11R6/lib, in the event "$1" is "remove", and before
   # invoking ldconfig.
 
-  local dir ldsoconf fgrep_status cmp_status
+  #local dir ldsoconf fgrep_status cmp_status
 
-  dir="/usr/X11R6/lib"
-  ldsoconf="/etc/ld.so.conf"
+  _dir="/usr/X11R6/lib"
+  _ldsoconf="/etc/ld.so.conf"
 
   # is the line present?
-  if fgrep -qsx "$dir" "$ldsoconf"; then
+  if fgrep -qsx "$_dir" "$_ldsoconf"; then
     # are there any shared objects in the directory?
-    if [ "$(echo "$dir"/lib*.so.*.*)" = "$dir/lib*.so.*.*" ]; then
+    if [ "$(echo "$_dir"/lib*.so.*.*)" = "$_dir/lib*.so.*.*" ]; then
       # glob expansion produced nothing, so no shared libraries are present
-      observe "removing $dir directory from $ldsoconf"
+      observe "removing $_dir directory from $_ldsoconf"
       # rewrite the file (very carefully)
       set +e
-      fgrep -svx "$dir" "$ldsoconf" > "$ldsoconf.dpkg-tmp"
-      fgrep_status=$?
+      fgrep -svx "$_dir" "$_ldsoconf" > "$_ldsoconf.dpkg-tmp"
+      _fgrep_status=$?
       set -e
-      case $fgrep_status in
+      case $_fgrep_status in
         0|1) ;; # we don't actually care if any lines matched or not
-        *) die "error reading \"$ldsoconf\"; fgrep exited with status" \
-          "$fgrep_status" ;;
+        *) die "error reading \"$_ldsoconf\"; fgrep exited with status" \
+          "$_fgrep_status" ;;
       esac
       set +e
-      cmp -s "$ldsoconf.dpkg-tmp" "$ldsoconf"
-      cmp_status=$?
+      cmp -s "$_ldsoconf.dpkg-tmp" "$_ldsoconf"
+      _cmp_status=$?
       set -e
-      case $cmp_status in
-        0) rm "$ldsoconf.dpkg-tmp" ;; # files are identical
-        1) mv "$ldsoconf.dpkg-tmp" "$ldsoconf" ;; # files differ
-        *) die "error comparing \"$ldsoconf.dpkg-tmp\" to \"$ldsoconf\"; cmp" \
-          "exited with status $cmp_status" ;;
+      case $_cmp_status in
+        0) rm "$_ldsoconf.dpkg-tmp" ;; # files are identical
+        1) mv "$_ldsoconf.dpkg-tmp" "$_ldsoconf" ;; # files differ
+        *) die "error comparing \"$_ldsoconf.dpkg-tmp\" to \"$_ldsoconf\";" \
+          "cmp exited with status $_cmp_status" ;;
       esac
     fi
   fi
@@ -646,17 +651,17 @@
 
   # We could just use the positional parameters as-is, but that makes things
   # harder to follow.
-  local symlink target
+  #local symlink target
 
-  symlink="$1"
-  target="$2"
+  _symlink="$1"
+  _target="$2"
 
-  if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
-      observe "link from $symlink to $target already exists"
+  if [ -L "$_symlink" ] && [ "$(readlink "$_symlink")" = "$_target" ]; then
+      observe "link from $_symlink to $_target already exists"
   else
-    observe "creating symbolic link from $symlink to $target"
-    mkdir -p "${target%/*}" "${symlink%/*}"
-    ln -s -b -S ".dpkg-old" "$target" "$symlink"
+    observe "creating symbolic link from $_symlink to $_target"
+    mkdir -p "${_target%/*}" "${_symlink%/*}"
+    ln -s -b -S ".dpkg-old" "$_target" "$_symlink"
   fi
 }
 
@@ -692,73 +697,73 @@
 
   # We could just use the positional parameters as-is, but that makes things
   # harder to follow.
-  local new old
+  local _new _old
 
-  old="$1"
-  new="$2"
+  _old="$1"
+  _new="$2"
 
   # Is old location a symlink?
-  if [ -L "$old" ]; then
+  if [ -L "$_old" ]; then
     # Does it already point to new location?
-    if [ "$(readlink "$old")" = "$new" ]; then
+    if [ "$(readlink "$_old")" = "$_new" ]; then
       # Nothing to do; migration has already been done.
-      observe "migration of $old to $new already done"
+      observe "migration of $_old to $_new already done"
       return 0
     else
       # Back it up.
-      warn "backing up symbolic link $old as $old.dpkg-old"
-      mv -b "$old" "$old.dpkg-old"
+      warn "backing up symbolic link $_old as $_old.dpkg-old"
+      mv -b "$_old" "$_old.dpkg-old"
     fi
   fi
 
   # Does old location exist, but is not a directory?
-  if [ -e "$old" ] && ! [ -d "$old" ]; then
+  if [ -e "$_old" ] && ! [ -d "$_old" ]; then
       # Back it up.
-      warn "backing up non-directory $old as $old.dpkg-old"
-      mv -b "$old" "$old.dpkg-old"
+      warn "backing up non-directory $_old as $_old.dpkg-old"
+      mv -b "$_old" "$_old.dpkg-old"
   fi
 
-  observe "migrating $old to $new"
+  observe "migrating $_old to $_new"
 
   # Is new location a symlink?
-  if [ -L "$new" ]; then
+  if [ -L "$_new" ]; then
     # Does it point the wrong way, i.e., back to where we're migrating from?
-    if [ "$(readlink "$new")" = "$old" ]; then
+    if [ "$(readlink "$_new")" = "$_old" ]; then
       # Get rid of it.
-      observe "removing symbolic link $new which points to $old"
-      rm "$new"
+      observe "removing symbolic link $_new which points to $_old"
+      rm "$_new"
     else
       # Back it up.
-      warn "backing up symbolic link $new as $new.dpkg-old"
-      mv -b "$new" "$new.dpkg-old"
+      warn "backing up symbolic link $_new as $_new.dpkg-old"
+      mv -b "$_new" "$_new.dpkg-old"
     fi
   fi
 
   # Does new location exist, but is not a directory?
-  if [ -e "$new" ] && ! [ -d "$new" ]; then
-    warn "backing up non-directory $new as $new.dpkg-old"
-    mv -b "$new" "$new.dpkg-old"
+  if [ -e "$_new" ] && ! [ -d "$_new" ]; then
+    warn "backing up non-directory $_new as $_new.dpkg-old"
+    mv -b "$_new" "$_new.dpkg-old"
   fi
 
   # Create new directory if it does not yet exist.
-  if ! [ -e "$new" ]; then
-    observe "creating $new"
-    mkdir -p "$new"
+  if ! [ -e "$_new" ]; then
+    observe "creating $_new"
+    mkdir -p "$_new"
   fi
 
   # Copy files in old location to new location.  Back up any filenames that
   # already exist in the new location with the extension ".dpkg-old".
-  observe "copying files from $old to $new"
-  if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then
-    die "error(s) encountered while copying files from $old to $new"
+  observe "copying files from $_old to $_new"
+  if ! (cd "$_old" && cp -a -b -S ".dpkg-old" . "$_new"); then
+    die "error(s) encountered while copying files from $_old to $_new"
   fi
 
   # Remove files at old location.
-  observe "removing $old"
-  rm -r "$old"
+  observe "removing $_old"
+  rm -r "$_old"
 
   # Create symlink from old location to new location.
-  make_symlink_sane "$old" "$new"
+  make_symlink_sane "$_old" "$_new"
 }
 
 # vim:set ai et sts=2 sw=2 tw=80:



Reply to: