Diff

Differences From Artifact [c545d80ced]:

To Artifact [de5f8534e5]:


    12     12   appfsdir="$(cd "${appfsdir}" && pwd)"
    13     13   if [ -z "${appfsdir}" ]; then
    14     14   	echo "Unable to find appfs directory." >&2
    15     15   
    16     16   	exit 1
    17     17   fi
    18     18   
           19  +mkdir -p "${appfsdir}/sha1"
           20  +
    19     21   function sha1() {
    20     22   	local filename
    21     23   
    22     24   	filename="$1"
    23     25   
    24     26   	openssl sha1 "${filename}" | sed 's@.*= @@'
    25     27   }
................................................................................
    53     55   				;;
    54     56   			symlink)
    55     57   				stat_format='%Y'
    56     58   				extra_data="$(readlink "${filename}")"
    57     59   				;;
    58     60   			file)
    59     61   				stat_format='%Y,%s'
    60         -				extra_data="$(sha1 "${filename}")"
           62  +				filename_hash="$(sha1 "${filename}")"
           63  +				extra_data="${filename_hash}"
           64  +
           65  +				filename_intree="${appfsdir}/sha1/${filename_hash}"
           66  +
           67  +				if [ ! -e "${filename_intree}" ]; then
           68  +					cat "${filename}" > "${filename_intree}.tmp"
           69  +
           70  +					mv "${filename_intree}.tmp" "${filename_intree}"
           71  +				fi
    61     72   				;;
    62     73   		esac
    63     74   		stat_data="$(stat --format="${stat_format}" "${filename}")"
    64     75   
    65     76   		if [ -z "${extra_data}" ]; then
    66     77   			echo "${type},${stat_data},${extra_data},${filename}"
    67     78   		else