Check-in [87b144f5c9]
Overview
Comment:Updated to call appfs-cert to sign the site if it is available
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:87b144f5c9d161b5204309b40cec8fb0237f0a86
User & Date: rkeene on 2014-11-17 21:11:34
Other Links: manifest | tags
Context
2014-11-17
21:18
Corrected typo check-in: 091c38b14e user: rkeene tags: trunk
21:11
Updated to call appfs-cert to sign the site if it is available check-in: 87b144f5c9 user: rkeene tags: trunk
21:05
Updated to allow in-place signing, rather than atomic-replace check-in: 93b5d66091 user: rkeene tags: trunk
Changes

Modified appfs-mkfs from [0eb1bfa1cb] to [e7a75a276a].

     1      1   #! /usr/bin/env bash
     2      2   
            3  +PATH="${PATH}:$(dirname "$(which "$0")")"
            4  +
     3      5   if [ "$1" == '--cpio' ]; then
     4      6   	shift
     5      7   
     6      8   	mode='file'
     7      9   
     8     10   	pkgfile="$1"
     9     11   else
    10     12   	mode='dir'
    11     13   
    12     14   	pkgsdir="$1"
    13     15   fi
    14     16   appfsdir="$2"
           17  +
           18  +shift; shift
    15     19   
    16     20   if [ -z "${pkgsdir}" -a -z "${pkgfile}" ] || [ -z "${appfsdir}" ]; then
    17         -	echo 'Usage: appfs-mk {--cpio <pkgfile>|<pkgsdir>} <appfsdir>' >&2
           21  +	echo 'Usage: appfs-mk {--cpio <pkgfile>|<pkgsdir>} <appfsdir> [<site-key> [<site-certificate>]]' >&2
    18     22   
    19     23   	exit 1
    20     24   fi
    21     25   
    22     26   appfsdir="$(cd "${appfsdir}" && pwd)"
    23     27   if [ -z "${appfsdir}" ]; then
    24     28   	echo "Unable to find appfs directory." >&2
................................................................................
   210    214   ' | sort -u > "${packagelistfile}.new"
   211    215   cat "${packagelistfile}.new" > "${packagelistfile}"
   212    216   rm -f "${packagelistfile}.new"
   213    217   
   214    218   packagelistfile_hash="$(sha1 "${packagelistfile}")"
   215    219   mv "${packagelistfile}" "${appfsdir}/sha1/${packagelistfile_hash}"
   216    220   
   217         -echo "${packagelistfile_hash},sha1" > "${appfsdir}/index"
          221  +if [ -n "$APPFS_SIGN_IN_PLACE" ]; then
          222  +	indexfile="${appfsdir}/index"
          223  +else
          224  +	indexfile="${appfsdir}/index.new"
          225  +fi
          226  +
          227  +echo "${packagelistfile_hash},sha1" > "${indexfile}"
          228  +
          229  +if [ -x "$(which 'appfs-cert' 2>/dev/null)"]; then
          230  +	appfs-cert sign-site "${indexfile}" "$@"
          231  +fi
          232  +
          233  +if [ -z "$APPFS_SIGN_IN_PLACE" ]; then
          234  +	mv "${indexfile}" "${appfsdir}/index"
          235  +fi
   218    236   
   219    237   case "${mode}" in
   220    238   	file)
   221    239   		cd /
   222    240   		rm -rf "${workdir}"
   223    241   		;;
   224    242   esac