diff --git a/pull.lists.sh b/pull.lists.sh index 3225983..1179b7e 100755 --- a/pull.lists.sh +++ b/pull.lists.sh @@ -1,7 +1,22 @@ #!/usr/bin/env bash [[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; } +# Mounting storage +if df | grep -c opendrive > /dev/null; then + umount "${HOME_DIR}/opendrive" || sudo umount "${HOME_DIR}/opendrive" +fi + +if [[ -d "${HOME_DIR}/opendrive" ]]; then + rm -rf "${HOME_DIR}/opendrive" + mkdir "${HOME_DIR}/opendrive" +else + mkdir "${HOME_DIR}/opendrive" +fi +rclone mount --daemon opendrive:Public/blocklist/ "${HOME_DIR}/opendrive" --volname opendrive + + cd "${WRK_DIR}/" +echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull # Fetch blocklists bash "${WRK_DIR}/get_blocklists.sh" @@ -36,14 +51,13 @@ mv facebook_block.txt blocklists/. # Archiving echo "Compressing blocklists..." cd "${WRK_DIR}/blocklists/" -echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull getMD5 "MyBlocklist.txt" >| MyBlocklist.checksum getMD5 "facebook_block.txt" >| facebook_block.checksum sleep 1 xz -v -T4 MyBlocklist.txt xz -v -T4 facebook_block.txt - - +chmod 777 ./* +exit #--------- # Moving to target echo "Moving blocklists to destination..." diff --git a/set_env.sh b/set_env.sh index 7b7008c..43f3221 100644 --- a/set_env.sh +++ b/set_env.sh @@ -48,12 +48,3 @@ else fi WRK_DIR=${HOME_DIR}/pihole_lists - -if [[ -d "${HOME_DIR}/opendrive" ]]; then - rm -rf "${HOME_DIR}/opendrive" - mkdir "${HOME_DIR}/opendrive" -else - mkdir "${HOME_DIR}/opendrive" -fi - -rclone mount --daemon opendrive:Public/blocklist/ "${HOME_DIR}/opendrive"