clean mounting of opendrive

This commit is contained in:
robocopAlpha 2021-07-15 12:06:08 +03:00
parent daa48b1ced
commit 80c00360e8
2 changed files with 17 additions and 12 deletions

View file

@ -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..."