Do not depend on filename var

This commit is contained in:
Jon Shaulis 2016-09-29 10:15:09 -04:00
commit c4a2ee4480

View file

@ -365,7 +365,7 @@ function cleanup {
rm /tmp/raw 2>/dev/null >/dev/null rm /tmp/raw 2>/dev/null >/dev/null
rm /tmp/failcause 2>/dev/null >/dev/null rm /tmp/failcause 2>/dev/null >/dev/null
rm /tmp/kaka 2>/dev/null >/dev/null rm /tmp/kaka 2>/dev/null >/dev/null
rm "/tmp/${FILENAME}.sha" 2>/dev/null >/dev/null rm "/tmp/package.sha" 2>/dev/null >/dev/null
} }
trap cleanup EXIT trap cleanup EXIT
@ -471,7 +471,7 @@ if [ $? -ne 0 ]; then
cronexit 3 cronexit 3
fi fi
echo "${CHECKSUM} ${DOWNLOADDIR}/${FILENAME}" >"/tmp/${FILENAME}.sha" echo "${CHECKSUM} ${DOWNLOADDIR}/${FILENAME}" >"/tmp/package.sha"
if [ "${PRINT_URL}" = "yes" ]; then if [ "${PRINT_URL}" = "yes" ]; then
if [ "${QUIET}" = "yes" ]; then if [ "${QUIET}" = "yes" ]; then
@ -502,7 +502,7 @@ fi
if [ -f "${DOWNLOADDIR}/${FILENAME}" ]; then if [ -f "${DOWNLOADDIR}/${FILENAME}" ]; then
if [ "${FORCE}" != "yes" -a "${FORCEALL}" != "yes" ]; then if [ "${FORCE}" != "yes" -a "${FORCEALL}" != "yes" ]; then
sha1sum --status -c "/tmp/${FILENAME}.sha" sha1sum --status -c "/tmp/package.sha"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "File already exists (${FILENAME}), won't download." echo "File already exists (${FILENAME}), won't download."
if [ "${AUTOINSTALL}" != "yes" ]; then if [ "${AUTOINSTALL}" != "yes" ]; then
@ -516,7 +516,7 @@ if [ -f "${DOWNLOADDIR}/${FILENAME}" ]; then
elif [ "${FORCEALL}" == "yes" ]; then elif [ "${FORCEALL}" == "yes" ]; then
echo "Note! File exists, but asked to overwrite with new copy" echo "Note! File exists, but asked to overwrite with new copy"
else else
sha1sum --status -c "/tmp/${FILENAME}.sha" sha1sum --status -c "/tmp/package.sha"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Note! File exists but fails checksum. Redownloading." echo "Note! File exists but fails checksum. Redownloading."
else else
@ -540,7 +540,7 @@ if [ "${SKIP_DOWNLOAD}" = "no" ]; then
echo "OK" echo "OK"
fi fi
sha1sum --status -c "/tmp/${FILENAME}.sha" sha1sum --status -c "/tmp/package.sha"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Downloaded file corrupt. Try again." echo "Downloaded file corrupt. Try again."
cronexit 4 cronexit 4