diff options
author | Renato Botelho <renato@netgate.com> | 2016-11-02 10:47:46 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-11-02 10:47:46 -0200 |
commit | 01e4dee209c13f5a3343e3cc887c2f920a69dd65 (patch) | |
tree | b19966b3c263495a3f07f891adba668c508ba31b /usr.sbin/portsnap/portsnap/portsnap.sh | |
parent | 5fc1b195c4ab71aaf651429b2c50ee5cc5e7c5fb (diff) | |
parent | 2f81d935658287026e614a5edf74ae47f5c54f3f (diff) | |
download | FreeBSD-src-01e4dee209c13f5a3343e3cc887c2f920a69dd65.zip FreeBSD-src-01e4dee209c13f5a3343e3cc887c2f920a69dd65.tar.gz |
Merge remote-tracking branch 'origin/releng/10.3' into RELENG_2_3_2RELENG_2_3_2
Diffstat (limited to 'usr.sbin/portsnap/portsnap/portsnap.sh')
-rw-r--r-- | usr.sbin/portsnap/portsnap/portsnap.sh | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/portsnap/portsnap/portsnap.sh b/usr.sbin/portsnap/portsnap/portsnap.sh index 90a875e..176dc13 100644 --- a/usr.sbin/portsnap/portsnap/portsnap.sh +++ b/usr.sbin/portsnap/portsnap/portsnap.sh @@ -646,7 +646,7 @@ fetch_index_sanity() { # Verify a list of files fetch_snapshot_verify() { while read F; do - if [ "`gunzip -c snap/${F} | ${SHA256} -q`" != ${F} ]; then + if [ "`gunzip -c < snap/${F}.gz | ${SHA256} -q`" != ${F} ]; then echo "snapshot corrupt." return 1 fi @@ -681,11 +681,18 @@ fetch_snapshot() { cut -f 2 -d '|' tINDEX.new | fetch_snapshot_verify || return 1 # Extract the index rm -f INDEX.new - gunzip -c snap/`look INDEX tINDEX.new | + gunzip -c < snap/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 # Verify the snapshot contents cut -f 2 -d '|' INDEX.new | fetch_snapshot_verify || return 1 + cut -f 2 -d '|' tINDEX.new INDEX.new | sort -u > files.expected + find snap -mindepth 1 | sed -E 's^snap/(.*)\.gz^\1^' | sort > files.snap + if ! cmp -s files.expected files.snap; then + echo "unexpected files in snapshot." + return 1 + fi + rm files.expected files.snap echo "done." # Move files into their proper locations @@ -777,7 +784,7 @@ fetch_update() { # Extract the index echo -n "Extracting index... " 1>${QUIETREDIR} - gunzip -c files/`look INDEX tINDEX.new | + gunzip -c < files/`look INDEX tINDEX.new | cut -f 2 -d '|'`.gz > INDEX.new fetch_index_sanity || return 1 @@ -897,7 +904,7 @@ extract_make_index() { echo -n "$1 not provided by portsnap server; " echo "$2 not being generated." else - gunzip -c "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | + gunzip -c < "${WORKDIR}/files/`look $1 ${WORKDIR}/tINDEX | cut -f 2 -d '|'`.gz" | cat - ${LOCALDESC} | ${MKINDEX} /dev/stdin > ${PORTSDIR}/$2 |