diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2010-10-24 03:05:00 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2010-10-24 03:05:00 +0800 |
commit | b05a39e365307ec328d8a7ba86ed76f3685c913c (patch) | |
tree | bf566658092b5532b6341d32ba1c80b868631d39 | |
parent | 9169fd04c1c776d0b967a337d11754677bd0b356 (diff) | |
download | pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar.gz pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar.bz2 pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar.lz pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar.xz pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.tar.zst pttbbs-b05a39e365307ec328d8a7ba86ed76f3685c913c.zip |
add upgrade script for new ban system
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5153 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rwxr-xr-x | pttbbs/upgrade/r5149_waterban.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/pttbbs/upgrade/r5149_waterban.sh b/pttbbs/upgrade/r5149_waterban.sh new file mode 100755 index 00000000..fc98a9a6 --- /dev/null +++ b/pttbbs/upgrade/r5149_waterban.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# This script converts old 'water' to new 'banned' format. +# Before running, create a file with the stamp you want in +# r5149_waterban.data + +SRC_SAMPLE=r5149_waterban.data +if [ ! -f "$SRC_SAMPLE" ]; then + echo "Please touch your timestamp in $SRC_SAMPLE." + exit 1 +fi + +i=0 +num_boards=$(~/bin/showboard ~/.BRD | wc -l) +boards=$(~/bin/showboard ~/.BRD | sed 's/^ *[0-9][0-9]* //;s/ .*//') +for X in $boards; do + i=$((i+1)) + echo -n "\rProcessing: $i/$num_boards" >&2 + board_path=$HOME/boards/$(echo $X | cut -b 1)/$X + #echo "checking: $board_path/water" + if [ ! -s "$board_path/water" ]; then + continue + fi + water_fn="$board_path/water" + echo "Processing board: $X" + uids=$(awk '{print $1}' "$water_fn") + for uid in $uids; do + uid_folder="$HOME/home/$(echo $uid | cut -b 1)/$uid" + if [ -d "$uid_folder" ]; then + echo "found uid folder: $uid_folder" + else + echo "invalid user: $uid" + continue + fi + mkdir -p $uid_folder/banned + cp $SRC_SAMPLE $uid_folder/banned/b_$X + done +done |