diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b5a2f87 --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +include Makefile.rules + +CGI_BINS=apply bindery control device doc general group listconfig logging logins menu printer security user volume + +all: + ( cd bin; make ) + ( cd etc; make ) + + for i in $(CGI_BINS); do \ + ./setshell $(BASH2_SHELL) < root/cgi-bin/$$i.in > root/cgi-bin/$$i; \ + chmod 755 root/cgi-bin/$$i; \ + done + +clean: + ( cd bin; make clean ) + ( cd etc; make clean ) + + for i in $(CGI_BINS); do \ + rm -f root/cgi-bin/$$i; \ + done + +install: install-files install-config + +install-files: + @echo "Installing files..." + install -d -g $(INSTALL_GROUP) -o root -m 755 $(DOC) + install -d -g $(INSTALL_GROUP) -o root -m 755 $(LIB) + $(DIRECTORY_COPY) forms $(LIB)/ + chown -R root.$(INSTALL_GROUP) $(LIB)/forms + $(DIRECTORY_COPY) menus $(LIB)/ + chown -R root.$(INSTALL_GROUP) $(LIB)/menus + mv doc `basename $(DOC)` + $(DIRECTORY_COPY) `basename $(DOC)` $(DOC)/.. + mv `basename $(DOC)` doc + chown -R root.$(INSTALL_GROUP) $(DOC)/ + $(DIRECTORY_COPY) root $(LIB)/ + chown -R root.$(INSTALL_GROUP) $(LIB)/root + rm -f $(LIB)/root/cgi-bin/*.in + ln -s $(LIB)/etc/smart.conf $(LIB)/root/smart.conf + if ! [ -d $(LIB)/doc ]; then ln -s $(DOC) $(LIB)/doc; fi + ( cd bin; make install ) + ( cd etc; make install ) + +install-config: + @echo "Adding SMArT to the inet daemon configuration files..." + echo -e '\n#SMArT MARS_NWE webconfig tool\n' >> /etc/inetd.conf + echo "smart stream tcp nowait root $(LIB)/webserve webserve" | sed -e 's/\\//g' >> /etc/inetd.conf + echo -e '\n#SMArT MARS_NWE webconfig tool\nsmart 902/tcp' >> /etc/services + @echo "Please send a HUP signal to inetd, using a command like this:" + @echo + @echo "killall -HUP inetd" diff --git a/Makefile.rules b/Makefile.rules new file mode 100644 index 0000000..287c31b --- /dev/null +++ b/Makefile.rules @@ -0,0 +1,18 @@ +#Edit this file for your environment; If you run FreeBSD, just remove the lines +#that belong to Linux, or make sure the FreeBSD values are placed below the +#Linux defaults. Linux users probably don't have to change this file. + +#FreeBSD defaults +DOC=\/usr\/local\/share\/doc\/smart +LIB=\/usr\/local\/lib\/smart +INSTALL_GROUP=wheel +DIRECTORY_COPY=cp -RPp +BASH2_SHELL=/usr/local/bin/bash + +#Linux defaults (RPM) +#If you install this with make install, it's better to use \/usr\/local\/* +DOC=\/usr\/doc\/smart-1.3 +LIB=\/usr\/lib\/smart +INSTALL_GROUP=root +DIRECTORY_COPY=cp -a +BASH2_SHELL=/bin/sh diff --git a/bin/Makefile b/bin/Makefile new file mode 100644 index 0000000..8de5f7e --- /dev/null +++ b/bin/Makefile @@ -0,0 +1,32 @@ +include ../Makefile.rules + +all: hex hexasc webserve replace genform + +hex: hex.c + $(CC) hex.c -o hex + +hexasc: hexasc.c + $(CC) hexasc.c -o hexasc + +webserve: webserve.in + sed -e "s/WEBSERVE_CONF=/WEBSERVE_CONF=$(LIB)\/etc\/webserve.conf/" \ + < webserve.in | ../setshell $(BASH2_SHELL) > webserve + chmod 755 webserve + +replace: replace.in + ../setshell $(BASH2_SHELL) < replace.in > replace + chmod 755 replace + +genform: genform.in + ../setshell $(BASH2_SHELL) < genform.in > genform + chmod 755 genform + +clean: + rm -f hex hexasc webserve replace genform + +install: all + install -g $(INSTALL_GROUP) -o root -m 744 -p webserve $(LIB)/webserve + install -g $(INSTALL_GROUP) -o root -m 744 -p hex $(LIB)/hex + install -g $(INSTALL_GROUP) -o root -m 744 -p hexasc $(LIB)/hexasc + install -g $(INSTALL_GROUP) -o root -m 744 -p genform $(LIB)/genform + install -g $(INSTALL_GROUP) -o root -m 744 -p replace $(LIB)/replace diff --git a/bin/genform.in b/bin/genform.in new file mode 100644 index 0000000..fce109b --- /dev/null +++ b/bin/genform.in @@ -0,0 +1,132 @@ +#!/bin/sh +# +# Generate a complete HTML-form +# +# Copyright 2000 Wilmer van der Gaast (lintux@lintux.cx) +# + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +. $WEBSERVE_ROOT/cgi-bin/functions +. $WEBSERVE_ROOT/smart.conf + +declare -i i +declare -i j + +read TITLE +cat << EOF + +
+