sweeper/CONTROL/postinst

53 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
f=/mod/etc/sweeper.conf
2015-02-01 23:03:47 +00:00
if [ -f $f ]; then
sum=`/mod/bin/busybox/md5sum $f | awk '{print $1}'`
if [ "$sum" = "a22cb1379fb9c58ae549dead9695eebe" ]; then
rm -f $f
fi
fi
2014-06-13 19:09:47 +00:00
if [ ! -f $f ]; then
if [ -f $f~ ]; then
cp $f~ $f
elif [ -f "$f-opkg.backup" ]; then
cp "$f-opkg.backup" $f
fi
fi
2014-06-29 21:53:27 +00:00
[ -f /mod/.swschema ] && schema=`cat /mod/.swschema` || schema=1
2014-07-03 18:46:52 +00:00
echo "Current Sweeper schema: $schema"
case $schema in
2014-06-29 21:53:27 +00:00
1)
# Upgrade folder rules
echo "Upgrading sweeper rules for folder series."
(echo /mod/etc/sweeper.conf; find /media -follow -name .sweeper) \
| while read f; do
[ -f "$f" ] || continue
echo "Processing $f..."
sed -e 's/^folder /& series "" /' -i "$f"
done
;;
2017-01-15 15:32:16 +00:00
1|2)
# Upgrade fflag arguments
echo "Upgrading sweeper rules for folder flags"
(echo /mod/etc/sweeper.conf; find /media -follow -name .sweeper) \
| while read f; do
[ -f "$f" ] || continue
echo "Processing $f..."
sed -e '
s/fflag autoshrinkr/fflag autoshrinkR/
s/fflag autodecryptr/fflag autodecryptR/
' -i "$f"
done
;;
2014-06-29 21:53:27 +00:00
esac
2017-01-15 15:32:16 +00:00
echo 3 > /mod/.swschema
2014-06-29 21:53:27 +00:00
exit 0