#! /opt/bin/dash # # os/prog/fsck/post.sh export PATH="/opt/bin:/bin:/usr/bin" echo "Content-type: text/html\n\nfsck" user=`echo "${REMOTE_USER}" | tr -dc '[:alnum:]' | tr '[:upper:]' '[:lower:]'` if [ -z "$user" ]; then echo "Bad user: ${REMOTE_USER} -> $user"; exit 1; fi if [ -n "$HTTP_HOST" ]; then cd /os/prog/fsck || exit 1; fi # tomato = #FF6347 # lightgreen = #90EE90 # in=$(cat | egrep -v '#FF6347|#90EE90') h=$(echo "$in" | awk '{ if( $2 == "P") { print $3; exit; }}') useed1=$(echo "$in" | awk '{ if( $2 == "useed1") { gsub(/[^0-9]/,"",$3); print $3; exit; }}') useed2=$(echo "$in" | awk '{ if( $2 == "useed2") { gsub(/[^0-9]/,"",$3); print $3; exit; }}') if [ -z "$useed2" ]; then useed2="$useed1"; fi #echo "
$in\n
" n="6"; i="8"; d="8" case "$h" in "3") p="3"; s1="123456789"; s2="123456789";; "2") p="2"; s1="123456789"; s2="123456789";; *) p="1"; s1="123456789"; s2="123456789";; esac if [ -n "$useed1" ]; then seed1="$useed1" seed2="$useed2" msg="- seed1 = $seed1, seed2 = $seed2" else x=$(perl -e "print unpack(\"C*\",$user);"); seed1="${s1}${x}"; seed2="${s2}${x}" #echo "
s1 = $s1, s2 = $s2, x = $x, seed1 = $seed1, seed2 = $seed2
" msg="" fi echo "$user - fsck #$p results $msg

green = correct
    red = wrong

${p}. How is the file system corrupted?

" # for -w option: 0...11 skipping 5,7,11 w=$(awk -v "S=$seed2" 'END { len=length(S); s=0; for(i=1;i"; print ""xmsg"   "; print "INODE or bit number: "y"   "; print ""; exit; } }}' ) if [ -z "$useed1" ]; then bad=$(echo "$out" | grep "#FF6347" | wc -l) good=$(echo "$out" | grep "#90EE90" | wc -l) log=$(echo "$in" | tr -dc '[:alnum:]') echo "$(date) $user ${p}: good $good bad $bad in: $log" >> log fi echo "

\n$out
"