opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

tree.sh (446B)


      1 set -e
      2 
      3 if [ "$#" != 4 ] ; then
      4 	echo 'usage: tree.sh repo tag index out' >&2
      5 	exit 2
      6 fi
      7 
      8 repo=$1
      9 tag=$2
     10 index=$3
     11 out=$4
     12 
     13 export GIT_INDEX_FILE="$PWD/$out.index"
     14 git -C "$repo" read-tree --empty
     15 git -C "$repo" update-index --index-info <"$index"
     16 tree=$(git -C "$repo" write-tree)
     17 git -C "$repo" update-ref "refs/tags/$tag" "$tree"
     18 
     19 printf '%s\n' "$tree" >"$out.tmp"
     20 if cmp -s "$out" "$out.tmp" ; then
     21 	rm "$out.tmp"
     22 else
     23 	mv "$out.tmp" "$out"
     24 fi