#!/bin/bash [ -r /etc/sysconfig/moblock ] && . /etc/sysconfig/moblock || exit 0 [ -n "$LIST" ] || exit 0 [ -n "$BLOCKLIST" ] || exit 0 [ -n "$ALLOWLIST" ] || exit 0 [ -d /var/spool/moblock ] || exit 0 [ -d /var/spool/moblock/allow ] || exit 0 [ -x /usr/bin/wget ] || exit 0 [ -x /usr/bin/7za ] || exit 0 [ -x /usr/bin/mergep2p ] || exit 0 /usr/bin/find /var/spool/moblock -type f -name '*.txt' | /usr/bin/xargs /bin/rm -f pushd /var/spool/moblock >/dev/null for file in $BLOCKLIST; do /usr/bin/wget -q -N "$URL/$file" done popd >/dev/null pushd /var/spool/moblock/allow >/dev/null for file in $ALLOWLIST; do /usr/bin/wget -q -N "$URL/$file" done popd >/dev/null /bin/rm -f "$LIST" pushd /var/spool/moblock >/dev/null for file in $BLOCKLIST; do /usr/bin/7za x $file >/dev/null 2>&1 done popd >/dev/null pushd /var/spool/moblock/allow >/dev/null for file in $ALLOWLIST; do /usr/bin/7za x $file >/dev/null 2>&1 done popd >/dev/null BLOCKLIST_LOCAL= for file in /var/spool/moblock/*.txt; do BLOCKLIST_LOCAL="$BLOCKLIST_LOCAL $file" done ALLOWLIST_LOCAL= for file in /var/spool/moblock/allow/*.txt; do ALLOWLIST_LOCAL="$ALLOWLIST_LOCAL -$file" done /usr/bin/mergep2p -p2p -o "$LIST" $BLOCKLIST_LOCAL $ALLOWLIST_LOCAL /usr/bin/find /var/spool/moblock -type f -name '*.txt' | /usr/bin/xargs /bin/rm -f PID=`[ -r /var/run/moblock.pid ] && /bin/cat /var/run/moblock.pid || /bin/pidof moblock` [ -n "$PID" ] && /usr/bin/kill -HUP $PID 2>/dev/null || :