Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > 45cd55a5712bc0faaad6c706877519ea > files > 7

moblock-0.8-20mdv2008.1.src.rpm

#!/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 || :