Diff

Differences From Artifact [0eb1bfa1cb]:

To Artifact [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
#! /usr/bin/env bash



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

	mode='file'

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

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



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

	exit 1
fi

appfsdir="$(cd "${appfsdir}" && pwd)"
if [ -z "${appfsdir}" ]; then
	echo "Unable to find appfs directory." >&2


>
>













>
>

|







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> [<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
' | sort -u > "${packagelistfile}.new"
cat "${packagelistfile}.new" > "${packagelistfile}"
rm -f "${packagelistfile}.new"

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







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









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







>
>
>
>
>
>
|
>
>
>
>
>
>
>
>







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" > "${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