#!/bin/sh # # Usage: modreg cgi # modreg extra <pkg> <title> <sec-level> <cgi-name> # modreg file <id> <title> <sec-level> <desc-file> TMP=/var/tmp TMPFILE=$TMP/.reg.tmp.$$ trap "rm -f $TMPFILE" 0 case "$1" in cgi) [ -e "/mod/etc/reg/cgi.reg" ] || touch /mod/etc/reg/cgi.reg cat /mod/etc/reg/cgi.reg | grep -v "^$2|" > $TMPFILE ( cat $TMPFILE; echo "$2|$3" ) | sort > /mod/etc/reg/cgi.reg rm -f /mod/var/cache/menu_packages ;; extra) [ -e "/mod/etc/reg/extra.reg" ] || touch /mod/etc/reg/extra.reg cat /mod/etc/reg/extra.reg | grep -v "^$2|.*|$5\$" > $TMPFILE ( cat $TMPFILE; echo "$2|$3|$4|$5" ) | sort > /mod/etc/reg/extra.reg rm -f /mod/var/cache/extras ;; file) [ -e "/mod/etc/reg/file.reg" ] || touch /mod/etc/reg/file.reg cat /mod/etc/reg/file.reg | grep -v "^$2|" > $TMPFILE ( cat $TMPFILE; echo "$2|$3|$4|$5" ) | sort > /mod/etc/reg/file.reg rm -f /mod/var/cache/menu_settings ;; *) echo "Usage: $0 cgi <pkg> <title>" 1>&2 echo " $0 extra <pkg> <title> <sec-level> <cgi-name>" 1>&2 echo " $0 file <id> <title> <sec-level> <desc-file>" 1>&2 exit 1 ;; esac exit 0