--- a/Admin/components/README Fri Dec 14 16:02:31 2012 +0100
+++ b/Admin/components/README Fri Dec 14 16:21:47 2012 +0100
@@ -7,7 +7,7 @@
$ install /home/isabelle/components/screwdriver-3.14.tar.gz
$ install /home/isabelle/contrib/screwdriver-3.14/
$ edit Admin/components/main: screwdriver-3.14
- $ run Admin/components/checksum -u
+ $ isabelle components_checksum -u
$ hg diff
$ hg commit
@@ -46,9 +46,9 @@
The file Admin/components/components.sha1 contains SHA1 identifiers
within the Isabelle repository, for integrity checking of the archives
-that are exposed to the public file-system. The script
-Admin/components/checksum helps to update these hash-keys wrt. the
-information within the Isabelle repository.
+that are exposed to the public file-system. The components_checksum
+tool helps to update these hash-keys wrt. the information within the
+Isabelle repository.
Unpacked copy
--- a/Admin/components/checksum Fri Dec 14 16:02:31 2012 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env bash
-#
-# Author: Alexander Krauss
-#
-# Computes and validates checksums for the Isabelle component repository
-
-THIS="$(cd $(dirname "$0"); pwd)"
-
-function usage()
-{
- echo
- echo "Usage: $0 [OPTIONS] [DIR]"
- echo
- echo " Options are:"
- echo " -u update the recorded checksums in the repository"
- echo " -c compare the actual checksums with the recorded ones"
- echo
- echo " Compute the checksums of components in DIR (default '/home/isabelle/components')"
- echo " and synchronize them with the Isabelle repository."
- echo
- exit 1
-}
-
-function fail()
-{
- echo "$1" >&2
- exit 2
-}
-
-
-## process command line
-
-# options
-
-UPDATE=""
-CHECK=""
-COMPONENTS_DIR="/home/isabelle/components"
-
-while getopts "uc" OPT
-do
- case "$OPT" in
- u)
- UPDATE=true
- ;;
- c)
- CHECK=true
- ;;
- esac
-done
-
-shift $(($OPTIND - 1))
-
-[ -n "$UPDATE" ] || [ -n "$CHECK" ] || usage
-
-# args
-
-[ "$#" -ge 1 ] && { COMPONENTS_DIR="$1"; shift; }
-[ "$#" -ne 0 ] && usage
-
-
-## compute checksums
-
-CHECKSUM_FILE="$THIS/components.sha1"
-CHECKSUM_TMP="$THIS/components.sha1.tmp"
-
-cd "$COMPONENTS_DIR"
-sha1sum *.tar.gz > "$CHECKSUM_TMP"
-
-[ -n "$UPDATE" ] && mv "$CHECKSUM_TMP" "$CHECKSUM_FILE"
-[ -n "$CHECK" ] && (diff "$CHECKSUM_FILE" "$CHECKSUM_TMP" || fail "Integrity error")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Admin/lib/Tools/components_checksum Fri Dec 14 16:21:47 2012 +0100
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+#
+# Author: Alexander Krauss
+#
+# DESCRIPTION: compute and validate checksums for component repository
+
+
+## diagnostics
+
+PRG="$(basename "$0")"
+
+function usage()
+{
+ echo
+ echo "Usage: $PRG [OPTIONS] [DIR]"
+ echo
+ echo " Options are:"
+ echo " -u update the recorded checksums in the repository"
+ echo " -c compare the actual checksums with the recorded ones"
+ echo
+ echo " Compute the checksums of component .tar.gz archives in DIR"
+ echo " (default \"/home/isabelle/components\") and synchronize them"
+ echo " with the Isabelle repository."
+ echo
+ exit 1
+}
+
+function fail()
+{
+ echo "$1" >&2
+ exit 2
+}
+
+
+## process command line
+
+# options
+
+UPDATE=""
+CHECK=""
+COMPONENTS_DIR="/home/isabelle/components"
+
+while getopts "uc" OPT
+do
+ case "$OPT" in
+ u)
+ UPDATE=true
+ ;;
+ c)
+ CHECK=true
+ ;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+
+[ -n "$UPDATE" ] || [ -n "$CHECK" ] || usage
+
+
+# args
+
+[ "$#" -ge 1 ] && { COMPONENTS_DIR="$1"; shift; }
+[ "$#" -ne 0 ] && usage
+
+
+## compute checksums
+
+CHECKSUM_DIR="$ISABELLE_HOME/Admin/components"
+CHECKSUM_FILE="$CHECKSUM_DIR/components.sha1"
+CHECKSUM_TMP="$CHECKSUM_DIR/components.sha1.tmp"
+
+(
+ cd "$COMPONENTS_DIR"
+ sha1sum *.tar.gz > "$CHECKSUM_TMP"
+)
+
+[ -n "$UPDATE" ] && mv "$CHECKSUM_TMP" "$CHECKSUM_FILE"
+[ -n "$CHECK" ] && {
+ diff "$CHECKSUM_FILE" "$CHECKSUM_TMP" || fail "Integrity error"
+}
+