#!/bin/sh
# Author: Blake, Kuo-Lien Huang
# License: GPL
# Description:
#   

removeentries() {
  while read line; do
    case "$line" in $1)
      while read line; do
        if [ "$line" = "$2" ]; then break; fi
      done
    esac
    if [ "$line" = "$2" ]; then continue; fi
    echo "$line"
  done < $3
}

START_TAG="===== Added by DRBL ====="
END_TAG="=====     End       ====="

removeentries "$START_TAG" "$END_TAG" /etc/motd > motd.$$

echo "$START_TAG" >> motd.$$
for motd in `ls /opt/drbl/etc/motd.*`; do
  cat $motd >> motd.$$
done
echo "$END_TAG" >> motd.$$

#
cp motd.$$ /etc
/opt/drbl/sbin/drbl-cp motd.$$ /etc
