From b684a8ed8d18718553c6de121be141c7b3021505 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 25 Apr 2005 13:50:26 +0000 Subject: [PATCH] Added /usr/etc files to src. --- etc/Makefile | 7 ++- etc/mtree/minix.tree | 5 +- etc/usr/daily | 66 +++++++++++++++++++++++++++ etc/usr/dhcptags.conf | 63 ++++++++++++++++++++++++++ etc/usr/rc | 103 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 240 insertions(+), 4 deletions(-) create mode 100755 etc/usr/daily create mode 100644 etc/usr/dhcptags.conf create mode 100644 etc/usr/rc diff --git a/etc/Makefile b/etc/Makefile index c36a3a078..0827df0c0 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,17 +1,20 @@ ETC=/etc +USRETC=/usr/etc FILES1=fstab group hostname.file inet.conf motd mtab passwd profile protocols rc services termcap ttytab utmp FILES2=shadow +FILES3=daily dhcptags.conf rc all:: clean:: install:: - @echo "Installing /etc.." + @echo "Installing /etc and /usr/etc.." mkdir -p $(ETC) for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); fi; done - for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); chmod 600 $$f; fi; done + for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then echo $$f exists; else cp $$f $(ETC); chmod 600 $(ETC)/$$f; fi; done + for f in $(FILES3); do if [ -f $(USRETC)/$$f ]; then echo $$f exists; else cp usr/$$f $(USRETC); chmod 755 $(USRETC)/$$f; fi; done @echo "Making hierarchy.." ./mtree.sh mtree/minix.tree cd /dev && /usr/src/commands/scripts/MAKEDEV.sh std diff --git a/etc/mtree/minix.tree b/etc/mtree/minix.tree index 48f57e7ef..97a5be4d9 100644 --- a/etc/mtree/minix.tree +++ b/etc/mtree/minix.tree @@ -5,10 +5,11 @@ 555 root operator /fd0 755 root operator /lib 755 root operator /lib/i386 -755 bin operator /boot +755 root operator /boot +755 root operator /boot/image 555 root operator /mnt 555 root operator /root -1777 root operator /tmp +1777 root operator /tmp 755 root operator /usr 755 root operator /usr/adm 755 root operator /usr/adm/old diff --git a/etc/usr/daily b/etc/usr/daily new file mode 100755 index 000000000..b0e80e23b --- /dev/null +++ b/etc/usr/daily @@ -0,0 +1,66 @@ +#!/bin/sh +# +# daily - daily cleanup of the system. + +case "$#:$1" in +1:cron|1:boot) + caller=$1 + ;; +*) echo >&2 "Usage: $0 cron|boot" + exit 1 +esac + +test -d /usr/adm || exit +cd /usr/adm || exit + +# Last run must have been on a previous day. +timestamp=daily.lasttime +if test -f $timestamp +then + set -- `ls -lT $timestamp` + test "$6 $7 $9" = "$(date '+%b %d %Y')" && exit +fi +>$timestamp + +# Remove three day old files from various tmp dirs. +cleantmp -3 /tmp /usr/tmp /usr/preserve /usr/spool/lpd /usr/spool/at/past + +# Truncate log files in /usr/adm. +test -d old || mkdir old || exit + +cycle() +{ + # Cycle a log file if larger than a size in kilobytes. + local size="`expr "$1" + "$1"`" + local log="$2" + + if test -f "$log" && test -n "$(find "$log" -size +"$size")" + then + test -f "old/$log.2" && cp -p "old/$log.2" "old/$log.3" + test -f "old/$log.1" && cp -p "old/$log.1" "old/$log.2" + cp -p "$log" "old/$log.1" + : > "$log" + fi +} + +cycle 100 wtmp +cycle 100 log +cycle 20 ftplog +cycle 200 aftplog + +# Make copies of /etc/passwd and /etc/shadow if they have been changed. +for file in passwd shadow +do + if cmp -s /etc/$file old/$file.1 + then + # Fine. + else + test -f old/$file.2 && cp -p old/$file.2 old/$file.3 + test -f old/$file.1 && cp -p old/$file.1 old/$file.2 + test -f /etc/$file && cp -p /etc/$file old/$file.1 + fi +done + +# Continue with a local script if present. +test -f /usr/local/etc/daily && sh /usr/local/etc/daily $caller +exit 0 diff --git a/etc/usr/dhcptags.conf b/etc/usr/dhcptags.conf new file mode 100644 index 000000000..e649b46b0 --- /dev/null +++ b/etc/usr/dhcptags.conf @@ -0,0 +1,63 @@ +# A list of all tags mentioned in RFC-1533. + +tag 1 netmask ip 1 1; +tag 2 zoneoffset number 4 1; +tag 3 gateway ip 1 0; +tag 4 timeserver ip 1 0; +tag 5 nameserver ip 1 0; +tag 6 DNSserver ip 1 0; +tag 7 logserver ip 1 0; +tag 8 cookieserver ip 1 0; +tag 9 LPR ip 1 0; +tag 10 impress ip 1 0; +tag 11 resource ip 1 0; +tag 12 hostname ascii 1 0; +tag 13 bootfilesize number 2 1; +tag 14 coredump ip 1 0; +tag 15 domain ascii 1 0; +tag 16 swapserver ip 1 1; +tag 17 rootpath ascii 1 0; +tag 18 extensions ascii 1 0; +tag 19 IPforwarding boolean 1 1; +tag 20 IPnonlocalsource boolean 1 1; +tag 21 IPpolicyfilter ip 2 0; +tag 22 IPmaxreassembly number 2 1; +tag 23 IPTTL number 1 1; +tag 24 IPMTUaging number 4 1; +tag 25 IPMTUplateau number 2 0; +tag 26 IPMTU number 2 1; +tag 27 IPsublocal boolean 1 1; +tag 28 IPbroadcast ip 1 1; +tag 29 IPmaskdiscovery boolean 1 1; +tag 30 IPmasksupplier boolean 1 1; +tag 31 IPdiscovery boolean 1 1; +tag 32 IPsolicitation ip 1 1; +tag 33 IPstaticroute ip 2 0; +tag 34 ARPtrailer boolean 1 1; +tag 35 ARPtimeout number 4 1; +tag 36 ETHencapsulation boolean 1 1; +tag 37 TCPTTL number 1 1; +tag 38 TCPkeepaliveinterval number 4 1; +tag 39 TCPkeepalivegarbage boolean 1 1; +tag 40 NISdomain ascii 1 0; +tag 41 NISserver ip 1 0; +tag 42 NTPserver ip 1 0; +tag 43 VENDOR octet 1 0; +tag 44 NetBIOSNS ip 1 0; +tag 45 NetBIOSdgram ip 1 0; +tag 46 NetBIOSnodetype number 1 1; +tag 47 NetBIOSscope octet 1 0; +tag 48 Xfontserver ip 1 0; +tag 49 XDM ip 1 0; +tag 50 DHCPreqip ip 1 1; +tag 51 DHCPlease number 4 1; +tag 52 DHCPoverload number 1 1; +tag 53 DHCPtype number 1 1; +tag 54 DHCPserverID ip 1 1; +tag 55 DHCPreqpar number 1 0; +tag 56 DHCPmessage ascii 1 0; +tag 57 DHCPsize number 2 1; +tag 58 DHCPrenewal number 4 1; +tag 59 DHCPrebinding number 4 1; +tag 60 DHCPclassID ascii 1 0; +tag 61 DHCPclientID octet 1 0; diff --git a/etc/usr/rc b/etc/usr/rc new file mode 100644 index 000000000..1c6626254 --- /dev/null +++ b/etc/usr/rc @@ -0,0 +1,103 @@ +# /usr/etc/rc - continued system initialization. + +case "$#:$1" in +1:start|1:stop|1:down) + action=$1 + ;; +*) echo >&2 "Usage: $0 start|stop|down" + exit 1 +esac + +daemonize() +{ + # Function to start a daemon, if it exists. + local IFS=':' + local name="$1" + test "$1" = tcpd && name="$2" + + for dir in $PATH + do + if [ -f "$dir/$1" ] + then + echo -n " $name" + "$@" & + return + fi + done +} + +case $action in +start) + # Select console font. + test -f /etc/font && loadfont /etc/font /dev/null && net=t # Is there a TCP/IP server? + + echo -n "Starting daemons:" + daemonize update + daemonize cron + + if [ "$net" ] + then + if [ -f /etc/rc.net ] + then + # Let a customized TCP/IP initialization script figure it out. + . /etc/rc.net + else + # Standard network daemons. + daemonize dhcpd + daemonize nonamed + daemonize talkd + daemonize tcpd shell in.rshd + daemonize tcpd login in.rlogind + daemonize tcpd telnet in.telnetd + daemonize tcpd ftp in.ftpd + fi + fi + + # The last daemon has been started, so close the list: + echo . + + if [ "$net" ] + then + # Get the nodename from the DNS and set it. + t='-t 10' + trap '' 2 + while :; + do + intr $t hostaddr -h + + case $? in + 142) + echo "\ +Unable to obtain an IP address after 10 seconds. Hit DEL to get a root +prompt to investigate, otherwise just wait until an address is received..." + t= + ;; + 130) + echo "Single user." + intr sh + echo "Continue waiting for an address..." + ;; + *) break + esac + done + trap 2 + fi + + # Recover files being edited when the system crashed. + test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv* + + # Run the daily cleanup on systems that are not on at night. + test -f /usr/etc/daily && sh /usr/etc/daily boot & +esac -- 2.44.0