Last change
on this file since 534 was
363,
checked in by quentin, 17 years ago
|
initial checkin of the update-system; not fully functional yetd
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[363] | 1 | #!/bin/bash |
---|
| 2 | set -e |
---|
| 3 | |
---|
| 4 | die () { echo "$1" >&2; exit 1; } |
---|
| 5 | |
---|
| 6 | path="$1" |
---|
| 7 | url=$(echo "$path" | perl -pe '/^\/mit\/([^\/]*)\/web_scripts\/(.*)$/; $_ = "http://scripts.mit.edu/~$1/$2\n";') |
---|
| 8 | [ "$url" != "http://scripts.mit.edu/~/" ] || die "Usage: scripts-patch /mit/<user>/web_scripts/<path>" |
---|
| 9 | |
---|
| 10 | versionfile=$path/.scripts-version |
---|
| 11 | [ -f "$versionfile" ] || die "$path was not created by the scripts installer." |
---|
| 12 | [ -r "$versionfile" ] || die "[$path] Could not read .scripts-version file." |
---|
| 13 | |
---|
| 14 | # The format of the .scripts-version file is such an awful mess. |
---|
| 15 | # |
---|
| 16 | # I feel like that needed to be said. |
---|
| 17 | |
---|
| 18 | version=$(tail -n +2 "$versionfile" | head -n1 | perl -pe '/File: .* -> \`(.*)\.tar\.(gz|bz2)'\''$/; $_ = $1') |
---|
| 19 | |
---|
| 20 | updatespath=/mit/andersk/Public/scripts/updates |
---|
| 21 | [ -d "$updatespath" ] || die "Could not find updates repository." |
---|
| 22 | [ -d "$updatespath/$version" ] || die "[$path] No update available for $version." |
---|
| 23 | echo "[$path] Applying update for $version:" |
---|
| 24 | |
---|
| 25 | pagebefore=`mktemp -t scripts-patch.XXXXXXXXXX` |
---|
| 26 | pageafter=`mktemp -t scripts-patch.XXXXXXXXXX` |
---|
| 27 | |
---|
| 28 | url=$(echo "$path" | perl -pe '/^\/mit\/([^\/]*)\/web_scripts\/(.*)$/; $_ = "http://scripts.mit.edu/~$1/$2\n";') |
---|
| 29 | wget -q "$url/" -O "$pagebefore" |
---|
| 30 | |
---|
| 31 | (cd "$path"; "$updatespath/$version/update") || die "[$path] *** FAILED UPDATE *** of $version" |
---|
| 32 | |
---|
| 33 | wget -q "$url/" -O "$pageafter" |
---|
| 34 | echo "[$path] Diff from before/after upgrade:" |
---|
| 35 | diff -U0 "$pagebefore" "$pageafter" || : |
---|
| 36 | |
---|
| 37 | rm -f "$pagebefore" "$pageafter" |
---|
Note: See
TracBrowser
for help on using the repository browser.