Check-in [074c41c6ce]
Overview
Comment:Updated to create contents in SHA1 tree
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 074c41c6ce6ad1f84fe6425e5f9ddc6317b794d9
User & Date: rkeene on 2014-09-08 20:02:19
Other Links: manifest | tags
Context
2014-09-09
03:43
More work on getting children processed check-in: b437874cfb user: rkeene tags: trunk
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
Changes

Modified appfs-mk from [c545d80ced] to [de5f8534e5].

12
13
14
15
16
17
18


19
20
21
22
23
24
25
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@.*= @@'
}







>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
appfsdir="$(cd "${appfsdir}" && pwd)"
if [ -z "${appfsdir}" ]; then
	echo "Unable to find appfs directory." >&2

	exit 1
fi

mkdir -p "${appfsdir}/sha1"

function sha1() {
	local filename

	filename="$1"

	openssl sha1 "${filename}" | sed 's@.*= @@'
}
53
54
55
56
57
58
59
60









61
62
63
64
65
66
67
				;;
			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







|
>
>
>
>
>
>
>
>
>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
				;;
			symlink)
				stat_format='%Y'
				extra_data="$(readlink "${filename}")"
				;;
			file)
				stat_format='%Y,%s'
				filename_hash="$(sha1 "${filename}")"
				extra_data="${filename_hash}"

				filename_intree="${appfsdir}/sha1/${filename_hash}"

				if [ ! -e "${filename_intree}" ]; then
					cat "${filename}" > "${filename_intree}.tmp"

					mv "${filename_intree}.tmp" "${filename_intree}"
				fi
				;;
		esac
		stat_data="$(stat --format="${stat_format}" "${filename}")"

		if [ -z "${extra_data}" ]; then
			echo "${type},${stat_data},${extra_data},${filename}"
		else