Overview
Comment: | Added script to create simple appfs directory tree for serving |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
edd156adcd70f5dafa0b90ea399d3e9f |
User & Date: | rkeene on 2014-09-08 19:59:22 |
Other Links: | manifest | tags |
Context
2014-09-08
| ||
20:02 | Updated to create contents in SHA1 tree check-in: 074c41c6ce user: rkeene tags: trunk | |
19:59 | Added script to create simple appfs directory tree for serving check-in: edd156adcd user: rkeene tags: trunk | |
07:17 | More work towards parsing directory entries check-in: 85bda525b9 user: rkeene tags: trunk | |
Changes
Added appfs-mk version [c545d80ced].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | #! /usr/bin/env bash pkgsdir="$1" appfsdir="$2" if [ -z "${pkgsdir}" -o -z "${appfsdir}" ]; then echo 'Usage: appfs-mk <pkgsdir> <appfsdir>' >&2 exit 1 fi appfsdir="$(cd "${appfsdir}" && pwd)" if [ -z "${appfsdir}" ]; then echo "Unable to find appfs directory." >&2 exit 1 fi function sha1() { local filename filename="$1" openssl sha1 "${filename}" | sed 's@.*= @@' } function emit_manifest() { find . -print0 | while IFS='' read -r -d $'\0' filename; do if [ "${filename}" = '.' ]; then continue fi filename="$(echo "${filename}" | sed 's@^\./@@' | head -n 1)" if [ ! -e "${filename}" ]; then continue fi if [ -h "${filename}" ]; then type='symlink' elif [ -d "${filename}" ]; then type='directory' elif [ -f "${filename}" ]; then type='file' else continue fi case "${type}" in directory) stat_format='%Y' extra_data='' ;; symlink) stat_format='%Y' extra_data="$(readlink "${filename}")" ;; file) stat_format='%Y,%s' extra_data="$(sha1 "${filename}")" ;; esac stat_data="$(stat --format="${stat_format}" "${filename}")" if [ -z "${extra_data}" ]; then echo "${type},${stat_data},${extra_data},${filename}" else echo "${type},${stat_data},${extra_data},${filename}" fi done } cd "${pkgsdir}" || exit 1 for package in *; do packagelistfile="${appfsdir}/sha1/${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM}.tmp" ( cd "${package}" || exit 1 for os_cpuArch in *; do os="$(echo "${os_cpuArch}" | cut -f 1 -d '-')" cpuArch="$(echo "${os_cpuArch}" | cut -f 2- -d '-')" ( cd "${os_cpuArch}" || exit 1 for version in *; do if [ -h "${version}" ]; then continue fi manifestfile="${appfsdir}/sha1/${RANDOM}${RANDOM}${RANDOM}${RANDOM}${RANDOM}.tmp" ( cd "${version}" || exit 1 emit_manifest ) > "${manifestfile}" manifestfile_hash="$(sha1 "${manifestfile}")" mv "${manifestfile}" "${appfsdir}/sha1/${manifestfile_hash}" # XXX:TODO: Determine if this is the latest version isLatest='0' echo "${package},${version},${os},${cpuArch},${manifestfile_hash},${isLatest}" done ) done ) > "${packagelistfile}" packagelistfile_hash="$(sha1 "${packagelistfile}")" mv "${packagelistfile}" "${appfsdir}/sha1/${packagelistfile_hash}" echo "${packagelistfile_hash},sha1" > "${appfsdir}/index" done |