Browse Source

download fix

#146
rootzoll 7 years ago
parent
commit
ce36c99dae
  1. 29
      home.admin/50downloadHDD.sh

29
home.admin/50downloadHDD.sh

@ -2,6 +2,8 @@
# name of torrentfile = name of directory in torrent
torrent="raspiblitz-hdd-2018-07-16"
# size of a valid download (run on seed directory 'du -s ./[TORRENTDIRECTORY]')
torrentsize=462470200
echo ""
echo "*** Checking HDD ***"
@ -21,10 +23,33 @@ if [ ${mountOK} -eq 1 ]; then
echo "killall transmission-cli" > $tmpfile
sudo transmission-cli ./assets/$torrent.torrent -D -w /mnt/hdd -f $tmpfile
echo ""
echo "*** Checking Download ***"
echo "wait a moment"
sleep 5
downloadsize=$(sudo du -s /mnt/hdd/$torrent/ | awk '{print $1}' | tr -dc '0-9')
if [ ${#downloadsize} -eq 0 ]; then
downloadsize=0
fi
# add some tolerance for checking
torrentsize="$(($torrentsize-1024000))"
echo "download size is(${downloadsize})"
if [ ${downloadsize} -lt ${torrentsize} ]; then
echo "FAIL - download is not ${torrentsize}"
sleep 3
dialog --title " WARNING " --yesno "The download failed or is not complete. Do you want to clean all download data before you continue?" 6 57
response=$?
case $response in
0) sudo rm -rf /mnt/hdd/$torrent ; sudo rm -rf /root/.config/transmission ;;
esac
#
./00mainMenu.sh
exit 1;
fi
echo ""
echo "*** Moving Files ***"
echo "moving files ..."
mv /mnt/hdd/$torrent/* /mnt/hdd
rm -R /mnt/hdd/$torrent
sudo mv /mnt/hdd/$torrent /mnt/hdd/bitcoin
echo ""
# set SetupState

Loading…
Cancel
Save