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
2


3
4
5
6
7
8
9
10
11
12
13
14
15


16
17

18
19
20
21
22
23
24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28


+
+













+
+

-
+







#! /usr/bin/env bash

PATH="${PATH}:$(dirname "$(which "$0")")"

if [ "$1" == '--cpio' ]; then
	shift

	mode='file'

	pkgfile="$1"
else
	mode='dir'

	pkgsdir="$1"
fi
appfsdir="$2"

shift; shift

if [ -z "${pkgsdir}" -a -z "${pkgfile}" ] || [ -z "${appfsdir}" ]; then
	echo 'Usage: appfs-mk {--cpio <pkgfile>|<pkgsdir>} <appfsdir>' >&2
	echo 'Usage: appfs-mk {--cpio <pkgfile>|<pkgsdir>} <appfsdir> [<site-key> [<site-certificate>]]' >&2

	exit 1
fi

appfsdir="$(cd "${appfsdir}" && pwd)"
if [ -z "${appfsdir}" ]; then
	echo "Unable to find appfs directory." >&2
210
211
212
213
214
215
216






217









218
219
220
221
222
223
224
214
215
216
217
218
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242







+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+







' | sort -u > "${packagelistfile}.new"
cat "${packagelistfile}.new" > "${packagelistfile}"
rm -f "${packagelistfile}.new"

packagelistfile_hash="$(sha1 "${packagelistfile}")"
mv "${packagelistfile}" "${appfsdir}/sha1/${packagelistfile_hash}"

if [ -n "$APPFS_SIGN_IN_PLACE" ]; then
	indexfile="${appfsdir}/index"
else
	indexfile="${appfsdir}/index.new"
fi

echo "${packagelistfile_hash},sha1" > "${appfsdir}/index"
echo "${packagelistfile_hash},sha1" > "${indexfile}"

if [ -x "$(which 'appfs-cert' 2>/dev/null)"]; then
	appfs-cert sign-site "${indexfile}" "$@"
fi

if [ -z "$APPFS_SIGN_IN_PLACE" ]; then
	mv "${indexfile}" "${appfsdir}/index"
fi

case "${mode}" in
	file)
		cd /
		rm -rf "${workdir}"
		;;
esac