Ignore:
Timestamp:
Apr 3, 2009, 12:51:32 AM (15 years ago)
Author:
quentin
Message:
update-system fixes: catch errors, and get the lockername from the input
File:
1 edited

Legend:

Unmodified
Added
Removed
  • locker/sbin/build-update

    r746 r1050  
    9797set -e -o noclobber
    9898
    99 die () { echo "$1" >&2; rm .scripts-security-upd-lock; exit 1; }
     99die () { echo "[$PWD] die: $1" >&2; rm .scripts-security-upd-lock; exit 1; }
     100aiee () { echo "[$PWD] AIEE: $1" >&2; exit 2; }
    100101
    101102patchdir=$(dirname "$0")
     103lockername="$1${1:-$USER}"
    102104
    103105>.scripts-security-upd-lock || die "error: Unable to obtain update lock."
     
    130132echo "[$PWD] dry run OK, applying update"
    131133
    132 mv .scripts-version .scripts-version.old
    133 patch -stN --no-backup-if-mismatch -p2 <"$patchdir/update.diff" || :
    134 xargs rm -f <"$patchdir/files.delete"
    135 tar -xzf "$patchdir/newfiles.tar.gz"
     134mv .scripts-version .scripts-version.old || aiee "Failed to back up scripts-version"
     135patch -stN --no-backup-if-mismatch -p2 <"$patchdir/update.diff" || aiee "patch did not apply"
     136xargs rm -f <"$patchdir/files.delete" || aiee "Failed to remove files"
     137tar -xzf "$patchdir/newfiles.tar.gz" || aiee "Failed to extract new files"
    136138[ -e "$patchdir/extra/postpatch.sh" ] && . "$patchdir/extra/postpatch.sh"
    137139(
     
    143145    echo "$newpackages"
    144146) >.scripts-version
    145 rm -f .scripts-version.old
     147rm -f .scripts-version.old || aiee "Failed to remove .scripts-version.old"
    146148
    147 rm -f .scripts-security-upd-lock
     149rm -f .scripts-security-upd-lock || aiee "Failed to remove .scripts-security-upd-lock"
    148150
    149151echo "[$PWD] done"
Note: See TracChangeset for help on using the changeset viewer.