1
0

Source code upload

This commit is contained in:
calmsacibis995
2022-09-29 17:59:04 +03:00
parent 72fa9da3d7
commit 8fc8fa8089
33399 changed files with 11964078 additions and 0 deletions

42
eoe/cmd/initpkg/Makefile Normal file
View File

@@ -0,0 +1,42 @@
#ident "$Revision: 1.63 $"
include $(ROOT)/usr/include/make/commondefs
FILES_STD=inittab
FILES_MR=inittab-mr
SCRIPT_STD=brc bcheckrc mountall umountfs
SCRIPT_MR=brc-mr bcheckrc-mr restore_system-mr
SCRIPT_MRRC=mrcleanrc mrconfigrc mrcustomrc mrinitrc mrinitxlvrc mrinstrc \
mrlogrc mrmkfsrc mrmountrc mrnetrc mrprofrc mrreorgrc mrvolhdrrc
OBJECTS_MR=gethostid inet_aton setsid mrinterface
# None of these are really configuration files that the user might change.
SCRIPT =lnsyscon rc0 rc2 rc3 shutdown reboot halt single multi mntproc mnthwgfs
DIRS =init.d rc0.d rc2.d rc3.d
TARGETS = $(SCRIPT) $(SCRIPT_MR) $(SCRIPT_MRRC) $(SCRIPT_STD) $(OBJECTS_MR)
INSDIR =/etc
INSCMD =$(INSTALL) -F $(INSDIR)
COMMONPREF = init_
default:$(FILES_STD) $(FILES_MR) $(TARGETS)
include $(COMMONRULES)
${COMMONTARGS} install: ${COMMONPREF}$$@
@for d in ${DIRS}; do \
${ECHO} "\tcd $$d; ${MAKE} $@"; \
cd $$d; ${MAKE} $@; cd ..; \
done
$(COMMONPREF)install: default
$(INSCMD) -m 644 -idb "std.sw.unix config(update)" "$(FILES_STD)"
$(INSCMD) -m 755 -idb "std.sw.unix config(update)" "$(SCRIPT_STD)"
$(INSCMD) -m 755 -idb "std.sw.unix mr" "$(SCRIPT)"
$(INSCMD) -m 755 $(SCRIPT_MRRC) $(OBJECTS_MR)
for nm in $(SCRIPT_MR) $(FILES_MR); do \
$(INSCMD) -m 755 -idb "mr" -src $$nm `expr $$nm : '\\(.*\\)-mr'`; \
done

View File

@@ -0,0 +1,71 @@
#! /bin/sh
# This file has those commands necessary to insure the integrity of the
# root file system.
#
# $Revision: 1.36 $
# $Date: 1997/12/01 19:42:34 $
# remove unused unix.* boot images before calling
# MAKEDEV, to ensure that MAKEDEV doesn't run out
# of disk space, causing serious confusion.
. mrprofrc
# create /tmp (used by shell for tmp files)
test -d /tmp || mkdir /tmp > /dev/null 2>&1
CPU_TYPE=`uname -m`
if test ! -f /unix
then
if test -f /unix.$CPU_TYPE
then
ln /unix.$CPU_TYPE
rm -f /unix.*
ln /unix /unix.$CPU_TYPE
fi
fi
# grow the miniroot filesystem from it's shipped to it's working size
# the grown size *must* be <= swap mount offset defined in ./brc-mr.sh
# and master.d/system.gen. For IP20/IP22/IP26 use the smaller swap space.
if [ "$CPU_TYPE" = "IP20" -o "$CPU_TYPE" = "IP22" -o "$CPU_TYPE" = "IP26" ]
then
/usr/sbin/xfs_growfs -D 57000 / 2>&1 >/tmp/growfs.log
else
/usr/sbin/xfs_growfs -D 63000 / 2>&1 >/tmp/growfs.log
fi
if [ $? -ne 0 ]
then
echo "Error from xfs_growfs : "
cat /tmp/growfs.log
fi
/bin/rm /tmp/growfs.log > /dev/null 2>&1
# re-create /dev if possible and necessary
if [ `/bin/ls /dev|wc -l` -lt 10 ]
then
# because it takes so long, and looks like the system is
# hung, unless you can see the system disk LED
echo Creating miniroot devices, please wait...\\c
cd /dev; ./MAKEDEV MAXPTY=10 MAXGRO=4 MAXGRI=4 mindevs scsi > /dev/null
echo ''
fi
set `/sbin/devnm /`
rootfs=$1
/sbin/fsstat ${rootfs} >/dev/null 2>&1
if [ $? -ne 0 ]
then
echo "The root file system, ${rootfs}, is being checked automatically."
/sbin/fsck -y -D -b ${rootfs}
fi
# Remove ps temporary file
rm -rf /tmp/.ps_data

View File

@@ -0,0 +1,82 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.63 $"
#
# This script runs those commands necessary to check file systems, to make
# generic device links, and to do anything else that should be done before
# mounting file systems.
#
# create /tmp (used by shell for tmp files)
test -r /tmp || mkdir /tmp > /dev/null 2>&1
# Build device aliases before fsck
if [ -d /hw/disk ]; then
/sbin/suattr -C CAP_MAC_READ,CAP_MAC_WRITE,CAP_MKNOD+ipe -c "/sbin/ioconfig -f /hw"
fi
# Make symlink "/usr/bin -> ../../sbin". Must be done *before*
# /usr is mounted, so programs executed as /bin/* will work in
# single user mode. Do not use the same algorithm as libc.so.1 since
# /usr/bin may be a real directory if root and usr are merged.
#
/sbin/ls /usr/bin > /dev/null 2>&1
if [ $? != 0 ]; then
/sbin/ln -s ../sbin /usr/bin <&- > /dev/null 2>&1
fi
# Make symlink /usr/var/config -> ../../etc/config
# Must be done *before* /usr is mounted, so programs can use
# config files in single user mode.
#
if [ ! -s /usr/var/config ] ; then
/sbin/mkdir -p /usr/var > /dev/null 2>&1
/sbin/rm -rf /usr/var/config > /dev/null 2>&1
/sbin/ln -s ../../etc/config /usr/var/config <&- > /dev/null 2>&1
fi
if [ "`/sbin/nvram diskless 2> /dev/null`" -eq 1 ] ; then
if [ -f /var/boot/makedev ] ; then
echo "Making client's devices..."
cd /dev; ./MAKEDEV > /dev/null
rm -f /var/boot/makedev
fi
else
set `/sbin/devnm /`
rootfs=$1
/sbin/fsstat ${rootfs} >/dev/null 2>&1
if [ $? -eq 1 ] ; then
echo "The root file system, ${rootfs}, is being checked automatically."
/sbin/fsck -y ${rootfs}
fi
fi
if [ -x /etc/init.d/failover ] ; then
/etc/init.d/failover init
fi
if [ -x /sbin/xlv_assemble ] ; then
/etc/init.d/xlv init
fi
# Remove ps temporary file
rm -rf /tmp/.ps_data
# Make symlink /usr/lib/libc.so.1 -> ../../lib/libc.so.1
# and /usr/lib32/libc.so.1 -> ../../lib32/libc.so.1
# Must be done *before* /usr is mounted, so dynamic linked
# programs can be run in single user mode.
if [ ! -s /usr/lib/libc.so.1 ]
then
mkdir -p /usr/lib > /dev/null 2>&1
rm -rf /usr/lib/libc.so.1 > /dev/null 2>&1
ln -s ../../lib/libc.so.1 /usr/lib/libc.so.1 <&- > /dev/null 2>&1
fi
if [ ! -s /usr/lib32/libc.so.1 ]
then
mkdir -p /usr/lib32 > /dev/null 2>&1
rm -rf /usr/lib32/libc.so.1 > /dev/null 2>&1
ln -s ../../lib32/libc.so.1 /usr/lib32/libc.so.1 <&- > /dev/null 2>&1
fi

38
eoe/cmd/initpkg/brc-mr.sh Normal file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision: 1.33 $"
# mini-root version
#
#
# This script does the early, easy post-boot stuff on the miniroot:
# Initialize /etc/fstab and /etc/mtab
# Adds swap (on the remainder of partition 1)
# Mounts /proc
ln -s /dev/root /dev/miniroot 1>&- 2>&-
rootdev=/dev/miniroot
if test ! -f /etc/fstab
then
echo "$rootdev /" | setmnt -f /etc/fstab
fi
echo "$rootdev /" | setmnt
# In the miniroot, swap is always added from here.
# We need fstab around for the swap command
# The swaplo amount should match what is found in the master.d/system.gen
# and >= the value to grow the fs in the file ./bcheckrc-mr.sh
# For IP20/IP22/IP26 use the smaller swap space.
CPU_TYPE=`uname -m`
if [ "$CPU_TYPE" = "IP20" -o "$CPU_TYPE" = "IP22" -o "$CPU_TYPE" = "IP26" ]
then
su root -C CAP_SWAP_MGT+ip -c "/sbin/swap -i -a /dev/swap 57000"
else
su root -C CAP_SWAP_MGT+ip -c "/sbin/swap -i -a /dev/swap 63000"
fi
# Mount the /proc file system
/etc/mntproc
/etc/mnthwgfs

92
eoe/cmd/initpkg/brc.sh Normal file
View File

@@ -0,0 +1,92 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.48 $"
#
# This script is responsible for initializing the mounted filesystem table
# kept in /etc/mtab. It also creates /etc/fstab if none exists.
#
if [ "`/sbin/nvram diskless 2> /dev/null`" -eq 1 ] ; then
> /etc/mtab
/sbin/mount -f /
if [ -d /sbin ]; then
/sbin/mount -f /sbin
fi
if [ -d /swap ]; then
/sbin/mount -f /swap
fi
if [ -d /usr ]; then
/sbin/mount -f /usr
fi
if [ -d /var/share ]; then
/sbin/mount -f /var/share
fi
else
rootdev=/dev/root
usrdev=/dev/usr
if [ ! -f /etc/fstab ] ; then
/sbin/fsstat $usrdev >/dev/null 2>&1
if [ $? -eq 3 ] ; then
echo "$rootdev /" | setmnt -f /etc/fstab
else
echo "$rootdev /\n$usrdev /usr" | setmnt -f /etc/fstab
fi
fi
if [ ! -f /etc/mtab ] ; then rm -f /etc/mtab; fi
echo "$rootdev /" | setmnt
fi
mkdir /etc/fscklogs > /dev/null 2>&1
if test -n "`grep '^[^#].*[ ]/var[/]*[ ]' /etc/fstab`"; then
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -c /var" > /etc/fscklogs/rvar 2>&1
then
cat /etc/fscklogs/rvar
else
cat /etc/fscklogs/rvar
echo "Unable to Mount /var\n"
sleep 5
fi
else
if test -n "`grep '^[^#].*[ ]/usr[/]*[ ]' /etc/fstab`"; then
deflvl="`/sbin/nvram initstate 2>/dev/null`" 2>/dev/null
if [ "$deflvl" = "s" -o "$deflvl" = "1" ]; then
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount /usr"
then :
else
echo "Unable to Mount /usr\n"
sleep 5
fi
else
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -c /usr" > /etc/fscklogs/rusr 2>&1
then
cat /etc/fscklogs/rusr
else
cat /etc/fscklogs/rusr
echo "Unable to Mount /usr\n"
sleep 5
fi
fi
fi
fi
if [ ! -d /var/adm ]
then
if [ -l /var ]
then
mkdir /usr/var > /dev/null 2>&1
fi
mkdir /var/adm
fi
/etc/mnthwgfs
/etc/mntproc
if [ ! -d /dev/fd ]; then
/bin/rm -rf /dev/fd > /dev/null 2>&1
mkdir /dev/fd
fi
# redirect the output, since it's an optional filesystem.
# /dev/fd is used for exec of setuid and setgid scripts
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -t fd /dev/fd /dev/fd" > /dev/null

View File

@@ -0,0 +1,31 @@
/*
* tiny binary to display result of gethostid(2) in hex.
*/
extern char* itox (unsigned long);
extern long gethostid(void);
main(){
char *s = itox (gethostid());
write (1, s, strlen(s));
exit (0);
}
char *itox(unsigned long idval)
{
static char buf[32];
char *p = buf + sizeof(buf) - 1;
*p-- = 0;
*p-- = '\n';
if (idval == 0)
*p-- = '0';
else while (idval) {
int digit = idval % 16;
idval /= 16;
*p-- = digit < 10 ? digit + '0' : digit - 10 + 'a';
}
*p-- = 'x';
*p = '0';
return p;
}

82
eoe/cmd/initpkg/halt.sh Normal file
View File

@@ -0,0 +1,82 @@
#! /sbin/sh -e
#Tag 0x00000800
# Reboot the system--stop the system and leave it 'in the PROM'
# halt [-p]
# -p requests that the machine powerdown, if supported (Indigo2 & Indy).
#
# $Revision: 1.11 $"
# I18N
# ----------------------------------------------------------------------------
ask() {
#! ask msg default
#! default should be 0 for "no", "yes" otherwise
#! returns 0 for "no", otherwise "yes"
#! because this script is using the -e shell option
#! ask returns it's status via the 'ret' variable.
yesstr=`gettxt ${msgfile}:171 "yes"`
nostr=`gettxt ${msgfile}:172 "no"`
choicefmt=`gettxt ${msgfile}:169 "(%s/%s)"`
defaultfmt=`gettxt ${msgfile}:170 "[%s]"`
shortyes=`echo $yesstr | cut -c1`
shortno=`echo $nostr | cut -c1`
fmt=${choicefmt}${defaultfmt}
if [ $2 -eq 0 ]
then
str=`printf "${choicefmt}${defaultfmt} : " "$yesstr" "$nostr" "$nostr"`
else
str=`printf "${choicefmt}${defaultfmt} : " "$yesstr" "$nostr" "$yesstr"`
fi
printf "%s%s" "$1" "$str"
read ans
# convert answer to lowercase
ans=`echo $ans | tr '[A-Z]' '[a-z]'`
case "$ans" in
${yesstr}*) ret=1
;;
${nostr}*) ret=0
;;
${shortyes}*) ret=1
;;
${shortno}*) ret=0
;;
*) ret=$2
;;
esac
return 0
} # End of ask
ret=0
msgfile=uxsgicore
# ----------------------------------------------------------------------------
poweroff=
case $1 in
-p )
poweroff=-p
;;
esac
if test -n "$REMOTEHOST"
then
hostn=`hostname -s`
fmt=`gettxt ${msgfile}:721 "Halt %s ? "`
str=`printf "${fmt}" "${hostn}"`
ask "${str}" 0
if [ ${ret} -eq 0 ]
then
echo `gettxt ${msgfile}:722 "'Halt' cancelled."`
exit 0
fi
fi
/etc/shutdown -y -g0 -i0 $poweroff
sleep 10 2> /dev/null

View File

@@ -0,0 +1,18 @@
/*
* tiny binary to use inet_aton, from libc/src/inet/inet_addr.c,
* to check for valid ascii representation of an Internet address.
*/
#include <arpa/inet.h>
int main (int argc, char *argv[])
{
if (argc != 2) {
char *msg = "Usage: inet_aton inetaddr\n";
write (2, msg, strlen(msg));
exit (1);
}
if (inet_aton (argv[1], 0) != 1)
exit (2);
exit (0);
}

57
eoe/cmd/initpkg/init.d/CMW Executable file
View File

@@ -0,0 +1,57 @@
#!/sbin/sh
#Tag 0x00000f00
#
# Start CMW Display Manager
#
# $Revision: 1.4 $
#
IS_ON=/sbin/chkconfig
CMW=CMWloop
CONSOLE=/dev/null
REMOTEHOST=
REMOTEUSER=
DISPLAY=:0
export REMOTEHOST
export REMOTEUSER
export DISPLAY
if $IS_ON verbose ; then # For a verbose startup and shutdown
ECHO=echo
else # For a quiet startup and shutdown
ECHO=:
fi
if $IS_ON xdm ; then
$ECHO CMW startup warning: Xdm is not used in the CMW environment.
$IS_ON xdm off
fi
case "$1" in
'start')
$ECHO 'CMW \c'
/sbin/suattr -C "all=epi" -M dblow -c /usr/bin/X11/"$CMW" > $CONSOLE 2>&1 &
;;
'stop')
/sbin/killall -TERM $CMW
/sbin/killall -TERM 4Dwm
/sbin/killall -TERM xinit
/sbin/killall -TERM Xsgi
/sbin/killall -KILL $CMW
/sbin/killall -KILL 4Dwm
/sbin/killall -KILL xinit
/sbin/killall -KILL Xsgi
/sbin/killall -KILL endsession
/sbin/killall -KILL xprop
;;
*)
echo "usage: /etc/init.d/CMW {start|stop}"
;;
esac

View File

@@ -0,0 +1,148 @@
#!/sbin/sh
#Tag 0x00000f00
#
# CMW Configuration checks.
#
# $Revision: 1.8 $
#
IS_ON=/sbin/chkconfig
#
# turn(option, on/off)
#
# This function is used to deal with /etc/config entries which are
# not root writable. At least one (desktop) of the option flag files
# is installed thus.
#
turn ()
{
/sbin/suattr -C CAP_DAC_WRITE+ep -c "/sbin/chkconfig $1 $2"
}
#
# remove(path)
#
# This function is used to deal with ill-behaved scripts which cause
# errors in the Trix environment. it should be called with the full
# path of the appropriate rc?.d link; do not call it with the init.d path.
# Whenever possible, turning off chkconfig options is preferred over
# removing links.
#
remove()
{
if [ -f "$1" ]; then
/usr/bin/rm "$1"
echo "$1 removed for the CMW environment."
else
:
fi
}
cronmaccheck ()
{
if test "`sysconf MAC`" -eq 1; then
if test ! -d $1; then
/sbin/suattr -m -C all=eip -c "rm -rf $1"
mkdir $1
/sbin/suattr -C all=eip -c "chlabel msenmldlow/minthigh $1"
fi
fi
}
if $IS_ON verbose ; then # For a verbose startup and shutdown
ECHO=echo
else
if $IS_ON CMWquiet ; then # For a verbose startup and shutdown
ECHO=:
else # For a quiet startup and shutdown
ECHO=echo
fi
fi
case "$1" in
'start')
$ECHO 'CMW Configuration checks...'
if $IS_ON xdm ; then
$ECHO CMW: xdm cannot be used.
turn xdm off
fi
if $IS_ON visuallogin ; then
$ECHO CMW: visuallogin cannot be used.
turn visuallogin off
fi
if $IS_ON objectserver ; then
$ECHO CMW: objectserver cannot be used.
turn objectserver off
fi
if $IS_ON directoryserver ; then
$ECHO CMW: directoryserver cannot be used.
turn directoryserver off
fi
if $IS_ON desktop ; then
$ECHO CMW: desktop cannot be used.
turn desktop off
fi
if $IS_ON lockd ; then
$ECHO CMW: lockd cannot be used.
turn lockd off
fi
if $IS_ON audit ; then
: OKay
else
$ECHO Note: audit should be used in the CMW environment.
fi
if $IS_ON timed ; then
: OKay
else
$ECHO Note: timed should be used in the CMW environment.
fi
if $IS_ON lockd ; then
$ECHO CMW: lockd cannot be used.
turn lockd off
fi
# checks added for Irix 6.5se
if $IS_ON autoconfig_ipaddress ; then
$ECHO CMW: DHCP cannot be used.
turn autoconfig_ipaddress off
fi
if $IS_ON sdpd ; then
$ECHO CMW: sdpd cannot be used.
turn sdpd off
fi
if $IS_ON ns_admin ; then
$ECHO CMW: ns_admin cannot be used.
turn ns_admin off
fi
if $IS_ON ns_fasttrack ; then
$ECHO CMW: ns_fasttrack cannot be used.
turn ns_fasttrack off
fi
if $IS_ON webface ; then
$ECHO CMW: webface cannot be used.
turn webface off
fi
# remove these rc2.d links to prevent broken scripts (or unavailable
# functionality) from confusing customers.
remove /etc/rc2.d/S95availmon # availmon doesn't work under Trix
remove /etc/rc0.d/K05availmon # availmon doesn't work under Trix
remove /etc/rc2.d/S98xdm # chkconfig tests broken for Trix/CMW
remove /etc/rc2.d/S60ns_admin # runs $CONFIGURE when chkconfig'd off
remove /etc/rc2.d/S98pcp # no chkconfig option. doesn't work.
remove /etc/rc0.d/K02pcp # no chkconfig option. doesn't work.
remove /etc/rc0.d/K30ns_admin # chkconfig off doesn't fix entirely
remove /etc/rc0.d/K30ns_fasttrack # chkconfig off doesn't fix entirely
remove /etc/rc0.d/K35webface # chkconfig off doesn't fix entirely
# create moldy directories for cron
cronmaccheck /var/spool/cron/crontabs/:mac
cronmaccheck /var/spool/cron/atjobs/:mac
# hist file gets written after attrinit runs. needed for configmsg script.
/sbin/suattr -C CAP_MAC_READ,CAP_DAC_READ_SEARCH,CAP_DAC_WRITE,CAP_MAC_WRITE,CAP_DEVICE_MGT+ip -c "/sbin/attrinit -type=t -mac=dblow var/inst"
$ECHO 'done.'
;;
'stop')
;;
*)
echo "usage: /etc/init.d/CMWchkconfig {start|stop}"
;;
esac

View File

@@ -0,0 +1,84 @@
#ident "$Revision: 1.119 $"
include $(ROOT)/usr/include/make/commondefs
# simple files not changed by the user
MRSIMP =usr filesystems postinst
STDSIMP =configmsg snmp swap uucp xlv
SPCL =quotas
SIMP =$(STDSIMP) $(SPCL) $(MRSIMP)
# configuration files that SGI knows best
MRUPDATE=rmtmpfiles network
STDUPDATE=autoconfig chkdev cron grio mail savecore sysetup xdm fontserver \
announce disk_patch aliases-ip CMW CMWchkconfig failover
UPDATE =$(STDUPDATE) $(MRUPDATE)
#
# Turn on savecore by default ... not all systems will want this
# feature.
SAVECORE_DEFAULT ="mach(CPUBOARD=IP19 CPUBOARD=IP20 CPUBOARD=IP21 CPUBOARD=IP22 CPUBOARD=IP25 CPUBOARD=IP26 CPUBOARD=IP27 CPUBOARD=IP28 CPUBOARD=IP30 CPUBOARD=IP32) config(noupdate)"
# config files for miniroot only
MRONLYFILES=sysetup.mr filesystems.mr
FILES =$(SIMP) $(UPDATE) $(MRONLYFILES) nostickytmp
INSDIR =/etc/init.d
CFGDIR =/etc/config
ETCDIR =/etc
INSCMD =$(INSTALL) -m 755 -F $(INSDIR)
default:$(FILES)
clean clobber:
FRC:
install: default
$(INSTALL) -dir $(INSDIR) $(CFGDIR)
$(INSTALL) -idb "noshare" -F /var -lns /etc/config config
$(INSTALL) -m 644 -F $(INSDIR) README
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src verbose.config verbose
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src vswap.config vswap
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src network.config network
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src sendmail.config sendmail
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src xlv.config xlv
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
netif.options
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
static-route.options
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
vswap.options
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
autoconfig.options
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
-src ipaliases.config ipaliases
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(CFGDIR) \
ipaliases.options
$(INSTALL) -idb $(SAVECORE_DEFAULT) -m 644 -F $(CFGDIR) \
-src savecore.config savecore
$(INSTALL) -idb "config(noupdate)" -m 644 -F $(ETCDIR) \
-src failover.config failover.conf
$(INSCMD) $(MRSIMP)
$(INSCMD) $(STDSIMP)
$(INSCMD) -idb "config(update)" $(STDUPDATE)
$(INSCMD) quotas
$(INSCMD) -idb "config(update) mach(CPUBOARD=IP19 CPUBOARD=IP21 CPUBOARD=IP25)" sysctlr
$(INSCMD) -idb "config(update) mach(CPUBOARD=IP27)" sn0start
$(INSCMD) -idb "config(update) mach(CPUBOARD=IP27)" partcfg
$(INSCMD) -idb "config(update) mach(CPUBOARD=IP30)" machdepstart.ip30
# make autoconfig a real command
$(INSTALL) -F /etc -lns init.d/autoconfig autoconfig
# All of the following file should be install at least in the mini-root
$(INSCMD) -idb "config(update)" $(MRUPDATE)
$(INSCMD) -src sysetup.mr sysetup
$(INSCMD) -src filesystems.mr filesystems
$(INSTALL) -F $(CFGDIR) -idb 'config(noupdate)' -u root -g sys -m 644 \
nostickytmp

View File

@@ -0,0 +1,41 @@
#"$Revision: 1.6 $"
# /etc/init.d contains initialization and termination scripts for
# changing init states. These scripts are linked when appropriate to
# files in the /etc/rc?.d directories. File names in rc?.d directories
# are of the form [SK]nn<init.d filename> where 'S' means start this job,
# 'K' means kill this job, and 'nn' is the relative sequence number for
# killing or starting the job. When entering a state (init 0,2,3, etc.),
# the rc[0-6] script executes those scripts in /etc/rc[0-6].d that are
# prefixed with 'K' followed by those scripts prefixed with 'S'.
#
# EXAMPLE: When changing to init state 2 (default multi-user mode),
# /etc/rc2 is initiated by the init process. The following
# steps are performed by /etc/rc2:
#
# 1. In the directory /etc/rc2.d are files used to stop processes
# that should not be running in state 2. The filenames
# are prefixed with 'K'. Each 'K' file in the directory is
# executed (by /etc/rc2) in alpha-numeric order when the system
# enters init state 2 (see example under next item).
#
# 2. Also in the /etc/rc2.d directory are files used to start
# processes that should be running in init state 2. As in the step
# above, each 'S' file is executed in alpha-numeric order.
#
# Example:
#
# The file /etc/init.d/network is a script that will
# initiate networking daemons when given the argument
# 'start', and will terminate the daemons if given the
# argument 'stop'. It is linked to /etc/rc2.d/S30network
# and to /etc/rc0.d/K40network. The file is executed by
# '/etc/rc2.d/S30network start' when init state 2 is
# entered and by '/etc/rc0.d/K40network stop' when
# shutting the system down.
#
#
# NOTE: /etc/rc2 has references to the obsolescent 'rc.d' directory.
# These references are for compatibility with old INSTALL scripts. New
# INSTALL scripts should use the init.d directory for related
# executables. The same is true for the shutdown.d directory.

128
eoe/cmd/initpkg/init.d/aliases-ip Executable file
View File

@@ -0,0 +1,128 @@
#!/bin/sh
# $Revision: 1.8 $
#
# NAME
# aliases-ip - configure network IP aliases
#
# SYNOPSIS
# /etc/init.d/aliases-ip ( start | stop ) [ debug ]
#
# DESCRIPTION
# This script automates the configuration of IP address aliases for
# network interfaces.
#
# The file /etc/config/ipaliases.options contains the list of hosts or
# IP addresses to be used as IP address aliases. The format of
# this file is:
#
# interface host1 [netmask addr] [broadcast addr]
# interface host2 [netmask addr] [broadcast addr]
# ...
# interface host3 [netmask addr] [broadcast addr]
#
# hosti is either a valid hostname in /etc/hosts or is a "dot"
# notation IP address as in 192.22.33.44. The interface should be
# the interface name as reported by netstat -i which will support
# the alias (i.e. ec0, ec3, et cetera).
#
# NOTE:
# If you have previously installed the PPP IP alias interim solution
# then you will have a ppp ip alias data file named "/etc/ip-aliases.tab'
# which is in the wrong format and location.
# To convert this file to the new format, run the following command lines
# The shell variable 'interface' should be set to the name of the network
# interface on which you want the new alias'es to be assigned.
#
# OLD=/etc/ipaliases.tab
# NEW=/etc/config/ipaliases.options
# interface=ec0
#
# while read alias
# do
# stuff=`echo $alias | sed -e 's/^#.*//'`
# test -n "$stuff" && echo "$interface $stuff" >> $NEW
# done < $OLD
#
# FILES
# /etc/hosts # host table file
# /etc/config/ipaliases.options
# # table of IP addresses to configure.
# /etc/config/ipaliases # chkconfig control file for ipaliases startup
# /etc/config/network # chkconfig control file for network startup
#
# SEE ALSO
# chkconfig(1M), ifconfig(1M), netstat(1), routed(1M)
#
# COPYRIGHT NOTICE
# Copyright (C) 1995, Silicon Graphics. All Rights Reserved.
#
#
# Configuration variables
#
IPALIASES_TABLE="/etc/config/ipaliases.options"
#
# Convenience macros
#
IS_ON="/sbin/chkconfig"
IFCONFIG="/usr/etc/ifconfig"
#
# If "debug" is passed as second argument, enable output of noisy commands
# to stdout/stderr. Otherwise redirect extraneous output to /dev/null.
#
if test "$2" = "debug" || $IS_ON verbose ; then
DBGOUT="/dev/fd/1"
DBGERR="/dev/fd/2"
else
DBGOUT="/dev/null"
DBGERR="/dev/null"
fi
#
# "main" body. Handle "start|stop".
#
case $1 in
"start")
if $IS_ON network && $IS_ON ipaliases; then
#
# Get hosts from ipaliases.tab. Parse out # comments which begin
# in first column.
#
while read line
do
ipaliases=`echo $line | sed -e 's/[ ]*#.*$//' -e '/^$/d' `
if test -z "$ipaliases" ; then
continue;
fi
read interface host restofline <<-EOF
$ipaliases
EOF
/sbin/suattr -C CAP_NETWORK_MGT+ip -c "$IFCONFIG $interface alias $host $restofline" && echo "Adding alias $host to interface $interface" > $DBGOUT;
done < $IPALIASES_TABLE
fi
;;
"stop")
if $IS_ON network && $IS_ON ipaliases; then
#
# Get hosts from ipaliases.tab. Parse out # comments which begin
# in first column.
#
while read line
do
ipaliases=`echo $line | sed -e 's/[ ]*#.*$//' -e '/^$/d' `
if test -z "$ipaliases" ; then
continue;
fi
read interface host restofline <<-EOF
$ipaliases
EOF
/sbin/suattr -C CAP_NETWORK_MGT+ip -c "$IFCONFIG $interface delete $host" && echo "Deleting alias $host to interface $interface" > $DBGOUT;
done < $IPALIASES_TABLE
fi
;;
esac

View File

@@ -0,0 +1,29 @@
#! /sbin/sh
#
# Announce - Display startup and shutdown anouncements
#
# On some machines, the message is displayed in an alert
# window.
#
# $Revision: 1.10 $
if chkconfig verbose
then
LOGGER='/sbin/lfmt -s info'
else
LOGGER='/sbin/lfmt -s info -G 1'
fi
NOMSGSEVERITY=1 export NOMSGSEVERITY
case $1 in
'start')
$LOGGER "The system is coming up.\n"
;;
'stop')
$LOGGER "The system is shutting down.\nPlease wait.\n"
;;
'restart')
$LOGGER "The system is being restarted.\n"
;;
esac

View File

@@ -0,0 +1,149 @@
#!/sbin/sh
#Tag 0x00000800
#
# Automatically re-configure the kernel. This script uses the
# /etc/config/autoconfig.options file to tell lboot to either
# prompt for permission to reconfigure the kernel or not. The
# default autoconfig.options file contains a '-T', which indicates
# to lboot to reconfigure the kernel without prompting for
# permission. A 't' indicates to lboot to prompt for permission
# first.
#
# When autoconfig runs at system startup, it uses -T or -t to indicate
# to lboot that it should use 'Smart' mode. In 'Smart' mode, lboot
# determines whether or not it should build a new kernel by looking
# at the dates of files in /var/sysgen and comparing to the date of
# /unix. In 'Smart' mode, lboot also auto-registers dynamically loadable
# kernel modules, such as tpsc, hpcplp, hpc3plp, ticlts, dial, sball,
# tablet, wacom, etc.
#
# If the LBOOTOPTS below are changed, so that they don't pass -T or -t
# to lboot, autoconfig will not perform its 'Smart' mode tasks, as
# described above.
#
# "$Revision: 1.52 $"
LBOOTOPTS=
FORCE=
LD_LIBRARY_PATH=
#
# If autoconfig.options is 0 or is missing, then default to -T.
# Also, if it contains bogus information, default to -T.
#
if [ -f /etc/config/autoconfig.options ]; then
FORCE=`cat /etc/config/autoconfig.options 2> /dev/null`
else
FORCE=""
fi
if test "$FORCE" = ""; then
FORCE="-T"
fi
TARGET=${UNIX:=/unix}
USAGE="`basename $0`: [-vf] [-p toolroot] [-d /var/sysgen] [-o lbootopts] [start|stop]"
while getopts "vnfp:d:o:" c; do
case $c in
v) if test "$verbose" = "-v"; then
set -x
else
verbose="-v"
LBOOTOPTS="$LBOOTOPTS -v"
fi
;;
n) LBOOTOPTS="$LBOOTOPTS -e";;
f) FORCE=""
TARGET=${TARGET}.install;;
p) TOOLROOT="$OPTARG";;
d) SYSGEN="$OPTARG";;
o) if test "$OPTARG" = "-t" -o "$OPTARG" = "-T"; then
FORCE=$OPTARG
else
LBOOTOPTS="$LBOOTOPTS $OPTARG"
fi
;;
\?) echo $USAGE; exit 1;;
esac
done
shift `expr $OPTIND - 1`
SYSGEN=${SYSGEN:-/var/sysgen}
BOOTAREA=${BOOTAREA:-${SYSGEN}/boot}
SYSTEM=${SYSTEM:-${SYSGEN}/system}
MASTERD=${MASTERD:-${SYSGEN}/master.d}
STUNEFILE=${STUNEFILE:-${SYSGEN}/stune}
MTUNEDIR=${MTUNEDIR:-${SYSGEN}/mtune}
WORKDIR=${WORKDIR:-${SYSGEN}}
# TOOLROOT and ROOT control where lboot looks for tools and does its work
# TOOLROOT is normally set in the system file.
TOOLROOT=${TOOLROOT:-$SYSGEN/root}
export TOOLROOT
LBOOT=/usr/sbin/lboot
SETSYM=/usr/sbin/setsym
LBOOTOPTS="$LBOOTOPTS $FORCE -m $MASTERD -b $BOOTAREA -w $WORKDIR -s $SYSTEM -u $TARGET -c $STUNEFILE -n $MTUNEDIR"
cd /
case $1 in
""|start)
for nm in $LBOOT $TOOLROOT/usr/bin/cc $TOOLROOT/usr/bin/ld; do
if test ! -x $nm; then
echo "`basename $0`: cannot find $nm" 1>&2
exit 1
fi
done
for nm in $BOOTAREA $MASTERD $SYSTEM; do
if test ! -d $nm; then
echo "`basename $0`: cannot find $nm" 1>&2
exit 1
fi
done
# note - set -e in a case stmt doesn't work right in /bin/sh
rm -rf ${UNIX}.install
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "$LBOOT $LBOOTOPTS"
if [ $? != 0 ]
then
# dont print anything since a no answer to Automatically ..
# causes lboot to exit 1
exit 1
fi
#
# The following puts labels on files created in ${SYSGEN}
# while in the mini-root when trix is installed.
#
if [ -f $BOOTAREA/mac.a ] ; then
echo "labeling ${SYSGEN}" 1>&2
/sbin/suattr -C all=epi -c "/usr/bin/find ${SYSGEN} -follow -print |xargs /sbin/attrinit -mac=dblow" > /dev/null
fi
if test -w ${UNIX}.install; then
chmod a+r ${UNIX}.install
if test -x $SETSYM ; then
$SETSYM ${UNIX}.install > /dev/null 2>&1
# Ignore any error return from setsym, so autoconfig
# will not exit non-zero if setsym has a problem.
true
fi
fi
;;
stop)
exit 1
;;
*)
echo "$USAGE"
exit 1
;;
esac

View File

@@ -0,0 +1 @@
-T

View File

@@ -0,0 +1,77 @@
#! /sbin/sh
#Tag 0x00000f00
# Check for devices that should exist after a reboot; to catch
# devices installed (or removed) since the last system boot.
# Must follow autoconfig, as the devices may have loadable drivers.
# "$Revision: 1.23 $"
case "$1" in
'start')
cd /dev
# create plp devices before running ioconfig in case permissions
# are changed in /etc/ioperms
if [ -d "/hw/parallel" -a ! -L /dev/plp ]; then
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV plp" 2>&1 | logger -t MAKEDEV_plp &
fi
#
# Before generating any devices, run ioconfig.
# -2 option tells ioconfig to prune down the hwgraph file tree walk.
#
/sbin/suattr -C CAP_MAC_READ,CAP_MAC_WRITE,CAP_MKNOD+ipe -c "/sbin/ioconfig -f /hw"
# we always do this now, so that all the tape devices get made, automatically
# not just the first one on the system. It also removes any tape
# devices that are no longer present. Tape devices that are OK aren't modified
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV tape" 2>&1 | logger -t MAKEDEV_tape &
# Create tty and input device symlinks
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV ttys" 2>&1 | logger -t MAKEDEV_ttys &
# same for floppies, since we now make /dev/rdsk/fds* only for
# actually installed floppies.
hinv -c disk | ( IFS="$IFS:" ; while read d dr s r m u targ o s c ctlr rest; do
if [ "$d" = Disk -a "$dr" = drive -a "$r" = removable -a "$m" = media -a "$s" = SCSI ] ; then
if [ ! -c /dev/rdsk/fds${ctlr}d${targ}.3.5 ] ; then
echo Creating floppy devices
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV fds" 2>&1 | logger -t MAKEDEV_fds &
break
fi
fi
done )
# if a diskless inst is done, we need to make audio devices here
# since kdsp is loadable now and does not show up in hinv when
# MAKEDEV is run out of /etc/bcheckrc after a diskless inst.
case "`hinv -c audio`" {
*Audio*) if [ ! -c /dev/hdsp/hdsp0control ] ; then
echo Creating audio devices
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV hdsp" 2>&1 | logger -t MAKEDEV_hdsp &
fi
;;
}
# DIVO video has audio capability, but hinv -c audio doesn't
# show it...
case "`hinv -c video`" {
*"DIVO Video"*) if [ ! -c /dev/hdsp/hdsp0control ] ; then
echo Creating audio devices
/sbin/suattr -C CAP_DEVICE_MGT+ipe -c "./MAKEDEV hdsp" 2>&1 | logger -t MAKEDEV_hdsp &
fi
;;
}
;;
'stop') # nothing to do on stop
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

194
eoe/cmd/initpkg/init.d/configmsg Executable file
View File

@@ -0,0 +1,194 @@
#!/sbin/sh
#Tag 0x00000f00
# The software installation will leave a message, and versions will give
# a zero exit status, if installation has altered one or more configuration
# files. Print the message, which is a reminder to the user to go find
# them and resolve the differences.
#
# Also search for directories that have been moved aside due to the
# filesystem re-org, and inform the user about such.
#
# Also rebuild the man page database for whatis/apropos after anything
# installed or removed.
MSG=/var/inst/.config_changed
MSGTIMER=/var/inst/.change_cnt
msgfile=uxsgicore
LIMIT=13
# sgindexAdmin (infosearch)
#
# If infosearch is installed, check each domain (bks, man, relnotes)
# to see if the index is older than the history file. If so, update
# that index (read in data from any new or changed files). If the
# index is missing or /var/inst/hist is missing, do nothing.
# This followings the exact same logic as the mkwhatis check,
# except that it's internal to sgindexAdmin and checked for
# each content domain.
#
# For the man domain, if the man index exists, use the title
# information in the index to update whatis instead of reading
# the first 4k of every man page. In this case, after sgindexAdmin
# is run successfully, whatis will be newer than the hist file and
# we skip running mkwhatis.
# mkwhatis
#
# rebuild the man page apropos/whatis database after an install
# or if whatis doesn't exist. Don't do it if /var/inst/hist doesn't
# exist (stat returns only one value, and whatis does exist) because
# that probably means a user removed it because of disk space, and we
# would run makewhatis on every boot until hist was recreated.
# outer >/dev/null is in case neither file exists
( if [ -x /usr/lib/infosearch/bin/sgindexAdmin ]; then
/sbin/nice -20 /usr/lib/infosearch/bin/sgindexAdmin -instchk 2>&1 \
| logger -t sgindexAdmin
fi
set `/sbin/stat -mq /var/inst/hist /usr/share/catman/whatis 2>/dev/null` >/dev/null
if [ ! -s /usr/share/catman/whatis -o \( "$2" -a "$1" -gt "$2" \) ]
then
logger -t makewhatis man page database out of date with install history
/sbin/nice -20 /usr/lib/makewhatis -s 2>&1 | logger -t makewhatis
logger -t makewhatis man page database build finished;
fi ) &
# Check for configuration file changes
if test ! -r $MSG -o ! -x /usr/sbin/versions
then exit 0 # don't check for dirs either, if versions isn't there.
# or we have already resolved config files and removed $MSG
fi
cnt=`cat $MSGTIMER 2>/dev/null`
cnt=`expr ${cnt:=0} + 1`
echo $cnt > $MSGTIMER 2>/dev/null
if test $cnt -le $LIMIT && /usr/sbin/versions -t changed>/dev/null; then
gettxt ${msgfile}:1137 '\nSoftware installation has installed new configuration files and/or saved\nthe previous version in some cases. You may need to update or merge\nold configuration files with the newer versions. See the "Updating\nConfiguration Files" section in the versions(1M) manual page for details.\nThe shell command "versions changed" will list the affected files.\n\n' | \
logger -s -t inst
if chkconfig visuallogin; then
# give user a chance to see the message before pandora
sleep 5
fi
else
rm -f $MSG $MSGTIMER
exit 0 # that's enough times to check for directories also
fi
# Check for moved-aside directories.
BANNERPRINT=0
DIRS='
/usr/Cadmin/classes.O
/usr/CaseVision.O
/usr/Insight/lib/data/config/C.O
/usr/Insight/lib/data/entities.O
/usr/Insight/library/SGI_bookshelves/SGI_Admin/books/SiteAdmin/styles.O
/usr/Insight/library/SGI_bookshelves/SGI_EndUser/books/IRISEssentials/styles.O
/usr/Insight/library/SGI_bookshelves/SGI_EndUser/books/PerSysAdmin/styles.O
/usr/Insight/library/SGI_bookshelves/SGI_EndUser/books/ShowcaseUG/styles.O
/usr/Insight/library/SGI_bookshelves/SGI_EndUser/books/Utilities/styles.O
/usr/Insight/library/SGI_bookshelves/SGI_EndUser/books/glossary/styles.O
/usr/WorkShop.O
/usr/adm.O
/usr/catman/u_man/cat1/explorer.O
/usr/demos/bin.O
/usr/diags/crash/Sproc.O
/usr/etc/boot.O
/usr/etc/dn.O
/usr/etc/named.d.O
/usr/etc/yp.O
/usr/frame/.fminit2.0.O
/usr/frame/docs.O
/usr/frame/fmtemplates.O
/usr/gfx/CLOVER2/lib/IP7GT.O
/usr/gfx/libgl/EXPRESSEXPRESS/libGL.so.O
/usr/gfx/libgl/EXPRESSEXPRESS/libGLcore.so.O
/usr/gfx/libgl/LIGHTLG1MC.O
/usr/gfx/libgl/LIGHTLIGHT.O
/usr/gfx/ucode/SKYWR/vof.O
/usr/gfx/ucode/VGX/vof.O
/usr/include/DPS.O
/usr/include/Mrm.O
/usr/include/NCC.O
/usr/include/Vk.O
/usr/include/X11/Mrm.O
/usr/include/X11/Xirisw.O
/usr/include/X11/Xm.O
/usr/include/X11/uil.O
/usr/include/Xm.O
/usr/include/make.O
/usr/include/oz.O
/usr/include/uil.O
/usr/lib/DPS/AFM.O
/usr/lib/DPS/outline/base.O
/usr/lib/Insight.O
/usr/lib/TeamVision.O
/usr/lib/X11.O
/usr/lib/X11/Schemes.O
/usr/lib/X11/app-defaults/XClipboard.O
/usr/lib/X11/app-defaults/Xmh.O
/usr/lib/X11/ja_JP.EUC/schemes/Base.O
/usr/lib/X11/schemes/Base.O
/usr/lib/X11/schemes/FaxMgr.O
/usr/lib/X11/schemes/Lascaux.O
/usr/lib/cron.O
/usr/lib/dict.O
/usr/lib/font/devX100.O
/usr/lib/images.O
/usr/lib/locale/de_AT/LC_MESSAGES.O
/usr/lib/locale/de_CH/LC_MESSAGES.O
/usr/lib/locale/fr_BE/LC_MESSAGES.O
/usr/lib/locale/fr_CA/LC_MESSAGES.O
/usr/lib/locale/fr_CH/LC_MESSAGES.O
/usr/lib/onlineHelp.O
/usr/lib/onlineHelp/CaseVision.O
/usr/lib/sounds.O
/usr/lib/terminfo.O
/usr/lib/tmac.O
/usr/lib/wnn/dic.O
/usr/mail.O
/usr/preserve.O
/usr/relnotes/motif_dev.O
/usr/relnotes/motif_eoe.O
/usr/sbin/r4kpp.O
/usr/spool.O
/usr/sysgen.O
/usr/sysgen/system.O
/usr/tmp.O
/usr/var/X11/input.O
/usr/var/adm/lastlog.O
/usr/var/config.O
/usr/var/inst.O
/usr/var/mail.O
/usr/var/sna/log.O
/usr/var/spool.O
/usr/var/spool/mqueue.O
/usr/var/sysgen/boot.O
/usr/var/sysgen/root.O
/usr/var/tmp.O
'
for dir in $DIRS; do
if test -d $dir; then
# grumble. These dirs are unlikely to hold user modified info. If they did,
# tough. That's what backups are for.
if test $dir = "/usr/include/X11/Mrm.O" -o \
$dir = "/usr/include/X11/Xirisw.O" -o \
$dir = "/usr/include/X11/Xm.O" -o \
$dir = "/usr/include/X11/uil.O" -o \
$dir = "/usr/lib/sounds.O" -o \
$dir = "/usr/lib/terminfo.O" -o \
$dir = "/usr/var/inst.O" -o \
$dir = "/usr/diags/crash/Sproc.O" -o \
$dir = "/usr/lib/cron.O" ; then
rm -rf $dir
continue
fi
if test $BANNERPRINT -ne 1; then
gettxt ${msgfile}:1138 'These directories were unable to be moved properly during the\ninstallation process. Check for any user-modified files, then\ndelete the directories.\n' | \
logger -s -t inst
BANNERPRINT=1
fi
logger -s -t inst " $dir"
fi
done

68
eoe/cmd/initpkg/init.d/cron Executable file
View File

@@ -0,0 +1,68 @@
#! /sbin/sh
#Tag 0x00000f00
# cron control
# "$Revision: 1.23 $"
DIR=/etc/cron.d
OPTIONS=/etc/config/cron.options
case $1 in
'start')
for name in at cron
do
cfgfile=$DIR/${name}.cfg
if [ -r $cfgfile ]
then
grep '^configured$' $cfgfile 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
cat <<- EOF >$cfgfile
# This file records whether the
# cron and at allow/deny files have
# been configured, and to disambiguate
# the presence/absence of those files.
configured
EOF
if [ -r $DIR/${name}.allow -o -r $DIR/${name}.deny ]
then
# from a previous install - leave alone
continue
else
touch $DIR/${name}.deny
fi
fi
else
cat <<- EOF >$cfgfile
# This file records whether the
# cron and at allow/deny files have
# been configured, and to disambiguate
# the presence/absence of those files.
configured
EOF
if [ -r $DIR/${name}.allow -o -r $DIR/${name}.deny ]
then
continue;
fi
touch $DIR/${name}.deny
fi
done
if test -x /sbin/cron; then
trap "" 15 # do not kill ourself,
killall 15 cron # but prevent 2 crons
rm -f /etc/cron.d/FIFO
/sbin/suattr -C CAP_SETGID,CAP_SETUID,CAP_AUDIT_CONTROL,CAP_AUDIT_WRITE,CAP_MAC_RELABEL_OPEN,CAP_MAC_RELABEL_SUBJ,CAP_MAC_MLD,CAP_MAC_READ+ip -c "/sbin/cron ""`cat $OPTIONS 2> /dev/null`"
fi
;;
'stop')
/sbin/killall 15 cron
;;
*)
echo "usage: /etc/init.d/cron {start|stop}"
;;
esac

View File

@@ -0,0 +1,51 @@
#! /sbin/sh
#Tag 0x00000f00
is_deskside ()
{
maxslot=0
hinv -c iobd | grep Ebus | sed "s/://g" | ( \
while read io brd ebus slot slotnum io4 rev revnum; do
if [ $slotnum -gt $maxslot ]; then
maxslot=$slotnum;
fi;
done;
if [ $maxslot -gt 0 -a $maxslot -lt 11 ]; then
echo 1
else
echo 0
fi)
}
case "$1" in
'start')
# check to see if any drives need firmware downloaded, on powerup
# This is to handle any drives moved from another system, etc.,
# This just warns if any drives should be upgraded.
/sbin/diskpatch -W
;;
'stop')
# if we are rebooting, then don't spin down any of the drives.
# otherwise spin down all of the drives that benefit from this
set "`/sbin/who -r`"
if [ "$7" != "6" ]
then
if hinv -c iobd | grep IO4 > /dev/null
then # [Power] Challenge/Onyx DM/L/XL (EVEREST Machines)
if [ `is_deskside` -eq 1 ]; then
spinagain=-S11
else
spinagain=-S5
fi
elif [ "`hinv -c disk | grep 'Disk.*controller *[1-4]' | wc -l`" -gt 3 ]
then
# challenge S, jag or indigo2/challenge M w/external drives
spinagain=-S4
fi
/sbin/diskpatch -H 20 $spinagain
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

View File

@@ -0,0 +1,49 @@
#!/sbin/sh
#ident /etc/init.d/failover: $Revision: 1.2 $
#
# Process failover configuration table.
# Called by /etc/init.d/xlv.
#
assemble=false
doit=false
cd /
case $1 in
init)
keep=-k
assemble=false
doit=true
;;
stop)
doit=false
;;
""|start)
keep=-k
assemble=true
doit=true
;;
esac
if [ '(' -x /sbin/xlv_assemble -o -x /sbin/xvm ')' -a "$doit" = "true" ] ; then
if [ -f /etc/failover.conf ] ; then
if [ -x /sbin/foconfig ] ; then
if /sbin/chkconfig verbose ; then
echo "Configuring Failover."
fi
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/foconfig \
$keep -f /etc/failover.conf"
fi
fi
if [ "$assemble" = "true" ] ; then
if [ -x /sbin/xlv_assemble ] ; then
if /sbin/chkconfig verbose ; then
echo "Calling xlv_assemble."
fi
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_assemble \
1> /dev/null 2> /dev/null"
fi
fi
fi

View File

@@ -0,0 +1,64 @@
#ident $Revision: 1.1 $
#
# This is the configuration file for table driven failover support.
# The entries within this file consist of a single line per
# failover grouping. These lines describe up to four paths to
# each device. Obviously, these paths should reference the
# same device! Some sanity checking is performed, but the
# software is not foolproof in this area. (If it was foolproof,
# the configuration file would be unnecessary!) It is recommended
# that all paths to a device be listed.
#
# The format of each line consists of a group name followed by
# up to four device names from the "/dev/scsi" directory. If
# it's not in "/dev/scsi", it cannot be configured. But, this
# implementation assumes that if a device is not present, its
# path has failed. Consequently, no error messages will be
# generated for missing paths. This means that you may have a
# a failover group that consists of a single primary path with
# no alternates.
#
# Additionally, there is a configuration directive available that
# will cause the program to emit debug information. Placing
# "#verbose" at the start of a line, without the quotes, will
# enable the debug output. The debug output is displayed for
# all subsequent configuration directives. Once enabled, the
# debug output cannot be disabled.
#
# Lines that begin with a "#" are considered comment lines.
# A "#" anywhere within a line signals the beginning of a comment.
# White space must separate the last parameter of a line and the #.
# Blank lines are also considered a comment.
#
# --> Lines that begin with 'sc' will be skipped as it's likely a
# --> configuration error.
#
# Sample configuration. (Remember to omit the "#" the start of
# the line.)
#
#
# # Name Pri path | alt path | alt path | alt path
#
# GroupA sc6d50l0 sc7d50l0 sc8d50l0 sc9d50l0
# GroupB sc6d51l0 sc7d51l0 sc8d51l0 sc9d51l0 # Some comment
# GroupC sc6d52l0 sc7d52l0 sc8d52l0 sc9d52l0
#
# One word of caution. The switch to an alternate path is
# choreographed by XLV. XLV is a requirement for failover to
# function.
#
# Notes:
#
# It is not possible to change the primary device of a group after
# the initial configuration by reordering the entries on the line
# and running /etc/init.d/failover start. To change the primary,
# scsifo may be used to switch to the next available path.
#
# It is not possible to remove the primary of a group by deleting
# the entry from the group and running /etc/init.d/failover start.
# A reboot is necessary.
#
# To remove the "DOWN" displayed by hinv for the failed path,
# fix the path and reprobe the bus using scsiha -p #.
#

View File

@@ -0,0 +1,124 @@
#! /sbin/sh
#Tag 0x00000f00
# (u)mount file systems
# "$Revision: 1.50 $"
cd /
case $1 in
'start')
# The /usr filesystem MAY HAVE BEEN mounted earlier earlier so
# that unbundled products would have a chance to execute any
# initialization code after mounting /usr but before mounting
# the rest of /etc/fstab.
#
# Mount any filesystems listed in /etc/fstab that we haven't
# yet mounted. Note that this may include /usr if we haven't
# already mounted it.
#
if /sbin/chkconfig verbose
then
echo "Mounting filesystems:"
fi
# Mount file systems according to file system table /etc/fstab.
# check all filesystems if necessary, in parallel.
if [ -x /sbin/fsck ] ; then
/sbin/fsck -m -c -y | grep -v 'mounted file system, ignored'
fi
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -a -T efs,xfs"
then
if test -s /etc/kernel_config2; then
/etc/kernel_config2
fi
else
lfmt -G 1 'Some filesystems failed to mount; may be unable to reach multiuser state\n'
sleep 5
fi
# mv /tmp to /.oldtmp and create a new /tmp unless the existing
# /tmp or any of its subdirectories is a mount point, or unless /tmp
# is a symbolic link. In these cases, just leave /tmp alone.
chkconfig nocleantmp
if test $? = 1 -a -d /tmp -a ! -L /tmp ; then
# 2 tests because we don't want to run the command part, and
# the shell does the command substitution stuff before running
# test, and we don't want to get "/tmp: No such file or directory"
# when /tmp doesn't exist (as is the case in the miniroot.
if test -z "`/sbin/mount | grep ' on /tmp[/ ]'`" \
-a "`ls -la /tmp | wc -l`" -gt 3; then
# Any existing /.oldtmp means we somehow didn't remove
# it in rmtmpfiles or perhaps never even ran rmtmpfiles
# last time we booted. It might contain good stuff.
if test -d /.oldtmp; then
ls -a1 /tmp | sed -e '/^\.$/d' -e '/^\.\.$/d' | xargs -i rm -rf /.oldtmp/{}
ls -a1 /tmp | sed -e '/^\.$/d' -e '/^\.\.$/d' | xargs -i mv /tmp/{} /.oldtmp
else
/sbin/suattr -m -C CAP_MAC_WRITE,CAP_MAC_READ+ipe -c "rm -rf /.oldtmp"
/sbin/suattr -m -c "mv /tmp /.oldtmp"
mkdir /tmp
if test "`sysconf MAC`" -eq 1; then
chlabel -m /tmp
fi
fi
# do same as rmtmpfiles, for consistency
if chkconfig nostickytmp; then
/sbin/suattr -m -C CAP_FOWNER+eip -c "chmod 777 /tmp /var/tmp"
else
/sbin/suattr -m -C CAP_FOWNER+eip -c "chmod 1777 /tmp /var/tmp"
fi
/sbin/suattr -m -C CAP_FOWNER+eip -c "chown sys.sys /tmp /var/tmp"
fi
fi
# Clear nsd cache files
# DO NOT use su to invoke capabilites.
chkconfig noclearnsd
if test $? = 1 -a -x /sbin/mdbm_remove -a -d /var/ns/cache ; then
/sbin/mdbm_remove /var/ns/cache/* 2>/dev/null
fi
# Apply extended attributes to any newly installed files.
if test -x /sbin/attrinit; then
NOW=`date +%y%m%d%H%M`
if test -r /etc/irix.mac.install ; then
echo "Initializing XFS MAC attributes."
cd /
/sbin/suattr -C CAP_MAC_READ,CAP_DAC_READ_SEARCH,CAP_DAC_WRITE,CAP_MAC_WRITE,CAP_DEVICE_MGT+ip -c "/sbin/attrinit -script=/etc/irix.mac.install -verbose"
mv /etc/irix.mac.install /etc/irix.mac.$NOW
fi
if test -r /etc/irix.cap.install ; then
echo "Initializing XFS CAP attributes."
cd /
/sbin/suattr -C CAP_MAC_READ,CAP_DAC_READ_SEARCH,CAP_DAC_WRITE,CAP_MAC_WRITE,CAP_DEVICE_MGT+ip -c "/sbin/attrinit -script=/etc/irix.cap.install -verbose"
mv /etc/irix.cap.install /etc/irix.cap.$NOW
fi
fi
;;
'stop')
if /sbin/chkconfig verbose
then
echo "Unmounting filesystems:"
fi
sync
_DLMNTS=""
if [ "`/sbin/nvram diskless 2> /dev/null`" -eq 1 ] ; then
_DLMNTS=",/swap,/sbin"
fi
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/umount -ak -b /var,/usr,/debug,/proc,/hw,/dev/fd${_DLMNTS}"
sync
;;
*)
echo "usage: /etc/init.d/filesystems {start|stop}"
;;
esac

View File

@@ -0,0 +1,72 @@
#! /bin/sh
#Tag 0x00000f00
# (u)mount file systems other than /usr
# "$Revision: 1.12 $"
cd /
case $1 in
'start')
# The /usr filesystem is mounted earlier earlier so that unbundled
# products have a chance to execute initialization code between
# mounting /usr and mounting the rest of /etc/fstab.
#
# Mount all the rest of the filesystems listed in /etc/fstab
# (ie: beyond / and /usr).
#
if /sbin/chkconfig verbose
then
echo "Mounting filesystems:"
fi
# mv /tmp to /.oldtmp and create a new /tmp unless the existing
# /tmp or any of its subdirectories is a mount point, or unless /tmp
# is a symbolic link. In these cases, just leave /tmp alone.
chkconfig nocleantmp
if test $? = 1 -a -d /tmp -a ! -L /tmp ; then
# 2 tests because we don't want to run the command part, and
# the shell does the command substitution stuff before running
# test, and we don't want to get "/tmp: No such file or directory"
# when /tmp doesn't exist (as is the case in the miniroot.
if test -z "`/sbin/mount | grep ' on /tmp[/ ]'`" \
-a "`ls -la /tmp | wc -l`" -gt 3; then
# Any existing /.oldtmp means we somehow didn't remove
# it in rmtmpfiles or perhaps never even ran rmtmpfiles
# last time we booted. It might contain good stuff.
if test -d /.oldtmp; then
ls -a1 /tmp | sed -e '/^\.$/d' -e '/^\.\.$/d' | xargs -i rm -rf /.oldtmp/{}
ls -a1 /tmp | sed -e '/^\.$/d' -e '/^\.\.$/d' | xargs -i mv /tmp/{} /.oldtmp
else
/sbin/su root -m -C CAP_MAC_WRITE,CAP_MAC_READ+ipe -c "rm -rf /.oldtmp"
/sbin/su root -m -c "mv /tmp /.oldtmp"
/sbin/su root -m -c "mkdir /tmp"
fi
# do same as rmtmpfiles, for consistency
if chkconfig nostickytmp; then
/sbin/su root -m -c "chmod 777 /tmp /var/tmp"
else
/sbin/su root -m -c "chmod 1777 /tmp /var/tmp"
fi
/sbin/su root -m -C CAP_FOWNER+eip -c "chown sys.sys /tmp /var/tmp"
fi
fi
;;
'stop')
if /sbin/chkconfig verbose
then
echo "Unmounting filesystems:"
fi
sync
/sbin/su root -C CAP_MOUNT_MGT+ip -c "/sbin/umount -ak -b /usr,/debug,/proc,/hw"
sync
;;
*)
echo "usage: /etc/init.d/filesystems {start|stop}"
;;
esac

View File

@@ -0,0 +1,41 @@
#!/sbin/sh
#Tag 0x00000f00
#
# Start X Font Server
#
# $Revision: 1.10 $
#
IS_ON=/sbin/chkconfig
CONFIG=/var/X11/xfs/config
FS=/usr/bin/X11/xfs
if $IS_ON verbose ; then
ECHO=echo
else
ECHO=:
fi
case "$1" in
'start')
if $IS_ON fontserver; then
$ECHO "X Font Server setup: \c"
if test -x $FS; then
$ECHO "xfs\c"
/sbin/suattr -C CAP_NETWORK_MGT,CAP_MAC_RELABEL_OPEN,CAP_MAC_MLD,CAP_MAC_UPGRADE,CAP_MAC_DOWNGRADE+ip -c "$FS" &
else
$ECHO "can not execute $FS\c"
fi
$ECHO "."
fi
;;
'stop')
/sbin/killall -TERM xfs
;;
*)
echo "usage: /etc/init.d/fontserver {start|stop}"
;;
esac

View File

@@ -0,0 +1,42 @@
#! /sbin/sh
#Tag 0x00000f00
# GRIO control
# "$Revision: 1.10 $"
CONFIG=/etc/config
case $1 in
'start')
set `/sbin/who -r`
if [ $9 = "S" ]
then
#
# Terminate any running ggds.
#
killall ggd
#
# Start the label daemon
#
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/usr/sbin/ggd ""`cat $CONFIG/ggd.options 2> /dev/null`" &
fi
;;
'stop')
#
# Shutdown the ggd daemon.
#
if /sbin/chkconfig verbose ; then
echo "Shutting down GGD:"
fi
# Stop the label daemon
killall ggd
;;
*)
echo "usage: /etc/init.d/grio {start|stop}"
;;
esac

View File

@@ -0,0 +1 @@
on

View File

@@ -0,0 +1,34 @@
# This file (/etc/config/ipaliases.options) contains the list of hosts or
# IP addresses to be used as IP address aliases. The format of
# this file is:
#
# interface host1 [netmask addr] [broadcast addr]
# interface host2 [netmask addr] [broadcast addr]
# ...
# interface host3 [netmask addr] [broadcast addr]
#
# For example, using explict IP address'es
#
# ec0 192.111.26.51 netmask 0xffffff00 broadcast 192.111.26.255
#
# or using symbolic names:
# ec0 foobar netmask 0xffffff00 broadcast 192.111.26.255
#
# hosti is either a valid hostname in /etc/hosts or is a "dot"
# notation IP address as in 192.22.33.44. The interface should be
# the interface name as reported by netstat -i which will support
# the alias (i.e. ec0, ec3, et cetera).
#
# FILES
# /etc/hosts # host table file
# /etc/config/ipaliases.options
# # table of IP addresses to configure.
# /etc/config/ipaliases # chkconfig control file for ipaliases startup
# /etc/config/network # chkconfig control file for network startup
#
# SEE ALSO
# chkconfig(1M), ifconfig(1M), netstat(1), routed(1M)
#
# COPYRIGHT NOTICE
# Copyright (C) 1995, Silicon Graphics. All Rights Reserved.
#

25
eoe/cmd/initpkg/init.d/lp Executable file
View File

@@ -0,0 +1,25 @@
#! /sbin/sh
#Tag 0x00000f00
# Start or stop the lp scheduler
# "$Revision: 1.10 $"
case "$1" in
'start')
if test -x /usr/lib/lpshut -a -x /usr/lib/lpsched; then
/usr/lib/lpshut > /dev/null 2>&1
rm -f /var/spool/lp/SCHEDLOCK /var/spool/lp/FIFO
/usr/lib/lpsched
fi
;;
'stop')
if test -x /usr/lib/lpshut; then
/usr/lib/lpshut > /dev/null 2>&1
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

32
eoe/cmd/initpkg/init.d/lv Executable file
View File

@@ -0,0 +1,32 @@
#! /sbin/sh
#Tag 0x00000f00
# LV control
# "$Revision: 1.6 $"
case $1 in
'start')
# If an lvtab is present, run lvinit;
# this must be done before any mounts since any non-root
# filesystem may be on a logical volume.
set `/sbin/who -r`
if [ $9 = "S" ]
then
if [ -f /etc/lvtab ] ; then
if /sbin/chkconfig verbose
then
echo "Starting LV:"
fi
/sbin/lvinit
fi
fi
;;
'stop')
;;
*)
echo "usage: /etc/init.d/lv {start|stop}"
;;
esac

View File

@@ -0,0 +1,24 @@
#! /sbin/sh
# machine dependent startup script for the IP30 (OCTANE) system.
# this script will be run once for each system boot.
#
# "$Revision: 1.1 $"
case "$1" in
'start')
# Transfer any logged information from the Flash PROM into SYSLOG.
# see flash(1m) and syslog(1m) for more information.
/usr/sbin/flash -L
exit 0
;;
'stop')
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

217
eoe/cmd/initpkg/init.d/mail Normal file
View File

@@ -0,0 +1,217 @@
#! /sbin/sh
#Tag 0x00000f00
# Start sendmail demon after checking that things are healthy.
# $Revision: 1.63 $
CONFIG=/etc/config
IS_ON=/sbin/chkconfig
QUEUEDIR=/var/spool/mqueue
MAILDIR=/var/mail
G_RC=/usr/local/etc/mgmt/rc
if $IS_ON verbose ; then # For a verbose startup and shutdown
ECHO=echo
VERBOSE=-v
else # For a quiet startup and shutdown
ECHO=:
VERBOSE=
fi
if $IS_ON cap_su_off && test "`sysconf MAC`" -eq 1; then
CSU=csu_off
csu_off () {
while true; do
case "$1" in
-M) shift 2;;
-M?*) shift;;
-m) shift;;
-C) shift 2;;
-C?*) shift;;
*) break;;
esac
done
shift
eval $*
return
}
else
CSU="/sbin/suattr"
fi
CSU_DBADMIN="$CSU -M dbadmin"
CAP_SENDMAIL="CAP_PRIV_PORT+ip"
parse_args () {
OPTS=""
while true; do
case "$1" in
-q) DOPTS="$DOPTS $1$2"; shift 2;;
-q?*) DOPTS="$DOPTS $1"; shift;;
-bd) shift;;
"") break;;
*) OPTS="$OPTS $1"; shift;;
esac
done
if test "$DOPTS" = ""; then
DOPTS="-bd -q15m"
else
DOPTS="-bd $DOPTS"
fi
return
}
case "$1" in
'start')
$ECHO "Mailer daemons: \c"
# Choose sendmail options. The file might contain something like -om
# to turn on "metoo"
OPTS=`cat $CONFIG/sendmail.options 2>/dev/null`
# Force $G if Gauntlet appears to be installed.
if [ -f /etc/init.d/gauntlet ]; then
if expr "$OPTS" : "oMGgauntlet" >/dev/null; then
OPTS="$OPTS -oMGgauntlet"
fi
$G_RC/S100mail stop
fi
parse_args $OPTS
# Move to post office directory
if $CSU -m -c "test ! -d ${MAILDIR} -a ! -L ${MAILDIR}"; then
mkdir -m 775 ${MAILDIR}
if test "`sysconf MAC`" -eq 1; then
chlabel -m ${MAILDIR}
fi
fi
olddir="`pwd`"
cd ${MAILDIR}
if test $? = 0; then
cd ${olddir}
if test "`sysconf MAC`" -eq 1; then
files=`$CSU -m -C CAP_MAC_READ+ipe -c "echo ${MAILDIR}/[A-Z]-[a-z]*"`
for f in $files; do
label=`$CSU -m -C CAP_MAC_READ+ipe -c "ls -1Md $f" \
| awk '{print $2}' \
| sed -e 's!\[!!' -e 's!\]!!'`
if $CSU -M $label -c "test ! -d ${MAILDIR}/:saved"; then
$CSU -M $label -c "mkdir ${MAILDIR}/:saved"
fi
$CSU -M $label -C CAP_FOWNER+ipe \
-c "chown root ${MAILDIR}/. ${MAILDIR}/:saved ; \
/sbin/find ${MAILDIR}/. -local -exec chgrp mail {} \\; \
-exec chmod g+w {} \\;"
done
else
if test ! -d ${MAILDIR}/:saved ; then
mkdir -m 775 ${MAILDIR}/:saved
fi
$CSU -C CAP_FOWNER+ipe \
-c "chown root.mail ${MAILDIR}/. ${MAILDIR}/:saved ; \
/sbin/find ${MAILDIR}/. -local \
\\( ! -group mail -o ! -perm -020 \\) \
-exec chgrp mail {} \\; \
-exec chmod g+w {} \\;"
fi
fi
# Move to spool directory. Make sure the directory exists, and is of the
# proper permissions
if test ! -d /var/spool; then
mkdir /var/spool
fi
if $CSU_DBADMIN -c "test ! -d ${QUEUEDIR}/."; then
$CSU_DBADMIN -c "mkdir -m 755 ${QUEUEDIR}"
fi
$CSU_DBADMIN -C CAP_FOWNER+ipe -c "chmod 755 ${QUEUEDIR}/.; \
chown root.mail ${QUEUEDIR}/."
# Make sure that /usr/lib/sendmail is executable and setuid root
if test ! -x /usr/lib/sendmail; then
echo "mail: no /usr/lib/sendmail, can't use mail"
exit 255
fi
# check the alias data base
if test ! -r /etc/aliases; then
echo "mail: /etc/aliases is missing, can't use mail"
exit 255
fi
if test ! -r /etc/aliases.dir -o ! -r /etc/aliases.pag; then
touch /etc/aliases.dir /etc/aliases.pag
sleep 1
touch /etc/aliases
fi
# Make sure that /bin/mail is correct
if test ! -x /bin/mail; then
echo "mail: no /bin/mail, can't use mail"
exit 255
fi
if test ! -c /dev/log; then
echo "mail: syslogd is not running, /dev/log does not exist"
exit 255
fi
# kill any old daemons
$CSU_DBADMIN -c "/sbin/killall -15 sendmail"
# Clean up any old lock files
$CSU_DBADMIN -c "rm -rf ${QUEUEDIR}/[tnx]f*" >/dev/null 2>&1
# If both smap and sendmail chkconfig'ed on, smap does and should prevail.
if $IS_ON smap; then
if test ! -d /usr/spool/smap; then
mkdir -m 755 -p /usr/spool/smap
chown smap /usr/spool/smap
fi
# /etc/sendmail.fc necessary since sendmail is still delivery agent
if test -s /etc/sendmail.fc; then
(echo "Freezing sendmail.cf" ;
/usr/lib/sendmail -bz) | logger -t sendmail
fi
# ignore SIGHUP from init, so backgrounded demons will not be killed
trap "" 1
# smap and other Gauntlet support is delt with in the gauntlet mail
# startup script
if [ -f /etc/init.d/gauntlet ]; then
$G_RC/S100mail start
fi
elif $IS_ON sendmail; then
# start the daemon.
if test -s /etc/sendmail.fc; then
FRZ="echo Freezing sendmail.cf; /usr/lib/sendmail -bz; "
fi
# start in background because starting can take a while
$CSU_DBADMIN -C $CAP_SENDMAIL -c \
"$FRZ /usr/lib/sendmail $DOPTS $OPTS" \
| logger -t sendmail &
$ECHO "sendmail."
else
$ECHO "none."
fi
# rebuild aliases just in case, but after freezing sendmail.cf.
$CSU_DBADMIN -c "rm -f /etc/aliases.pag /etc/aliases.dir /etc/aliases.db"
newaliases >/dev/null &
;;
'stop')
$CSU_DBADMIN -c "/sbin/killall -15 sendmail"
if [ -f /etc/init.d/gauntlet ]; then
$G_RC/S100mail stop
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

View File

@@ -0,0 +1,89 @@
# netif.options:
#
# The network startup script, /etc/init.d/network, computes typical
# primary and gateway interface names and addresses for most systems.
# Netif.options provides a place for site-dependent network interface
# definitions. You need to modify this file only if:
# 1) the computed primary and/or gateway interface names are incorrect, or
# 2) you don't like the convention used to define addresses for interfaces, or
# 3) the host has more than 2 interfaces.
#
# /etc/init.d/network uses two variables to configure each interface.
# The script uses "if1name" and "if1addr" for the primary interface,
# "if2name" and "if2addr" for the first gateway interface, etc.
# By default, when an fddi interface is present, the network sets it
# to be the primary interface (if1name) and the primary ethernet interface
# to be the secondary (if2name). If you do not want this behavior, you
# must explictly set both if1name and if2name in this file, not just
# if1name (see below).
#
# An ifXname variable (where X=1,2,3...) is the interface's device name as
# reported by "/usr/etc/netstat -i". Valid names include ef0, eg0,
# rns0, rns1, ipg0, ipg1, atm0, atm1, etc., but NOT lo0.
#
# An ifXaddr variable is a hostname containing $HOSTNAME or a hostname
# in /etc/hosts or an IP address in dot notation. ($HOSTNAME is the host's
# name in /etc/sys_id.) By convention, gateway interfaces use the
# "gate-", "gate2-" and "gate3-" prefixes in front of $HOSTNAME.
# If you don't like this convention, change the appropriate ifXaddr variables.
# For the system to boot correctly, make sure that names specified in ifXaddr
# variables have entries in /etc/hosts.
# IMPORTANT: any ifXname variables not defined, or commented out, in
# /etc/config/netif.options will retain their default values chosen
# by the network startup script. Care should be taken not to assign
# such a default value to another ifXname without ensuring that the
# ifXname also referencing this interface is assigned a different
# name, since this can lead to unexpected results and possible loss
# of network connectivity. As an example, on a system which has
# an et interface and an ipg interface, the following netif.options
# would be wrong:
#
# # if1name commented out
# #if1name=ef0
# #if1addr=192.0.0.1
# # define if2name to be FDDI
# if2name=rns0
# if2addr=192.0.1.1
#
# since the system would choose the rns FDDI interface to be the default
# value for if1name and would subsequently try to configure it twice;
# as if1name and if2name.
# The following shell variables have the form "var=value", with no spaces
# before or after the = character (for example: if1name=fxp1).
# Lines with the leading : character are commented out.
# Append the interface name and remove the leading : to override
# the primary interface selection.
: if1name=
# To override the primary interface address, change the value part
# and remove the leading : character.
: if1addr=$HOSTNAME
# To override the name and/or address of the first gateway interface,
# change the value part and remove the leading : character.
: if2name=
: if2addr=gate-$HOSTNAME
# If this host has more than 2 interfaces, you must define values for
# if3name (and if4name if appropriate). Change if3addr (and if4addr) to
# the appropriate names in /etc/hosts if your site has different naming
# conventions.
if3name=
if3addr=gate2-$HOSTNAME
if4name=
if4addr=gate3-$HOSTNAME
# If this host has more than 8 network interfaces, set the number of
# interfaces that the network startup script will configure.
: if_num=8

View File

@@ -0,0 +1,934 @@
#!/sbin/sh
#Tag 0x00000f00
# Initialize/Shutdown the standard and optional network software.
#
# $Revision: 5.96 $
#
# If the IP address for this host is the default 192.0.2.1 Internet test
# address, the software is configured for loopback (standalone) mode.
# An Internet address other than the default must be chosen in order to
# configure the network properly. See the "Network Administration" chapter
# in the Network Communications Guide or details on selecting an address.
#
# NOTE: Defaults for network interface names and addresses can be changed by
# editting /etc/config/netif.options. Therefore, you don't need to edit
# this file.
#
# A daemon or subsystem is enabled if its configuration flag in the
# /etc/config directory in the "on" state. /sbin/chkconfig is used
# to test a flag's state (see chkconfig(1M) for details). If the flag
# file is missing, the flag is considered off.
#
# Flag Action if On
# network Allow incoming & outgoing traffic. This flag can be
# set off if you need to isolate the machine from
# network without removing cables.
# verbose Print name of daemons as they are started & other info
# gated Start Cornell routing daemon instead of BSD routed
# mrouted Start Stanford IP multicast routing daemon
# (Useful only on gateways)
# named Start 4.3BSD Internet domain name server
# rsvpd Start ISI RSVP daemon
# rwhod Start 4.3BSD rwho daemon
# timed Start 4.3BSD time synchronization daemon
# timeslave Start SGI time synchronization daemon
# hypernet Initialize HyperNET controller and routes
# routed Start 4.3BSD RIP routing daemon
# ipfilterd Enable SGI IP Packet Filtering daemon
#
# The following flags are installed only in the optional products:
#
# nfs Start NFS daemons, mount NFS filesystems
# autofs Start the NFS autofs daemon (overrides automount)
# automount Start the NFS automounter daemon
# lockd Start the NFS lock and status daemons
# pcnfsd Start the PC-NFS server daemon
# rarpd Start the Reverse ARP daemon
# snetd Start the DLPI daemon - snetd
# nsd Start the name service daemon - nsd
# ypmaster Become the NIS master; start passwd server
# 4DDN Initialize 4DDN (DECnet) software
#
# Site-dependent options for daemons belong in "options" files in /etc/config.
# Certain daemons require options so their options file must contain valid
# information. See the daemon's manual page in section 1M for details on
# valid options. If this host is on networks that use subnetting, add the
# appropriate 'netmask' to the ifconfig-*.options files (see ifconfig(1M) for
# details on netmasks).
#
# File Status
# autofs.options optional
# automount.options optional
# biod.options optional
# gated.options optional
# ifconfig-1.options optional (for primary network interface)
# ifconfig-2.options optional (for 1st gateway network interface)
# ifconfig-3.options optional (for 2nd gateway network interface)
# ifconfig-4.options optional (for 3rd gateway network interface)
# ifconfig-hy.options optional (for HyperNET interface)
# inetd.options optional
# lockd.options optional
# mrouted.options optional
# named.options optional
# netif.options optional (to select different primary &
# gateway interfaces, etc.)
# nfsd.options optional
# nsd.options optional
# portmap.options optional
# rarpd.options optional
# routed.options optional
# rpc.passwd.options optional
# rsvpd.options optional
# rwhod.options optional
# snetd.options optional
# static-route.options optional add static routes
# timed.options optional
# timeslave.options required
#
# In addition, site-dependent configuration commands related to networking
# should be put in a separate shell script called /etc/init.d/network.local.
# Make symbolic links in /etc/rc0.d and /etc/rc2.d to this file to have it
# called during system startup and shutdown:
# ln -s /etc/init.d/network.local /etc/rc0.d/K39network # before network
# ln -s /etc/init.d/network.local /etc/rc2.d/S31network # after network
# The script is called with one argument ("start" or "stop").
#
#
# Copyright 1988-1995 Silicon Graphics, Inc.
# All rights reserved.
#
# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
# the contents of this file may not be disclosed to third parties, copied or
# duplicated in any form, in whole or in part, without the prior written
# permission of Silicon Graphics, Inc.
#
# RESTRICTED RIGHTS LEGEND:
# Use, duplication or disclosure by the Government is subject to restrictions
# as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
# and Computer Software clause at DFARS 252.227-7013, and/or in similar or
# successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
# rights reserved under the Copyright Laws of the United States.
CONFIG=/etc/config
IS_ON=/sbin/chkconfig
# The verbose flag controls the printing of the names of daemons as they
# are started and the printing of NFS-mounted filesystem names as they are
# mounted and unmounted.
if $IS_ON verbose; then
ECHO=echo
VERBOSE=-v
QUIET=
LOGGER='lfmt -l network -s warn'
else # For a quiet startup and shutdown
ECHO=:
VERBOSE=
QUIET=-q # also used in static-route.options
LOGGER='lfmt -l network -s warn -G 3'
fi
PATH=$PATH:/usr/etc/yp:.
NFS=/usr/etc
YPDOMFILE=/var/yp/ypdomain
YPSETDOM=/usr/bin/domainname
IFCONFIG=/usr/etc/ifconfig
ROUTE=/usr/etc/route
MSGTIME=10 # number of seconds to display error message
localhost=127.0.0.1 # definition of 'localhost' in /etc/hosts
if $IS_ON cap_su_off && test "`sysconf MAC`" -eq 1; then
CSU=csu_off -C
csu_off () {
while true; do
case "$1" in
-M) shift 2;;
-M?*) shift;;
CAP*) shift;;
-C) shift 2;;
-C?*) shift;;
*) break;;
esac
done
shift
eval $*
return
}
else
CSU="/sbin/suattr -C"
fi
CAP_MNT="$CSU CAP_MOUNT_MGT+ip -c"
CAP_NET="$CSU CAP_NETWORK_MGT+ip -c"
CAP_PORT="$CSU CAP_PRIV_PORT+ip -c"
CAP_PORT_MNT="$CSU CAP_PRIV_PORT,CAP_MOUNT_MGT+ip -c"
CAP_MREAD_MNT="$CSU CAP_MAC_READ,CAP_MOUNT_MGT+ip -c"
CAP_DEMON="$CSU CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -c"
CAP_INFO="$CSU CAP_SYSINFO_MGT+ip -c"
CAP_DEVNET="$CSU CAP_DEVICE_MGT,CAP_NETWORK_MGT+ip -c"
nfs_on () {
$IS_ON nfs && test -x /usr/sbin/havenfs && $CAP_MNT "/usr/sbin/havenfs"
return
}
svr4net_on ()
{
test -c /dev/tcp && (echo </dev/tcp) >/dev/null 2>&1
return
}
configure () {
# args: $1 = interface name, $2 = address, $3 = ifconfig options filename
# $4 = "primary" or ""
$ECHO "Configuring $1 as $2"
CONF_OPT="`cat $3 2> /dev/null`"
case "$1" {
ipg* | xpi* | rns*)
if /usr/etc/smtconfig $1 $2 $4 $CONF_OPT 2> /dev/null
then :
else
$CAP_DEVNET "$IFCONFIG $1 inet $2 $4 $CONF_OPT" 2> /dev/null
fi
;;
mtr*)
if test -s /etc/config/${1}config.options; then
topt="`cat /etc/config/${1}config.options`"
else
topt="restart"
fi
# load the firmware to the driver
/usr/etc/mtrconfig $1 $topt 2> /dev/null
$CAP_DEVNET "$IFCONFIG $1 inet $2 $4 $CONF_OPT" 2> /dev/null
;;
eg*)
$ECHO "Downloading firmware for $1"
/usr/etc/egconfig `cat $CONFIG/$1.options 2> /dev/null` $1
$CAP_DEVNET "$IFCONFIG $1 inet $2 $4 $CONF_OPT" 2> /dev/null
;;
gsn*)
# Initialize the GSN interface.
# Needs to be done before ifconfig of IP addr.
if test -s /etc/init.d/network.gsn1; then
/etc/init.d/network.gsn1 start
fi
$CAP_DEVNET "$IFCONFIG $1 inet $2 $4 $CONF_OPT" 2> /dev/null
;;
*)
$CAP_DEVNET "$IFCONFIG $1 inet $2 $4 $CONF_OPT" 2> /dev/null
;;
}
if test $? -ne 0 ; then
$LOGGER "Failed to configure $1 as $2.\n"
sleep $MSGTIME
return 1
fi
return 0
}
# print a warning message when we try to configure the same interface twice
config_conflict()
{
echo "\nWARNING: $1 has already been configured."
echo "Please read the notes in /etc/config/netif.options for "
echo "likely reasons for this and change your configuration\n"
}
DLMNTOPTS='-b /ns'
if test "`/sbin/nvram diskless 2> /dev/null`" -eq 1; then
DLMNTOPTS='-b /,/usr,/sbin,/swap,/ns'
RFLUSHFLAG=-fqn
# If an interface is being used for diskless, don't shut it down when
# turning off the system.
DLIF=`/sbin/nvram dlif 2> /dev/null`
else
RFLUSHFLAG=-Fqn
fi
# Turn off an interface that needs to be turned off when the system
# is shutdown, but do not turn off the interface used by a diskless
# system, since that is catastrophic.
# Do not bother poking at non-existent interfaces.
if_off () {
# args: $1 = interface name
eval _ifname='$HAVE_'$1
if test "$_ifname" = "$1" -a "$1" != "$DLIF"; then
$CAP_DEVNET "$IFCONFIG $1 down" 2> /dev/null
fi
}
# Discover the interfaces we have by creating variables of the
# form HAVE_xxx
IFNAMES="`ifconfig -a \
| sed -n -e '/^lo0/d' -e '/^ /d' -e 's/^\([^:]*\):.*/HAVE_\1=\1/p'`"
eval $IFNAMES
case "$1" in
'start')
# Check the Internet address to decide how to configure things.
HOSTNAME=`/usr/bsd/hostname`
netstate="loopback"
if test -x /usr/bsd/hostid; then
if $CAP_INFO "/usr/bsd/hostid -h $HOSTNAME"; then
if test "`/usr/bsd/hostid`" = "0xc0000201"; then
reason="${HOSTNAME}'s Internet address is the default.\n"
elif $IS_ON network; then
netstate="ok"
fi
else
$CAP_INFO "/usr/bsd/hostid 0"
reason="Cannot find $HOSTNAME in /etc/hosts.\n"
fi
elif $IS_ON network; then
netstate="ok" # assume it is ok
fi
if svr4net_on; then
SHORTNAME=`/usr/bsd/hostname -s`
echo $SHORTNAME $SHORTNAME > /etc/net/ticlts/hosts 2>/dev/null
echo $SHORTNAME $SHORTNAME > /etc/net/ticots/hosts 2>/dev/null
echo $SHORTNAME $SHORTNAME > /etc/net/ticotsord/hosts 2>/dev/null
fi
# Download remote host database
if test -x /usr/etc/rhost; then
$ECHO "Downloading Remote Host Database"
HOSTRESORDER=local $CAP_NET "/usr/etc/rhost"
fi
# The following tests determine the names and addresses of the primary
# and gateway interfaces for typical configurtations, where
# Name = interface name reported by "/usr/etc/netstat -i".
# Address = hostname in /etc/hosts or an IP address in dot notation.
#
# Edit /etc/config/netif.options to override values computed below.
#
# Note: If this host has more than 2 interfaces, you must edit
# /etc/config/netif.options to set the ifXname and ifXaddr variables
# as appropriate, and if this host has more than 8 interfaces, you must
# also set if_num to the number of interfaces.
#
# Suggested addresses for the primary and gateway interfaces.
if1addr=$HOSTNAME
if2addr=gate-$HOSTNAME
if_num=9
# If FDDI is present, make it the primary interface and
# Ethernet the gateway interface.
if test -n "$HAVE_ipg0"; then
if1name=ipg0
elif test -n "$HAVE_xpi0"; then
if1name=xpi0
elif test -n "$HAVE_rns0"; then
if1name=rns0
fi
if test "$if1name"; then
if test -n "$HAVE_et0"; then
# Challenge/Onyx & POWER Series systems
if2name=et0
elif test -n "$HAVE_ec0"; then
# Indigo & Personal Iris series
if2name=ec0
elif test -n "$HAVE_ef0"; then
if2name=ef0
elif test -n "$HAVE_fxp0"; then
if2name=fxp0
fi
elif test -n "$HAVE_et0"; then
if1name=et0
if test -n "$HAVE_et1"; then
if2name=et1
elif test -n "$HAVE_fxp0"; then
if2name=fxp0
fi
elif test -n "$HAVE_ec0"; then
if1name=ec0
if test -n "$HAVE_ec1"; then
if2name=ec1
if test -n "$HAVE_ec2"; then
if3name=ec2
fi
elif test -n "$HAVE_ec2"; then
if2name=ec2
elif test -n "$HAVE_fxp0"; then
if2name=fxp0
fi
elif test -n "$HAVE_ef0"; then
if1name=ef0
if test -n "$HAVE_ef1"; then
if2name=ef1
fi
elif test -n "$HAVE_fxp0"; then
if1name=fxp0
fi
# Obtain site-dependent values for if1name,if1addr,...,if64name,if64addr.
if test -s $CONFIG/netif.options; then
. $CONFIG/netif.options
fi
# Do site-dependent ha work for pre-start
#
# The HA script must be started before doing anything with
# the interfaces because the HA script may change interface
# related parameters.
if test -s /etc/init.d/network.ha.prestart; then
. /etc/init.d/network.ha.prestart
fi
# IP Packet Filtering daemon.
#
# It should be started before any gateway interface is configured "up"
# in order to guarantee that all inbound packets are filtered.
if $IS_ON ipfilterd && test -x /usr/etc/ipfilterd; then
/sbin/killall ipfilterd
IPFILTERD_OPTS="`cat $CONFIG/ipfilterd.options 2> /dev/null`"
$CAP_NET "/usr/etc/ipfilterd $IPFILTERD_OPTS"
$ECHO "Starting ipfilterd."
fi
# Flush all old routes iff not diskless
$CAP_NET "$ROUTE $RFLUSHFLAG"
# Configure the main network interface.
if test "$netstate" = "ok"; then
# update E-Plex 8-port Ethernet firmware.
if test -x /usr/etc/epfirm; then
$CAP_NET "/usr/etc/epfirm $VERBOSE"
if test $? -ne 0 ; then
$LOGGER "Failed to install E-Plex firmware.\n"
sleep $MSGTIME
fi
fi
if ! configure $if1name $if1addr $CONFIG/ifconfig-1.options primary; then
reason="Cannot access primary interface, $if1name.\n"
netstate="loopback"
fi
else
netstate="loopback"
fi
if test $netstate = "loopback"; then
$LOGGER "${reason}Using standalone network mode.\n"
sleep $MSGTIME
if test -n "$if1name"; then
$CAP_DEVNET "$IFCONFIG $if1name inet $if1addr" 2>/dev/null
$CAP_DEVNET "$IFCONFIG $if1name down" 2>/dev/null
fi
$CAP_DEVNET "$IFCONFIG lo0 $localhost"
$CAP_NET "$ROUTE -q add 224.0 $localhost -interface"
else
# Initialize other boards if this host is a gateway or multi-homed
# (no harm if they are missing). Systems with more than 2 interfaces
# must update /etc/config/netif.options (see comments in the file).
num=2
while test $num -le $if_num; do
eval _ifname='$'if${num}name _ifaddr='$'if${num}addr
if test -n "$_ifname"; then
eval _ifhave='$'HAVE_$_ifname
if test -n "$_ifhave"; then
# before configuring, check that there is no name
# conflict with a default value chosen automatically above.
# we just check the first three interfaces, since these
# can have their if?addr and if?name values set above.
cc_num=1
cc_lim=$num
if test $cc_lim -gt 4 ; then
cc_lim=4
fi
while test $cc_num -lt $cc_lim; do
eval _ifname_cc='$'if${cc_num}name
eval _ifaddr_cc='$'if${cc_num}addr
if [ "$_ifname" = "$_ifname_cc" ] ; then
config_conflict $_ifname
fi
if [ "$_ifaddr" = "$_ifaddr_cc" ] ; then
config_conflict $_ifaddr
fi
cc_num=`expr $cc_num + 1`
done
configure $_ifname $_ifaddr $CONFIG/ifconfig-$num.options
fi
fi
num=`expr $num + 1`
done
# Initialize the HyperNET interface.
if $IS_ON hypernet && test -n "$HAVE_hy0" &&
configure hy0 $HOSTNAME-hy $CONFIG/ifconfig-hy.options; then
/usr/etc/hyroute hy0 -s /usr/etc/hyroute.conf
fi
# Initialize the HIPPI interface.
if test -s /etc/init.d/network.hippi; then
. /etc/init.d/network.hippi
fi
# Initialize ATM TCP/IP software.
if test -s /etc/init.d/network.atm; then
. /etc/init.d/network.atm
fi
# Configure network multi-client striping
if $IS_ON ls && test -s /etc/init.d/network.ls; then
. /etc/init.d/network.ls
fi
# Configure point-to-point network striping
if $IS_ON lsp && test -s /etc/init.d/network.lsp; then
. /etc/init.d/network.lsp
fi
# Initialize the loop-back interface
$CAP_DEVNET "$IFCONFIG lo0 $localhost"
fi
# Send traffic for this host through lo0 for better performance
HOSTRESORDER=local $CAP_NET "$ROUTE -q add $if1addr $localhost -host"
# make 255.255.255.255 do something by pointing out the primary interface
if test "$if1name"; then
BCAST=`$CAP_DEVNET "$IFCONFIG $if1name" \
| sed -n -e 's/.*broadcast \([0-9.]*\).*/\1/p' 2>/dev/null`
if test "$BCAST"; then
$CAP_NET "$ROUTE -qn add 255.255.255.255 $BCAST"
fi
fi
# Add static routes before any routing daemons get theirs installed
if test $netstate = "ok" -a -s $CONFIG/static-route.options; then
. $CONFIG/static-route.options
fi
$ECHO "Network daemons:\c"
/sbin/killall gated routed mrouted rpcbind portmap named rsvpd
if test -x /usr/etc/satmpd; then
$CSU CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -M userlow -c "/usr/etc/satmpd"
$ECHO " satmpd\c"
fi
if test $netstate = "ok" ; then
# Start either gated or routed.
if $IS_ON gated && test -x /usr/etc/gated ; then
GATED_OPTS="`cat $CONFIG/gated.options 2> /dev/null`"
$CAP_PORT "/usr/etc/gated $GATED_OPTS" &
$ECHO " gated\c"
elif $IS_ON routed && test -x /usr/etc/routed ; then
ROUTED_OPTS="`cat $CONFIG/routed.options 2> /dev/null`"
$CAP_DEMON "/usr/etc/routed $ROUTED_OPTS" &
$ECHO " routed\c"
fi
# Set the default route for all IP multicast packets to the
# primary interface.
HOSTRESORDER=local $CAP_NET "$ROUTE -q add 224.0 $if1addr -interface"
if $IS_ON mrouted && test -x /usr/etc/mrouted; then
MROUTED_OPTS="`cat $CONFIG/mrouted.options 2> /dev/null`"
$CAP_NET "/usr/etc/mrouted $MROUTED_OPTS" &
$ECHO " mrouted\c"
fi
fi
# Start rpcbind(1M) if SVR4 networking has been installed.
if test -x /usr/etc/rpcbind && svr4net_on; then
/usr/etc/rpcbind `cat $CONFIG/rpcbind.options 2> /dev/null` &
$ECHO " rpcbind\c"
elif test -x /usr/etc/portmap; then
PMAP_OPTS="`cat $CONFIG/portmap.options 2> /dev/null`"
$CAP_DEMON "/usr/etc/portmap $PMAP_OPTS" &
$ECHO " portmap\c"
fi
# Berkeley Internet Name Domain server:
#
# It has to be started before NIS and NFS so they can use hostnames
# not in /etc/hosts.
if $IS_ON named && test -x /usr/sbin/named; then
NAMED_OPTS="`cat $CONFIG/named.options 2> /dev/null`"
$CSU CAP_NETWORK_MGT,CAP_PRIV_PORT,CAP_MAC_UPGRADE,CAP_MAC_DOWNGRADE,CAP_MAC_RELABEL_OPEN,CAP_MAC_MLD+ip -c "/usr/sbin/named $NAMED_OPTS" </dev/null &
$ECHO " named\c"
fi
# RSVP daemon (logs to /var/tmp/.rsvpd.log)
if $IS_ON rsvpd && test -x /usr/etc/rsvpd; then
RSVPD_OPTS="`cat $CONFIG/rsvpd.options 2> /dev/null`"
$CAP_DEMON "/usr/etc/rsvpd $RSVPD_OPTS" &
$ECHO " rsvpd\c"
fi
$ECHO "."
# Define the NIS domain name.
if test -x $YPSETDOM; then
# The ypdomain file is needed only if NIS domain != Internet domain.
YPDOMAIN=`cat $YPDOMFILE 2> /dev/null`
if test ! "$YPDOMAIN" ; then
# Extract the domain from the hostname.
YPDOMAIN=`echo $HOSTNAME | sed -e 's/[^.]*\.\(.*\)/\1/'`
if test "$YPDOMAIN" = "$HOSTNAME"; then
# Hostname does not contain domain.
YPDOMAIN=""
fi
fi
# Set the domain even if NIS is not "on" so nsd can be
# started by hand later.
if test "$YPDOMAIN"; then
$CAP_INFO "$YPSETDOM $YPDOMAIN"
fi
fi
# Fire up name service daemons.
#
# Note: nsd has replaced ypserv and ypbind.
if test $netstate = "ok" && $IS_ON nsd ; then
$ECHO "Name services:\c"
/sbin/killall -TERM nsd
if test -x $NFS/nsd; then
NSD_OPTIONS="`cat $CONFIG/nsd.options 2> /dev/null`"
$CSU CAP_MAC_UPGRADE,CAP_MAC_DOWNGRADE,CAP_MAC_RELABEL_OPEN,CAP_MAC_MLD,CAP_MOUNT_MGT,CAP_NETWORK_MGT,CAP_PRIV_PORT,CAP_MAC_WRITE+ip -c "$NFS/nsd $NSD_OPTIONS"
$ECHO " nsd\c"
fi
if $IS_ON ypserv ; then
if ! grep -q -s nisserv /var/ns/domains/*/nsswitch.conf ; then
$LOGGER "No NIS domains found to serve.\nchkconfig ypserv off or ypinit the system.\n"
fi
fi
if $IS_ON ypmaster ; then
if test ! "$YPDOMAIN" ; then
$LOGGER "Cannot start NIS -- domain name not defined.\nEdit $YPDOMFILE to contain your domain name and reboot.\n"
sleep $MSGTIME
else
YPDBDIR=/var/ns/domains/$YPDOMAIN
$CAP_INFO "$YPSETDOM $YPDOMAIN"
/sbin/killall rpc.passwd
if test -x $NFS/rpc.passwd; then
# A reasonable alternate password file is '/etc/passwd.yp'
# This allows the valid accounts on the NIS master
# to not be all valid accounts in the network.
PASSWD=`cat $CONFIG/rpc.passwd.options 2> /dev/null`
$CAP_DEMON "$NFS/rpc.passwd ${PASSWD:=/etc/passwd} -m passwd" &
$ECHO " rpc.passwd\c"
fi
fi
fi
$ECHO "."
fi
# Load the GSN static HARP mapping table. Needs to be done after named is launched.
if test -s /etc/init.d/network.gsn2; then
. /etc/init.d/network.gsn2
fi
# Fire up AFS if configured - this needs to occur after networking
# is enabled but before nfsd's are run
if test -x /etc/init.d/afs ; then
/etc/init.d/afs netstart
fi
#
# cachefs must start prior to exportfs
#
if test -x /etc/init.d/cachefs ; then
/etc/init.d/cachefs netstart
fi
# Fire up NFS daemons if the kernel supports NFS and the daemons are
# present and executable. Also mount the NFS filesystems in /etc/fstab.
if test "$netstate" = "ok" && nfs_on ; then
# Clear this host from the client list (/etc/rmtab) of all
# servers on the network. Remove any stale exports from
# the current exports list (/etc/xtab).
$CAP_PORT_MNT "/sbin/umount -aT nfs,nfs3,nfs3pref ${DLMNTOPTS}" > /dev/null 2>&1
$CAP_MREAD_MNT "$NFS/exportfs -au" > /dev/null 2>&1
$CAP_MREAD_MNT "$NFS/exportfs -a $VERBOSE"
$ECHO "NFS daemons:\c"
/sbin/killall nfsd biod
# NFS server daemons
if test -x $NFS/nfsd; then
NNFSD=`cat $CONFIG/nfsd.options 2> /dev/null`
$CAP_DEMON "$NFS/nfsd $NNFSD";
$ECHO " nfsd\c"
fi
# NFS client bio daemons
if test -x $NFS/biod; then
NBIOD=`cat $CONFIG/biod.options 2> /dev/null`
$CAP_MNT "$NFS/biod ${NBIOD:=4}";
$ECHO " biod\c"
fi
$ECHO "."
$CAP_PORT_MNT "/sbin/mount $VERBOSE -aT nfs,nfs3,nfs3pref ${DLMNTOPTS}"
if $IS_ON automount || $IS_ON autofs || $IS_ON lockd || \
$IS_ON pcnfsd ; then
$ECHO "Other NFS daemons:\c"
# Start the NFS lock and status daemons
if $IS_ON lockd ; then
if test -x $NFS/rpc.statd ; then
/sbin/killall rpc.statd
$CAP_NET "$NFS/rpc.statd ""`cat $CONFIG/statd.options 2> /dev/null`"
$ECHO " statd\c"
fi
if test -x $NFS/rpc.lockd ; then
/sbin/killall rpc.lockd
$CSU CAP_CHROOT,CAP_NETWORK_MGT,CAP_PRIV_PORT,CAP_DAC_WRITE,CAP_MAC_READ,CAP_MAC_WRITE+ip -c "$NFS/rpc.lockd ""`cat $CONFIG/lockd.options 2> /dev/null`" &
$ECHO " lockd\c"
fi
fi
# PC-NFS server daemon
if $IS_ON pcnfsd && test -x $NFS/pcnfsd ; then
$NFS/pcnfsd & $ECHO " pcnfsd\c"
fi
# Start the NFS automounter daemon
if $IS_ON autofs && test -x $NFS/autofsd && \
test -x $NFS/autofs; then
/sbin/killall -k 30 -TERM automount
/sbin/killall -k 10 autofs autofsd
AUTOFSD_OPTS="`cat $CONFIG/autofs.options 2> /dev/null`"
$CSU CAP_MOUNT_MGT,CAP_SCHED_MGT,CAP_MAC_READ,CAP_MAC_WRITE,CAP_AUDIT_WRITE,CAP_MAC_UPGRADE,CAP_MAC_DOWNGRADE,CAP_MAC_RELABEL_OPEN,CAP_MAC_MLD,CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -c "$NFS/autofsd $AUTOFSD_OPTS" >/dev/null 2>&1
$ECHO " autofsd\c"
AUTOFS_OPTS="`cat $CONFIG/autofs.options 2> /dev/null`"
$CSU CAP_MOUNT_MGT,CAP_MAC_READ+ip -c "$NFS/autofs $AUTOFS_OPTS" >/dev/null 2>&1
elif $IS_ON automount && test -x $NFS/automount ; then
/sbin/killall -k 30 -TERM automount
AUTOMOUNT_OPTS="`cat $CONFIG/automount.options 2> /dev/null`"
$NFS/automount $AUTOMOUNT_OPTS >/dev/null 2>&1
$ECHO " automount\c"
fi
$ECHO "."
fi
fi
# Daemons started below may reside on NFS filesystems.
$ECHO "Internet daemons:\c"
/sbin/killall inetd timed timeslave rarpd rwhod
# Internet super-server:
#
# Invokes servers in /usr/etc/inetd.conf. Use the inetd.options file
# to specify a different configuration file.
if test -x /usr/etc/inetd; then
INETD_OPTS="`cat $CONFIG/inetd.options 2> /dev/null`"
$CAP_DEMON "/usr/etc/inetd $INETD_OPTS" < /dev/null
$ECHO " inetd\c"
fi
# SVR4 service access controller
if test -x /usr/lib/saf/sac && svr4net_on; then
rm -f /etc/saf/_sacpipe /etc/saf/tcp/_pmpipe
/usr/lib/saf/sac -t 30 < /dev/null &
$ECHO " sac\c"
fi
# Time synchronization servers:
# timed keeps time consistent among machines on a local network.
# timeslave tracks changes made by a master time keeper.
#
# Timed can be given options in $CONFIG/timed.options, detailed
# in the timed(1M) man page.
#
# Timeslave requires the name of host to follow (-H hostname)
# or the name of clock device that listens to WWV (-C /dev/ttyXX).
# Other options are listed in the man page.
if $IS_ON timed && test $netstate = "ok" -a -x /usr/etc/timed ; then
TIMED_OPTS="`cat $CONFIG/timed.options 2> /dev/null`"
$CSU CAP_TIME_MGT,CAP_PRIV_PORT,CAP_NETWORK_MGT,CAP_SCHED_MGT+ip -M userlow -c "/usr/etc/timed -M $TIMED_OPTS" &
$ECHO " timed\c"
fi
if $IS_ON timeslave && test -x /usr/etc/timeslave ; then
if test -s $CONFIG/timeslave.options ; then
# timeslave cannotlive without timeslave.options
$CSU CAP_TIME_MGT,CAP_SCHED_MGT+ip -c "/usr/etc/timeslave `cat $CONFIG/timeslave.options`" &
$ECHO " timeslave\c"
else
$LOGGER "timeslave not started -- options missing.\nAdd them to %s and reboot.\n" "$CONFIG/timeslave.options"
sleep $MSGTIME
fi
fi
# RARPD: Reverse ARP daemon.
#
# RARP is used by Sun diskless clients to discover their Internet
# addresses, given their Ethernet addresses.
if $IS_ON rarpd && test $netstate = "ok" -a -x /usr/etc/rarpd ; then
$CAP_PORT "/usr/etc/rarpd ""`cat $CONFIG/rarpd.options 2> /dev/null`" &
$ECHO " rarpd\c"
fi
# Rwhod: 4.3BSD system status daemon.
#
# Important: if there are lots of hosts on the network,
# DO NOT run rwhod because it can saturate the network.
if $IS_ON rwhod && test $netstate = "ok" -a -x /usr/etc/rwhod; then
if test ! -d /var/spool/rwho; then
mkdir /var/spool/rwho
fi
RWHOD_OPTS="`cat $CONFIG/rwhod.options 2> /dev/null`"
$CAP_DEMON "/usr/etc/rwhod $RWHOD_OPTS"
$ECHO " rwhod\c"
fi
$ECHO "."
# DLPI daemon must be started before 4DDN.
if $IS_ON snetd && test -x /usr/etc/snetd ; then
/usr/etc/snetd
fi
if $IS_ON 4DDN && test $netstate = "ok" -a -x /var/opt/dn/dnstart.sh; then
/sbin/killall -TERM dnserver
/var/opt/dn/dnstart.sh $VERBOSE
fi
# Do site-dependent ha work for post-start
if test -s /etc/init.d/network.ha.poststart; then
. /etc/init.d/network.ha.poststart
fi
;;
'stop')
# Servers that might start shells.
USERS='rlogind rexecd rshd ftpd telnetd sethostd dnserver comlink latd'
# The following servers should be killed immediately.
EDAEMONS='inetd bootp tftpd timed timeslave rarpd rwhod talkd fingerd
automount autofs rpc.mountd rpc.lockd rpc.statd
rpc.bootparamd rpc.rexd rpc.rstatd rpc.rusersd rpc.rwalld
rpc.ypupdated fal smtd sac listen osid'
# Remote daemons
RDAEMONS='nsd rpc.passwd nfsd biod pcnfsd rpc.rquotad named gated
routed mrouted rsvpd'
# These daemons should be kept alive until the last minute.
LDAEMONS='autofsd portmap rpcbind ppp slip ipfilterd snetd'
# Do site-dependent ha work for pre-stop
if test -s /etc/init.d/network.ha.prestop; then
. /etc/init.d/network.ha.prestop
fi
# Kill (probable) shell process groups first
/sbin/killall -k 1 -g 1 $USERS
/sbin/killall -k 1 -TERM $EDAEMONS $USERS
$CAP_PORT_MNT "/sbin/umount $VERBOSE -kt nfs,nfs3,nfs3pref,lofs ${DLMNTOPTS}"
/sbin/killall -k 1 -TERM $RDAEMONS
# Unexport any exported NFS filesystems (assumes netstate = ok)
# Do this after killing the NFS demons so that clients do not
# suffer errors on their read(2) requests, if they have hard-mounted
# things. /usr may not be mounted, so you must check to see
# that exportfs is available.
if nfs_on && test -x $NFS/exportfs; then
$CAP_MREAD_MNT "$NFS/exportfs -au $VERBOSE"
fi
# cachefs shutdown must occur after exportfs but before the network
# interfaces are shut down
if test -x /etc/init.d/cachefs ; then
/etc/init.d/cachefs netstop
fi
# Blow away any background mounts and the broadcast umount since
# the network will be shut down soon.
/sbin/killall mount umount $USERS $EDAEMONS $RDAEMONS $LDAEMONS
for _ifname in `echo $IFNAMES | sed -e 's/HAVE[^=]*=//g'`; do
case $_ifname in
# Shutdown FDDI to turn off the optical bypasses to cleanly take
# the system out of the ring.
xpi*|ipg*|rns*) if_off $_ifname;;
# Shutdown ethernet (Indigo family (IP12/IP20/IP22))
ec1|ec2) if_off $_ifname;;
esac
done
# Shutdown HIPPI interface
if test -s /etc/init.d/network.hippi; then
. /etc/init.d/network.hippi
fi
# Shutdown GSN interface
if test -s /etc/init.d/network.gsn2; then
# Unload GSN HARP table entries
. /etc/init.d/network.gsn2
# Shutdown GSN interface
. /etc/init.d/network.gsn1
fi
# Shutdown ATM TCP/IP software.
if test -s /etc/init.d/network.atm; then
. /etc/init.d/network.atm
fi
# Do site-dependent ha work for post-stop
if test -s /etc/init.d/network.ha.poststop; then
. /etc/init.d/network.ha.poststop
fi
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
# DECnet is a trademark of Digital Equipment Corp.
# NFS is a trademark of Sun Microsystems, Inc.

View File

@@ -0,0 +1 @@
on

View File

@@ -0,0 +1 @@
off

50
eoe/cmd/initpkg/init.d/partcfg Executable file
View File

@@ -0,0 +1,50 @@
#! /sbin/sh
#Tag 0x00000f00
# SN Partition Config Daemon - mkpd
# "$Revision: 1.5 $"
IS_ON=/sbin/chkconfig
MKPD=/usr/sbin/mkpd
case "$1" in
'start')
# (Re)start the partition config daemon.
#
# The following check skips mkpd if running on an Origin200. (for now)
if [ `ls -d /hw/module/*/slot/MotherBoard 2>/dev/null | wc -l` = 0 ]
then
killall -k 3 mkpd
if $IS_ON mkpd && test -x $MKPD; then
if $IS_ON verbose; then
echo "Partition Config daemons : mkpd."
fi
killall mkpd
MFLAGS=""
/sbin/suattr -C CAP_SCHED_MGT,CAP_DEVICE_MGT+ip -c "${MKPD} ${MFLAGS}" 2> /dev/null &
sleep 1; echo "\r\c"
fi
fi
exit 0
;;
'stop')
# Stop the partition config daemon
killall 15 mkpd
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

18
eoe/cmd/initpkg/init.d/postinst Executable file
View File

@@ -0,0 +1,18 @@
#! /sbin/sh
#Tag 0x00000f00
# Check for uncompleted installation operations
# "$Revision: 1.5 $"
# Check for & execute any uncompleted parts of an installation; this could
# happen if the inst succeeds but the system comes down abnormally.
# This must be done while local filesystems are mounted but while few
# other processes are active. That time is early during startup, or late
# during shutdown.
#
# It is a safe no-op if no installation has been done.
if [ -x /usr/sbin/postinst ]
then
/usr/sbin/postinst
fi

65
eoe/cmd/initpkg/init.d/quotas Executable file
View File

@@ -0,0 +1,65 @@
#! /sbin/sh
#Tag 0x00000f00
# Start or stop the quotas subsystem. This should be done immediately after
# the local file systems (EFS) are mounted.
# "$Revision: 1.11 $"
# Ideally we should run quotacheck(1M) when the file system has been
# mounted and quotas enabled. But since this might take up some time
# we provide a option /etc/config/quotacheck which will determine
# whether to run quotacheck(1M) during mount time or not.
#
# "$Revision: 1.11 $"
if /sbin/chkconfig verbose ; then
VERBOSE=-v
else
VERBOSE=
fi
case "$1" in
'start')
if /sbin/chkconfig quotas ; then
/sbin/suattr -C CAP_QUOTA_MGT+ip -c "/usr/etc/quotaon ${VERBOSE} -a"
if /sbin/chkconfig quotacheck ; then
/sbin/suattr -C CAP_QUOTA_MGT+ip -c "/usr/etc/quotacheck ${VERBOSE} -a"
fi
fi
;;
'stop')
/sbin/suattr -C CAP_QUOTA_MGT+ip -c "/usr/etc/quotaoff ${VERBOSE} -a"
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
if [ -a /usr/tmp/restore_quotas ]
then
echo "Attempting to restore quotas after restoring disk from tape."
if [ -a /etc/init.d/quotas ]
then
repquota -s -a > /dev/null 2> /dev/null
if [ $? ]
then
repquota -s / 2>&1 | \
grep -q 'user quota accounting.*off'
if [ $? -ne 0 ]
then
edquota -i /usr/tmp/restore_quotas
rm /usr/tmp/restore_quotas
echo "Quotas have been restored"
else
echo "Use quotaon(1M) to turn on quotas, then reboot"
fi
else
echo "Quotas must be turned on before restoring."
fi
fi
fi

27
eoe/cmd/initpkg/init.d/raid Executable file
View File

@@ -0,0 +1,27 @@
#! /sbin/sh
#Tag 0x00000f00
# RAID control
# "$Revision: 1.8 $"
case $1 in
'start')
if /sbin/chkconfig verbose
then
echo "Checking for down RAID disks:"
fi
/usr/sbin/raid -L -cmf
;;
'stop')
if /sbin/chkconfig verbose
then
echo "Checking for down RAID disks:"
fi
/usr/sbin/raid -L -cmf
;;
*)
echo "usage: /etc/init.d/raid {start|stop}"
;;
esac

View File

@@ -0,0 +1,96 @@
#! /sbin/sh
#Tag 0x00000f00
# Clean up temporary files.
# "$Revision: 1.35 $"
set `/sbin/who -r`
if test $9 != "S"; then
exit 1
fi
# If no reasonable /tmp exists (!?!?!) create one.
if test ! -d /tmp -a ! -L /tmp; then
/sbin/suattr -m -c "rm -f /tmp"
mkdir /tmp
if test "`sysconf MAC`" -eq 1; then
chlabel -m /tmp
fi
fi
# Preserve any editor scratch files. If we moved /tmp to /.oldtmp earlier
# on, scratch files may be in /.oldtmp. To be really thorough, run through
# both /tmp and any /.oldtmp.
# Note that if we moved /tmp to /.oldtmp earlier on, it means we are both
# allowed and expected to delete the entire old /tmp contents. Since this
# is true, we can delete /.oldtmp when we are done with it.
if test -x /usr/lib/expreserve; then
if test -d /.oldtmp; then
/usr/lib/expreserve -d /.oldtmp
/sbin/suattr -m -C CAP_DAC_WRITE,CAP_DAC_READ_SEARCH,CAP_MAC_WRITE,CAP_MAC_READ,CAP_FOWNER+ipe -c "rm -rf /.oldtmp"
fi
if test "`sysconf MAC`" -eq 1; then
for dir in `/sbin/suattr -m -C CAP_MAC_READ+ipe -c "echo /tmp/[A-Z]-[a-z]"`;do
label=`/sbin/suattr -m -C CAP_MAC_READ+ipe -c "ls -1Md ${dir}" | awk '{print $2}' | sed -e 's!\[!!' -e 's!\]!!'`
/sbin/suattr -M $label -c "/usr/lib/expreserve -d /tmp"
done
else
/usr/lib/expreserve -d /tmp
fi
fi
# make /var/tmp exist
if test ! -d /var/tmp -a ! -L /var/tmp; then
/sbin/suattr -m -c "rm -f /var/tmp"
mkdir /var/tmp
if test "`sysconf MAC`" -eq 1; then
chlabel -m /var/tmp
fi
fi
if ls -ld /usr/tmp 2>/dev/null | grep "^d" > /dev/null 2>&1 ; then
/sbin/suattr -m -c "rm -rf /usr/TMPOLD > /dev/null 2>&1"
/sbin/suattr -m -c "mv /usr/tmp /usr/TMPOLD > /dev/null 2>&1"
/sbin/suattr -m -c "rm -rf /usr/tmp > /dev/null 2>&1"
/sbin/suattr -m -c "ln -s ../var/tmp /usr/tmp"
fi
if chkconfig nostickytmp; then
/sbin/suattr -m -C CAP_FOWNER+ipe -c "chmod 777 /tmp /var/tmp"
else
/sbin/suattr -m -C CAP_FOWNER+ipe -c "chmod 1777 /tmp /var/tmp"
fi
/sbin/suattr -m -C CAP_FOWNER+ipe -c "chown sys.sys /tmp /var/tmp"
# clean directories from /usr/tmp_rex or make sure it doesn't exist.
# Do not delete it recursively in case rexd is already running.
# XXX This should be removed along with rexd.
# XXX This is too late, since inetd is already running, which means
# XXX rexd might already be using its directory.
if test -d /var/tmp_rex; then
rmdir /var/tmp_rex/* 2> /dev/null
else
rm -f /var/tmp_rex
mkdir /var/tmp_rex
fi
# Don't make the symlink if the rm fails. In order to do this, we
# need to remove the -f flag to rm; otherwise, it won't exit with a
# non-zero value when rm fails. If /usr/tmp_rex is already a symlink,
# we may just be making a symlink the thing it already points at.
# On diskless systems, /usr is mounted read-only. Therefore, the rm
# of /usr/tmp_rex will fail. Checking to see if /usr/tmp_rex is the
# correct symlink requires using something like awk which isn't in
# /sbin. This is a good comprimise.
if test -d /usr/tmp_rex; then
rm -r /usr/tmp_rex 2> /dev/null
if [ $? = 0 ]; then
ln -s ../var/tmp_rex /usr/tmp_rex 2> /dev/null
fi
fi
/sbin/suattr -C CAP_FOWNER+ipe -c "chmod 775 /var/tmp_rex"
/sbin/suattr -C CAP_FOWNER+ipe -c "chown sys.sys /var/tmp_rex"
# prime the ps command data file, /tmp/.ps_data
/sbin/nice ps -e < /dev/null > /dev/null 2>&1 &

154
eoe/cmd/initpkg/init.d/savecore Executable file
View File

@@ -0,0 +1,154 @@
#!/sbin/sh
#Tag 0x00000800
#
# Perform a crash dump save.
# "$Revision: 1.23 $"
#
# Get the crash directory from the savecore.options file (if any). This
# way we can set up the savecore.options file in any fashion we want.
#
OPTIONS=`cat /etc/config/savecore.options 2> /dev/null`
CRASHDIR=""
if [ ! "${OPTIONS}" = "" ] ; then
for DIR in ${OPTIONS} ; do
if [ -d "${DIR}" ] ; then
CRASHDIR="${DIR}"
fi
done
if [ "${CRASHDIR}" = "" ] ; then
CRASHDIR="/var/adm/crash"
OPTIONS="${OPTIONS} ${CRASHDIR}"
fi
else
OPTIONS="/var/adm/crash"
CRASHDIR=${OPTIONS}
fi
#
# Set the current bounds value, if any.
#
BOUNDS=`/sbin/suattr -M dbadmin -c "cat ${CRASHDIR}/bounds" 2> /dev/null`
BOUNDS=${BOUNDS:=0}
#
# Assign filenames appropriately for the files in ${CRASHDIR} so that
# we write out the right reports to the right files. Note that the .N
# extension is whatever bounds value was assigned to this particular
# system panic or hang.
#
# For completeness, the files that can end up in ${CRASHDIR} are:
#
# fru.N:
# The FRU analysis of the hardware on the system if the IP type is
# valid and results are returned.
#
# analysis.N:
# The full IRIX crash core file report that displays lots of data
# on what happened when the system crashed. This report can be
# analyzed by SGI support personnel in order to try and find out
# why the system either paniced or hung.
#
# summary.N:
# The summary information about a crash, primarily used by the
# availmon information gathering process. Note that this file
# is removed as soon as 'availmon' picks it up.
#
# unix.N:
# A copy of /unix from the time of the system crash.
#
# vmcore.N.comp:
# A compressed version of the virtual memory at the time of the
# system crash. It can be used in combination with unix.N in order
# to gather details about the machine panic or hang.
#
FRU=${CRASHDIR}/fru.${BOUNDS}
UNIX=${CRASHDIR}/unix.${BOUNDS}
VMCORE=${CRASHDIR}/vmcore.${BOUNDS}.comp
ANA=${CRASHDIR}/analysis.${BOUNDS}
SUM=${CRASHDIR}/summary.${BOUNDS}
CLG=${CRASHDIR}/crashlog.${BOUNDS}
#
# Flag to determine if we need to update the bounds file or not. This
# is needed when 'savecore' exits with a status of 2, which means that
# there isn't enough disk space for a core dump, but there might be
# enough disk space to save a report.
#
UPDATE_BOUNDS=0
CONFIG=/etc/config
IS_ON=/sbin/chkconfig
if $IS_ON verbose ; then
LOGGER='/sbin/lfmt -l savecore -s info'
else
LOGGER='/sbin/lfmt -l savecore -s info -G 1'
fi
NOMSGSEVERITY=1 export NOMSGSEVERITY
#
# If 'savecore' is chkconfiged on, run 'savecore', followed by 'icrash',
# followed by 'fru', checking to make sure that the binaries are installed
# on a given system. If 'savecore' is chkconfiged off, run 'icrash',
# followed by 'fru', and then clear the dump out of /dev/swap.
#
if $IS_ON savecore || [ ! -f /usr/bin/icrash ] ; then
/sbin/suattr -M dbadmin -C CAP_MAC_WRITE+ip -c "/usr/etc/savecore ${OPTIONS}"
if [ $? -eq 1 ] ; then
exit 1
elif [ $? -eq 2 ] ; then
UNIX=/unix
VMCORE=/dev/swap
UPDATE_BOUNDS=1
fi
if [ -f /usr/bin/icrash ] ; then
/sbin/suattr -M dbadmin -c "/bin/rm -f ${SUM} ${ANA}"
/sbin/suattr -M dbadmin -c "/usr/bin/icrash -r -a ${SUM} -w ${ANA} ${UNIX} ${VMCORE}" 2> /dev/null
if [ $? -eq 0 ] ; then
${LOGGER} "Created crash report.\n"
if /sbin/suattr -M dbadmin -c "test -f ${CLG}" ; then
/sbin/suattr -M dbadmin -c "/bin/rm -f ${CLG}"
fi
if [ $UPDATE_BOUNDS -eq 1 ] ; then
BOUNDS=`expr ${BOUNDS} + 1`
/sbin/suattr -M dbadmin -c "echo ${BOUNDS} > ${CRASHDIR}/bounds"
fi
/sbin/suattr -M dbadmin -c "/bin/rm -f ${FRU}"
/sbin/suattr -M dbadmin -c "/usr/bin/icrash -S -w ${FRU} -e "fru" ${UNIX} ${VMCORE}" 2> /dev/null
if [ $? -eq 0 ] ; then
${LOGGER} "Created fru report.\n"
else
/sbin/suattr -M dbadmin -c "/bin/rm -f ${FRU}"
fi
else
/sbin/suattr -M dbadmin -c "/bin/rm -f ${SUM} ${ANA}"
if /sbin/suattr -M dbadmin -c "test -f ${CLG}" ; then
/sbin/suattr -M dbadmin -c "/bin/mv ${CLG} ${ANA}"
fi
fi
fi
else
UNIX=/unix
VMCORE=/dev/swap
if [ -f /usr/bin/icrash ] ; then
/sbin/suattr -M dbadmin -c "/bin/rm -f ${SUM} ${ANA}"
/sbin/suattr -M dbadmin -c "/usr/bin/icrash -r -a ${SUM} -w ${ANA} ${UNIX} ${VMCORE}" 2> /dev/null
if [ $? -eq 0 ] ; then
${LOGGER} "Created crash report.\n"
BOUNDS=`expr ${BOUNDS} + 1`
/sbin/suattr -M dbadmin -c "echo ${BOUNDS} > ${CRASHDIR}/bounds"
/sbin/suattr -M dbadmin -c "/bin/rm -f ${FRU}"
/sbin/suattr -M dbadmin -c "/usr/bin/icrash -S -w ${FRU} -e "fru" ${UNIX} ${VMCORE}" 2> /dev/null
if [ $? -eq 0 ] ; then
${LOGGER} "Created fru report.\n"
else
/sbin/suattr -M dbadmin -c "/bin/rm -f ${FRU}"
fi
else
/sbin/suattr -M dbadmin -c "/bin/rm -f ${SUM} ${ANA}"
fi
/sbin/suattr -M dbadmin -c "/usr/bin/icrash -c ${UNIX} ${VMCORE}" 2> /dev/null
fi
fi

View File

@@ -0,0 +1 @@
on

View File

@@ -0,0 +1 @@
on

View File

@@ -0,0 +1 @@
off

View File

@@ -0,0 +1 @@
on

89
eoe/cmd/initpkg/init.d/sn0start Executable file
View File

@@ -0,0 +1,89 @@
#! /sbin/sh
#Tag 0x00000f00
# SN0 System Startup
# "$Revision: 1.15 $"
IS_ON=/sbin/chkconfig
MMSCD=/usr/etc/mmscd
CLSHMCTL=/usr/etc/clshmctl
case "$1" in
'start')
# Retrieve messages from the IP27 PROM Log
/usr/sbin/sn0log -s -a
# (Re)start the multi-module system controller daemon.
#
# Note: the daemon probes to determines if an MMSC is present, and
# exits if not. If no MMSC is present, the probing process results
# in an MMSC "ping" command being sent to the console, consisting of
# the characters 0xa0 0x00 0x00 0x00 0xa0.
#
# The following check skips mmscd if running on an Origin200.
if [ `ls -d /hw/module/*/slot/MotherBoard 2>/dev/null | wc -l` = 0 ]
then
killall -k 3 mmscd
if $IS_ON mmscd; then
if $IS_ON verbose; then
echo "System controller daemons: mmscd."
fi
MFLAGS=""
if $IS_ON cleanpowerdown ; then MFLAGS="${MFLAGS} -g"; fi
if $IS_ON cpumeter ; then MFLAGS="${MFLAGS} -m"; fi
if [ -f /usr/gfx/gfxinit ]; then MFLAGS="${MFLAGS} -G"; fi
if [ `nvram console` != d ]; then
MFLAGS="${MFLAGS} -c /dev/ttyd1"
fi
/sbin/suattr -C CAP_SCHED_MGT,CAP_DEVICE_MGT+ip \
-c "${MMSCD} ${MFLAGS} -t 'System activity for `hostname`'"
sleep 1; echo "\r\c"
fi
# Starts up the craylink shared memory daemon.
# since placed the enclosing "if" doesn't get run on o200s
${CLSHMCTL} shutdown > /dev/null 2>&1
if $IS_ON clshmd; then
if $IS_ON verbose; then
echo "Craylink shared memory daemon: clshmd."
fi
/sbin/suattr -C CAP_SCHED_MGT,CAP_DEVICE_MGT+ip \
-c "${CLSHMCTL} startup"
sleep 1; echo "\r\c"
fi
fi
exit 0
;;
'stop')
# Stop the system controller daemon
# /sbin/scmsg "System coming down.."
killall -TERM -k 3 mmscd
# Stop the craylink shared memory daemon
${CLSHMCTL} shutdown > /dev/null 2>&1
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

89
eoe/cmd/initpkg/init.d/snmp Executable file
View File

@@ -0,0 +1,89 @@
#! /bin/sh
#
# This script starts then SNMP agents. SNMP support is made
# up of multiple parts. In the front is the Peer Networks
# master agent which handles new requests in SNMPv1 or v2.
# The master agent talks to an encapsulator which forwards
# requests on to agents. Currently we only ship one agent
# with the base operating system, which supports MIB2 and the
# SGI enterprise MIB. We ship subagents for the HP-UX mib
# and the atm mib as layerred products.
#
# Running chkconfig snmpd off/on controls whether the daemons
# are started.
#
# Configuration files for this are:
# peer_snmp.options command line arguments for master agent
# peer_encaps.options command line arguments for encapsulator
# snmpd.options command line arguments for MIB2/SGI sub-agent
# hpsnmpd.options command line arguments for HP-UX sub-agent
#
IS_ON=/sbin/chkconfig
if $IS_ON verbose ; then
ECHO=echo
else
ECHO=:
fi
CONFIG=/etc/config
BINDIR=/usr/etc
case "$1" in
'start')
if $IS_ON snmpd ; then
$ECHO "SNMP Agents:\c"
#
# peer_snmpd is the master agent which deals with SNMP
# protocol conversion.
#
if test -x $BINDIR/peer_snmpd ; then
$BINDIR/peer_snmpd `cat $CONFIG/peer_snmpd.options 2>/dev/null`
$ECHO " peer_snmpd\c"
fi
#
# peer_encaps is an encapsulator to allow the use of SNMPv1
# agents.
#
if test -x $BINDIR/peer_encaps ; then
$BINDIR/peer_encaps `cat $CONFIG/peer_encaps.options 2>/dev/null`
$ECHO " peer_encaps\c"
fi
#
# snmpd - handles MIB2 and the SGI enterprise mib.
#
if test -x $BINDIR/snmpd ; then
$BINDIR/snmpd `cat $CONFIG/snmpd.options 2>/dev/null`
$ECHO " snmpd\c"
fi
#
# hpsnmpd - handles the SGI port of the hp-ux mib.
#
if test -x $BINDIR/hpsnmpd ; then
$BINDIR/hpsnmpd `cat $CONFIG/hpsnmpd.options 2>/dev/null`
$ECHO " hpsnmpd\c"
fi
$ECHO "."
fi
;;
'stop')
#
# Kill all of the agents.
#
/sbin/killall -TERM peer_snmpd peer_encaps snmpd hpsnmpd
;;
*)
echo "usage: $0 {start|stop}"
;;
esac
exit 0

View File

@@ -0,0 +1,17 @@
# static-route.options
#
# The network startup script, /etc/init.d/network, invokes this
# script to set static routes. Site-dependent static routes should
# be put here.
#
# Because name services are not active when this file is invoked, any
# names used here should be defined in /etc/hosts.
#
# Read `man route`.
#
# Since $ROUTE and $QUIET are set in /etc/init.d/network, it is convenient
# to use `route` commands similar to the following here:
#
# $ROUTE $QUIET add -net 10 192.0.2.3
# or
# $ROUTE $QUIET add 192.168.1.1 192.0.2.5

68
eoe/cmd/initpkg/init.d/swap Executable file
View File

@@ -0,0 +1,68 @@
#! /sbin/sh
#Tag 0x00000f00
# Add/Delete swap files other than /dev/swap
# "$Revision: 1.13 $"
cd /
case $1 in
'start')
if /sbin/chkconfig verbose
then
echo "Adding swap areas declared in /etc/fstab\c"
fi
# Mount swap according to file system table /etc/fstab.
# Example:
# /swap/1 swap swap pri=3 0 0
#
/sbin/suattr -C CAP_SWAP_MGT+ip -c "/sbin/swap -m"
if /sbin/chkconfig verbose
then
echo "."
fi
if /sbin/chkconfig vswap
then
vswaplen=80000
if [ -s /etc/config/vswap.options ] ; then
. /etc/config/vswap.options
fi
#
# for now don't let users override vswapfile since an error
# could be costly because of the rm -rf below
#
vswapfile=/.swap.virtual
if /sbin/chkconfig verbose ; then
echo "Adding virtual swap."
fi
if [ ! -f ${vswapfile} ] ; then
rm -rf ${vswapfile}
fi
touch ${vswapfile}
/sbin/suattr -C CAP_SWAP_MGT+ip -c "/sbin/swap -a -v${vswaplen} ${vswapfile} 0 0"
fi
;;
'stop')
if /sbin/chkconfig verbose
then
echo "Removing swap areas\c"
fi
/sbin/suattr -C CAP_SWAP_MGT+ip -c "/sbin/swap -u"
if /sbin/chkconfig verbose
then
echo "."
fi
;;
*)
echo "usage: /etc/init.d/swap {start|stop}"
;;
esac

47
eoe/cmd/initpkg/init.d/sysctlr Executable file
View File

@@ -0,0 +1,47 @@
#! /sbin/sh
#Tag 0x00000f00
# System Controller Daemon
# "$Revision: 1.12 $"
IS_ON=/sbin/chkconfig
case "$1" in
'start')
# Start the system controller daemon
killall -TERM sysctlrd
# Do we want the powermeter?
if $IS_ON cpumeter ; then
# Do we want graceful shutdown?
if $IS_ON cleanpowerdown ; then
/sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -d -g" &
else
/sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -d" &
fi
else
# Do we want graceful shutdown?
if $IS_ON cleanpowerdown ; then
/sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -n -d -g" &
else
/sbin/suattr -C CAP_SCHED_MGT+ip -c "/usr/etc/sysctlrd -n -d" &
fi
fi
;;
'stop')
# Stop the system controller daemon
killall -TERM sysctlrd
sleep 2
/sbin/scmsg "System coming down.."
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

58
eoe/cmd/initpkg/init.d/sysetup Executable file
View File

@@ -0,0 +1,58 @@
#! /sbin/sh
#Tag 0x00000f00
# Initial System Setup
# "$Revision: 1.42 $"
case "$1" in
'start')
# If there are trademark files, print them.
if test -d /etc/tm; then
cat /etc/tm/* 2> /dev/null
fi
# set the system name
/sbin/suattr -C CAP_SYSINFO_MGT+ip -c "hostname `cat /etc/sys_id`"
# Start the syslog-demon
/sbin/suattr -M dbadmin -c "killall syslogd"
/sbin/suattr -M dbadmin -C CAP_DAC_WRITE,CAP_MAC_WRITE,CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -c "/usr/etc/syslogd ""`cat /etc/config/syslogd.options 2> /dev/null`"
# Start the eventmonitor-demon
if test -x /etc/init.d/eventmonitor; then
/etc/init.d/eventmonitor start >/dev/null 2>&1
fi
# Setup Autologin
if test -r /etc/autologin; then
> /etc/autologin.on
fi
for ENTRY in /etc/autologin.ttyd*
do
if test -r $ENTRY
then
> $ENTRY.on
fi
done
;;
'stop')
# Stop the eventmonitor-demon
if test -x /etc/init.d/eventmonitor; then
/etc/init.d/eventmonitor stop >/dev/null 2>&1
fi
# Stop the syslog-demon
/sbin/suattr -M dbadmin -c "killall 15 syslogd"
killall 15 cached
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

View File

@@ -0,0 +1,23 @@
#! /bin/sh
#Tag 0x00000f00
# Initial System Setup
# "$Revision: 1.7 $"
case "$1" in
'start')
# syslogd not started here in miniroot
;;
'stop')
# Stop the syslog-demon
killall 15 syslogd
exit 0
;;
*)
echo "usage: $0 {start|stop}"
;;
esac

80
eoe/cmd/initpkg/init.d/usr Executable file
View File

@@ -0,0 +1,80 @@
#! /sbin/sh
#Tag 0x00000f00
# (u)mount the /usr filesystem (if necessary)
# "$Revision: 1.16 $"
cd /
MESSAGE='\07/usr failed to mount; may be unable to reach multiuser state'
case $1 in
'start')
#
# Mount only the /usr filesystem, and only if neccesary.
#
# This is done so that unbundled products must have initialization
# code run between mounting /usr (where their binaries probably live)
# and mounting the rest of the filesystems.
#
# On Indy (single partition) systems (and possibly others) /usr does
# not normally exist, so we must be able to just exit. The below
# test looks for "@/usr@" or "@/usr/@" in /etc/fstab where @ is
# white space defined by a space or tab. Lines beginning with a #
# are excluded as well as comments.
#
if test -z "`grep -v '^\#' /etc/fstab | sed 's/#.*//' | grep '[ ]/usr[/]*[ ]' `"; then
exit 0
fi
#
# If we don't have any products that require initialization code
# to be run between mounting /usr and mounting the rest of the
# filesystems, then we shouldn't mount /usr now. The serialization
# will slow booting.
#
# We test for this by looking for anything in the boot sequence
# between mounting /usr (executing "/etc/rc2.d/S02usr") and mounting
# the other filesystems (executing "/etc/rc2.d/S12filesystems").
#
if test -n "`/sbin/ls /etc/rc2.d | sed '/S04usr/,/S12filesystems/!d' | \
sed -e '/S04usr/d' -e '/S12filesystems/d'`"; then
# if /usr is already listed in mtab then it's already mounted
# no reason to try mounting again
if grep '^[^ ]* /usr ' /etc/mtab > /dev/null 2>&1
then
exit 0
fi
if /sbin/chkconfig verbose
then
echo "Mounting /usr:"
fi
#
# Check and mount /usr.
#
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -c /usr" > /etc/fscklogs/rusr 2>&1
then
cat /etc/fscklogs/rusr
else
cat /etc/fscklogs/rusr
echo $MESSAGE
sleep 5
fi
fi
;;
'stop')
#
# Unmount /usr.
#
# We use "-k" here because we know that this operation is late in
# the game and we don't want to fail because of running processes.
#
;;
*)
echo "usage: /etc/init.d/usr {start|stop}"
;;
esac

29
eoe/cmd/initpkg/init.d/uucp Executable file
View File

@@ -0,0 +1,29 @@
#! /sbin/sh
#Tag 0x00000f00
# UUCP control
# "$Revision: 1.15 $"
# demons which may be present when taking the system down
DEMONS="UUCICO uucico uusched uux"
case $1 in
'start')
# Clean-up uucp locks, status, and temporary files
set `/sbin/who -r`
if [ $9 = "S" ]
then
/bin/rm -rf /var/spool/locks/*
fi
;;
'stop')
/sbin/killall 15 $DEMONS
sleep 1
/sbin/killall $DEMONS
;;
*)
echo "usage: /etc/init.d/uucp {start|stop}"
;;
esac

View File

@@ -0,0 +1 @@
off

View File

@@ -0,0 +1 @@
off

View File

@@ -0,0 +1,8 @@
#
# This file is used to the startup script /etc/init.d/swap
# to determine the amount of virtual swap to add. You can
# totally disable the addition of virtual swap by
# 'chkconfig vswap off'
# See swap(1M) for a discussion on virtual swap
#
vswaplen=80000

View File

@@ -0,0 +1,33 @@
#!/sbin/sh
#Tag 0x00000f00
#
# Start X Display Manager
#
# $Revision: 1.9 $
#
IS_ON=/sbin/chkconfig
XSGI=/usr/bin/X11/Xsgi
XDM=/usr/bin/X11/xdm
case "$1" in
'start')
if test -x $XDM; then
if $IS_ON windowsystem && test -x $XSGI || $IS_ON xdm
then
exec $XDM
fi
fi
;;
'stop')
/sbin/killall -k 10 -TERM xdm
/sbin/killall -k 10 -TERM Xsgi
rm -rf /var/tmp/.XsgiShmInfo* /var/tmp/.Xsgishm*
;;
*)
echo "usage: /etc/init.d/xdm {start|stop}"
;;
esac

137
eoe/cmd/initpkg/init.d/xlv Executable file
View File

@@ -0,0 +1,137 @@
#! /sbin/sh
#Tag 0x00000f00
# XLV control
# "$Revision: 1.26 $"
always=true
revive_opt=""
startup_xlv ()
{
#
# Get user-supplied command arguments.
#
2>/dev/null read xlv_labd_opt < /etc/config/xlv_labd.options
2>/dev/null read assemble_opt < /etc/config/xlv_assemble.options
2>/dev/null read xlv_plexd_opt < /etc/config/xlv_plexd.options
#
# Get the local nodename directly from the
# /etc/sys_id file. Cannot use hostname(1)
# because the system name may not be set yet.
#
if [ -f /etc/sys_id ] ; then
read name < /etc/sys_id
name=${name%%.*}
else
name="IRIS"
fi
if /sbin/chkconfig verbose ; then
echo "Starting XLV:"
assemble_opt="$assemble_opt -t"
xlv_labd_opt="$xlv_labd_opt -v"
else
assemble_opt="$assemble_opt -q"
fi
# Start the plex revive daemon with a max of 4
# concurrent revives. This daemon needs to be
# started before any mirrored volumes are assembled.
#
if [ -x /sbin/xlv_plexd ]
then
if [ "$always" = "true" ] ; then
killall xlv_plexd > /dev/null 2>&1
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_plexd -m 4 -w 1 $xlv_plexd_opt"
else
ps -ef | grep -v grep | grep xlv_plexd > /dev/null 2>&1
if [ $? != 0 ] ; then
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_plexd -m 4 -w 1 $xlv_plexd_opt"
fi
fi
fi
# Set the geometry of the logical volume.
#
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_assemble -h $name $revive_opt $assemble_opt"
# Make sure that any configuration files written by xlv_assemble
# are written to disk.
/sbin/sync
# Start the label daemon. Note that we start it
# after running xlv_assemble because xlv_labd
# will only hang around if there are logical volumes.
#
if [ -x /sbin/xlv_labd ]
then
# The label daemon could have been automatically
# started by xlv_assemble when it kicked off revives.
#
if [ ! -p /etc/.xlv_labd_fifo ] ; then
/sbin/suattr -C CAP_SCHED_MGT,CAP_MEMORY_MGT,CAP_DEVICE_MGT+ip -c "/sbin/xlv_labd $xlv_labd_opt"
fi
fi
}
#
# M a i n
#
case $1 in
'init')
#
# init process
#
# Remove cruft from the last time system
# was restarted.
#
rm -rf /etc/.xlv_plexd_request_fifo > /dev/null 2>&1
rm -rf /etc/.xlv_labd_fifo > /dev/null 2>&1
rm -rf /dev/xlv > /dev/null 2>&1
rm -rf /dev/rxlv > /dev/null 2>&1
#
# During the "init" phase, xlv_assemble must be
# doing a full revive. This allows root volume
# to be made consistent.
#
revive_opt="-f"
startup_xlv
;;
'start')
#
# (Re)Start operation
#
# Set $always to "false" because we don't want to
# start xlv daemons multiple times.
#
always=false
startup_xlv
;;
'stop')
#
# Shutdown operation
#
if /sbin/chkconfig verbose ; then
echo "Shutting down XLV:"
fi
# /sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_shutdown"
# Stop the label daemon
killall xlv_plexd > /dev/null 2>&1
killall xlv_labd > /dev/null 2>&1
;;
*)
echo "usage: /etc/init.d/xlv {init|start|stop}"
;;
esac

View File

@@ -0,0 +1 @@
on

106
eoe/cmd/initpkg/inittab Normal file
View File

@@ -0,0 +1,106 @@
# Copyright (c) 1984 AT&T
# All Rights Reserved
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#ident "$Revision: 1.72 $"
is:2:initdefault:
fs::sysinit:/etc/bcheckrc </dev/console >/dev/console 2>&1
mt::sysinit:/etc/brc </dev/console >/dev/console 2>&1
link::wait:/etc/lnsyscon > /dev/console 2>&1 < /dev/null
s0:06s:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
s1:1:wait:/sbin/suattr -C CAP_SHUTDOWN+ip -c "exec /etc/shutdown -y -iS -g0" >/dev/console 2>&1 </dev/console
s2:23:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
s3:3:wait:/etc/rc3 >/dev/console 2>&1 </dev/console
s4:06:wait:/sbin/env LANG=C /etc/umountfs > /dev/console 2>&1
of:0:wait:/sbin/suattr -C CAP_SHUTDOWN+ip -c "exec /etc/uadmin 2 0" >/dev/console 2>&1 </dev/console
RB:6:wait:/etc/init.d/announce restart
rb:6:wait:/sbin/suattr -C CAP_SHUTDOWN+ip -c "exec /etc/uadmin 2 1" >/dev/console 2>&1 </dev/console
#
# note that startgfx and stopgfx will manipulate the action
# on the following textport getty line. normal system usage
# does not involve either of these commands, so the action
# will not be changed and this file will not be modified.
# default behavior is "off" for cleaner system boot and
# to reduce the number of processes on the minimal system.
#
tp:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty tport co_9600" # textport
#
# Use the ttym* or ttyf* device names and the du_* or dx_* gettydefs tags
# for ports with modems. See the getty(1M), uugetty(1M), init(1M),
# gettydefs(4), and inittab(4) man pages.
#
# on-board ports or on Challenge/Onyx MP machines, first IO4 board ports
t1:23:respawn:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty ttyd1 console" # alt console
t2:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd2 co_9600" # port 2
t3:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd3 co_9600" # port 3
t4:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd4 co_9600" # port 4
#
# optional cdsio VME serial I/O Board 1
t5:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd5 co_9600" # port 5
t6:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd6 co_9600" # port 6
t7:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd7 co_9600" # port 7
t8:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd8 co_9600" # port 8
t9:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd9 co_9600" # port 9
t10:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd10 co_9600" # port 10
t11:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd11 co_9600" # port 11
t12:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd12 co_9600" # port 12
#
# optional cdsio VME serial I/O Board 2
t13:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd13 co_9600" # port 13
t14:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd14 co_9600" # port 14
t15:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd15 co_9600" # port 15
t16:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd16 co_9600" # port 16
t17:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd17 co_9600" # port 17
t18:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd18 co_9600" # port 18
t19:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd19 co_9600" # port 19
t20:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd20 co_9600" # port 20
#
# optional cdsio VME serial I/O Board 3
t21:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd21 co_9600" # port 21
t22:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd22 co_9600" # port 22
t23:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd23 co_9600" # port 23
t24:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd24 co_9600" # port 24
t25:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd25 co_9600" # port 25
t26:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd26 co_9600" # port 26
t27:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd27 co_9600" # port 27
t28:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd28 co_9600" # port 28
#
# optional cdsio VME serial I/O Board 4
t29:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd29 co_9600" # port 29
t30:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd30 co_9600" # port 30
t31:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd31 co_9600" # port 31
t32:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd32 co_9600" # port 32
t33:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd33 co_9600" # port 33
t34:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd34 co_9600" # port 34
t35:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd35 co_9600" # port 35
t36:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd36 co_9600" # port 36
#
# ON POWER SERIES MACHINE, DO NOT ENABLE THE FOLLOWING LINES UNLESS THE
# CORRESPONDING CPUS ARE PRESENT!
# ON CHALLENGE/ONYX MP MACHINES, DO NOT ENABLE THESE LINES UNLESS THE
# CORRESPONDING IO4 BOARDS ARE PRESENT AND CONFIGURED.
#
# POWER Series on-board ports of CPUs 2 and 3 (2nd CPU board)
# or Challenge/Onyx 2nd IO4 board (t45-t47 only)
t45:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd45 co_9600" # port 45
t46:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd46 co_9600" # port 46
t47:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd47 co_9600" # port 47
t48:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd48 co_9600" # port 48
# On-board ports of CPUs 4 and 5 (3rd CPU board)
# or Challenge/Onyx 3rd IO4 board (t49-t51 only)
t49:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd49 co_9600" # port 49
t50:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd50 co_9600" # port 50
t51:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd51 co_9600" # port 51
t52:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd52 co_9600" # port 52
# On-board ports of CPUs 6 and 7 (4th CPU board)
# or Challenge/Onyx 4th IO4 board (t53-55 only)
t53:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd53 co_9600" # port 53
t54:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd54 co_9600" # port 54
t55:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd55 co_9600" # port 55
t56:23:off:/sbin/suattr -C CAP_FOWNER,CAP_DEVICE_MGT,CAP_DAC_WRITE+ip -c "exec /sbin/getty -N ttyd56 co_9600" # port 56

View File

@@ -0,0 +1,48 @@
# Copyright (c) 1984 AT&T
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#ident "@(#)initpkg:./inittab.sh 1.16"
#ident "$Revision: 1.36 $"
is:2:initdefault:
fs::sysinit:/etc/bcheckrc </dev/console >/dev/console 2>&1
mt::sysinit:/etc/brc </dev/console >/dev/console 2>&1
s0:0s:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
of:0:wait:su root -C CAP_SHUTDOWN+ip -c "exec /sbin/uadmin 2 0" >/dev/console 2>&1 </dev/console # halt
s1:1:wait:su root -C CAP_SHUTDOWN+ip -c "exec /etc/shutdown -y -iS -g0" >/dev/console 2>&1 </dev/console
# setsid: does setsid(2) syscall, opens argv[1] 3 times and execv's argv+2.
# Useful mostly to set process group leader so ^C works.
# /etc/init avoids setpgrp() on :wait: and :bootwait: lines.
prei:2:bootwait:setsid /dev/console /etc/mrinitrc
prel:2:bootwait:setsid /dev/console /etc/mrlogrc start
prec:2:bootwait:setsid /dev/console /etc/mrcustomrc start
pref:2:bootwait:setsid /dev/console /etc/mrcustomrc fx
prek:2:bootwait:setsid /dev/console /etc/mrcustomrc mkfs
prem:2:bootwait:setsid /dev/console /etc/mrmountrc mntlocal
preo:2:bootwait:setsid /dev/console /etc/mrreorgrc reorg
preq:2:bootwait:setsid /dev/console /etc/mrlogrc move
pren:2:bootwait:setsid /dev/console /etc/mrnetrc start
prep:2:wait:setsid /dev/console /sbin/echo Invoking software installation.'\n'
inst:2:wait:setsid /dev/console /etc/mrinstrc
aftp:2:wait:setsid /dev/console /sbin/echo Preparing to restart system ...'\n'
aftc:2:wait:setsid /dev/console /etc/mrcustomrc stop
aftn:2:wait:setsid /dev/console /etc/mrnetrc stop
afto:2:wait:setsid /dev/console /etc/mrreorgrc cleanup
aftv:2:wait:setsid /dev/console /etc/mrvolhdrrc bootnorm
aftl:2:wait:setsid /dev/console /etc/mrlogrc stop
aftm:2:wait:setsid /dev/console /etc/mrmountrc unmntlocal
aftr:2:wait:setsid /dev/console /sbin/echo The system is being restarted.'\n'
aftu:2:wait:setsid /dev/console /sbin/su root -C CAP_SHUTDOWN+ip -c "exec /sbin/uadmin 2 1"
s2:3:wait:/etc/rc2 >/dev/console 2>&1 </dev/console
s3:3:respawn:setsid /dev/console /etc/restore_system

View File

@@ -0,0 +1,22 @@
#! /sbin/sh
#Tag 0x00000f00
#
# lnsyscon - link /dev/syscon to /dev/console
#
# /dev/syscon is the device init treats as the console for single user
# mode and /dev/console redirection in /etc/inittab. The command ``init s''
# changes /dev/syscon to whereever the command is run. This script changes
# it back to /dev/console when the system goes back to multi-user mode.
#
# $Revision: 1.6 $
# make syscon and console the same
set `ls -ilL /dev/console /dev/syscon |
sed -e 's/.*\( [0-9]*\), *\([0-9]*\).*/\1 \2/'`
if test -c /dev/console \
-a '(' ! -c /dev/syscon -o "$1" != "$3" -o "$2" != "$4" ')'
then
rm -rf /dev/syscon
ln /dev/console /dev/syscon
fi

39
eoe/cmd/initpkg/mnthwgfs.sh Executable file
View File

@@ -0,0 +1,39 @@
#! /sbin/sh
#ident "$Revision: 1.7 $"
#
# This script is responsible for mounting the hardware graph file system.
# This is typically invoked by /etc/brc upon bootup. The filesystem is
# mounted on /hw, if that directory exists.
#
# added an argument so we don't need two script that do the same thing.
case $1 in
'/root/hw')
ARG1="/root/hw"
;;
*)
ARG1="/hw"
;;
esac
if [ ! -d $ARG1 ]; then
/bin/rm -rf $ARG1 > /dev/null 2>&1
mkdir $ARG1
fi
if [ -d $ARG1 ]
then
if [ -d $ARG1/.devhdl ]
then
# already mounted, so just make sure there's an mtab entry
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -f -t hwgfs /hw $ARG1"
else
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -t hwgfs /hw $ARG1"
then :
else
echo "Unable to mount $ARG1"
fi
fi
else
echo "warning: $ARG1 mount point does not exist"
fi

View File

@@ -0,0 +1,21 @@
#! /sbin/sh
#ident "$Revision: 1.8 $"
#
# This script is responsible for mounting the /proc (/debug) file system.
# This is typically invoked by /etc/brc upon bootup.
#
# The /proc (ie /debug) directory has to be present since ps
# and killall depend upon this now.
if [ ! -d /debug -o ! -d /proc -o ! -l /debug ] ; then
/sbin/rm -rf /debug /proc > /dev/null 2>&1
mkdir /proc
ln -s proc /debug <&- > /dev/null 2>&1
fi
if /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/mount -t proc /proc /proc"
then :
else
echo "Unable to mount /proc - ps(1) and killall(1M) will not work"
echo "Please see mntproc(1M)"
fi

View File

@@ -0,0 +1,13 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.16 $"
#
# Mount file systems according to file system table /etc/fstab.
# check all filesystems if necessary, in parallel.
if [ -x /sbin/fsck ] ; then
/sbin/fsck -m -c -y
fi
# mount all local filesystems; caller gets exit status of mount as exit status
mount -a -T efs,xfs

276
eoe/cmd/initpkg/mrcleanrc.sh Executable file
View File

@@ -0,0 +1,276 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# miniroot script - clean disks for clean installs.
#
# This script is invoked from miniroot inst when the
# user invokes "admin mkfs" with no arguments to mkfs.
#
# It umounts all the users file systems, cleans (mkfs)
# partitions 0 and (if present) 6 of the boot device,
# and remounts just these partitions as root and (if
# there was a partition 6) usr.
#
# Whatever was there before, such as other mounts, logical
# volumes, user data, inst history, ... is lost.
cat <<-!!
** Clean Disks Procedure **
If you agree to it, this procedure will clean your disks,
removing all data from the root and (if present) the user
file systems.
Boot device partitions zero (0) and, if present, six (6)
will be erased (using mkfs). This will destroy all data on
them. These partitions will then be remounted under /root
and (if present) /root/usr.
If you have data on these file systems you want to save,
answer "no" below, and backup the data before cleaning
your disks.
Any other file systems or logical volumes will be unmounted
and forgotten about until you choose to reconfigure and
remount them.
!!
while : asking if really want to clean disks
do
echo '\n\tAre you sure you want to clean your disks ?'
echo '\t\t { (y)es, (n)o, (sh)ell, (h)elp }: \c'
read line
case "$line" in
[yY]*)
break
;;
[nN]*)
echo
echo Disks not cleaned. Returning to inst.
echo
exit
;;
sh|SH|shell|SHELL)
( echo set prompt="'miniroot> '" > /.prompt ) 2>/dev/null
csh
echo
continue 1
;;
shroot|SHROOT)
chroot /root /bin/csh
echo
continue 1
;;
[hH]*)
cat <<-\!!
yes - Will clean your disks.
New file systems will be made on partitions zero (0) and,
if present, six (6). This will destroy all data on them.
These partitions will be remounted under /root and /root/usr.
If you have data on these file systems you want to save,
answer "no" here, and backup the data before proceeding
with a clean install.
Any other file systems or logical volumes will be unmounted
and forgotten about until you choose to reconfigure them.
no - Will not touch your disks, and return to the inst menus.
sh - Invokes a subshell (csh) in the miniroot, as root.
help - show this message
!!
continue 1
;;
*)
cat <<-\!!
To clean your disks, type "yes" and press ENTER.
To resume installing software, type "no" and press ENTER.
Type "help" for additional explanation.
!!
continue 1
;;
esac
done # asking if really want to clean disks
# Use same do_mkfs() function for both root and usr partitions.
do_mkfs()
{
device=$1
bsize=$2
fsstat $device >&- 2>&-
case $? in
0|1) # 0: The file system is not mounted and appears okay
# 1: File system is not mounted and is dirty (needs fsck)
echo
echo WARNING: There appears to be a valid file system on $device already.
echo Making a new file system will destroy all existing data on it.
;;
2) # fsstat says file system is mounted (still? - darn!)
echo
echo ERROR: Unmount of $device failed.
echo Disks not cleaned. Returning to inst.
echo
exit
;;
3) # fsstat didnt find any file system - cool
;;
esac
while : asking to mkfs device
do
echo
echo Make new file system on $device? '\c'
read line
case "$line" in
yes|YES)
echo '\n'Doing: mkfs -b size=$bsize $device
mkfs -b size=$bsize $device
return
;;
no|NO)
echo
echo Skipping mkfs of $device.
echo Disks not cleaned. Returning to inst.
echo
mrmountrc mntlocal
exit
;;
sh|SH)
( echo set prompt="'miniroot> '" > /.prompt ) 2>/dev/null
csh
echo
continue 1
;;
shroot|SHROOT)
chroot /root /bin/csh
echo
continue 1
;;
[hH]*)
cat <<-!!
yes - Will cause mkfs to be run on partition:
$device
Any data on this partition will be lost.
If there might be useful data here, you
should back it up before consenting to this
mkfs.
no - Will leave $device unchanged.
sh - Invokes a subshell (using C Shell csh), in the
miniroot, as root. This permits the use of available
IRIX utilities to administer your system. You can
also type "shroot" to chroot csh below /root.
help - show this message
!!
continue 1
;;
*)
echo Please answer \"yes\" or \"no\".
continue 1
;;
esac
done # asking to mkfs device
} # end of do_mkfs() function
#######################################################################
umount -k /root/hw >/dev/null 2>&1
umount -k -T efs,xfs -b / >/dev/null 2>&1
root=`devnm / | sed 's/. .*/0/'` # Jam '0' on end of swap device
usr=`devnm / | sed 's/. .*/6/'` # Jam '6' on end of swap device
## mkfs and mount root partition
if prtvtoc -s -h $root |
awk '$1 == 6 && ( $2 == "efs" || $2 == "xfs" || $2 == "xlv" )' |
grep . > /dev/null
then
root_bsize=512
haveusr=1
else
root_bsize=4096
haveusr=0
fi
do_mkfs $root $root_bsize root
test -d /root || mkdir /root > /dev/null 2>&1
mount -c $root /root || {
echo
echo ERROR: Mount of $root on /root failed.
echo Returning to inst.
echo
exit
}
mount -p > /etc/fstab.Sav
cp /etc/fstab.Sav /etc/fstab
mkdir /root/etc /root/usr
echo "/dev/root / xfs rw,raw=/dev/rroot 0 0" > /root/etc/fstab
## mount hwgraph
mkdir /root/hw
/etc/mnthwgfs /root/hw
## mkfs and mount usr partition (if present)
if [ $haveusr = 1 ]
then
# There is a partition 6, mkfs it and mount as usr file system.
do_mkfs $usr 4096
mount -c $usr /root/usr || {
echo
echo ERROR: Mount of $usr on /root/usr failed.
echo Returning to inst.
echo
exit
}
echo "/dev/usr /usr xfs rw,raw=/dev/rusr 0 0" >> /root/etc/fstab
echo "$usr /root/usr xfs rw 0 0" >> /etc/fstab
mkdir /root/usr/var
ln -s usr/var /root/var
else
mkdir /root/var
fi
# show user what's mounted
echo "\nMounting file systems:\n"
mount -p | awk '
$3 == "efs" || $3 == "xfs" { printf " %-23s on %s\n", $1, $2; }
'
echo
echo
# restart syslogd
/etc/mrlogrc start

125
eoe/cmd/initpkg/mrconfigrc.sh Executable file
View File

@@ -0,0 +1,125 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
# Reconfigure kernel under /root.
# Invoked from mrinstrc, after inst exit successfully.
# If there is a /root/unix.install, move it to /root/unix
. mrprofrc
status=0
unix=/root/unix
unixS=/unix
unixSZ=/unix.gz
unixZ=/unix.root.Z
unixI=/root/unix.install
#
# Compress the kernel in /unix ... not the /root ...
# at least no yet. This should allow the safety
# kernel (below) to be saved without increasing
# the amount of swap space for miniroot.
#
if test -f $unixS -a -s $unixS
then
gzip $unixS || rm -rf $unixSZ
fi
# If the autoconfig script isn't present or if it reports
# there is no work to do, leave quietly. Likely, they
# haven't installed much yet.
# However, first check to see if the /root/unix has a date of
# 1 Jan 2000, which could happen if an old-style "0101000000"
# was run as part of a removeop on a patch, for example.
#
test -f /root/etc/init.d/autoconfig || exit
if [ "`stat -qm /root/unix`" -eq 946713600 ] ; then
touch -c -t 197001010000 /root/unix
fi
chroot /root /etc/init.d/autoconfig -n -o -N >/dev/null 2>&1 && exit
echo Automatically reconfiguring the operating system.
# Compress /root/unix into /unix.root.Z and zero-out /root/unix
# we preserve acc/mod times for autoconfig and/or in case of
# failures
#
test -f $unix -a -s $unix && {
gzip -c $unix > $unixZ || rm -f $unixZ
if [ -s $unixZ ]
then
touch -r $unix $unixZ
rm -f $unix
touch -r $unixZ $unix
fi
# else the gzip failed, and we don't want to create a /root
# unix with a modtime of right now, because that turns autoconfig
# into a nop.
}
# Reconfigure the kernel
#
if echo y | chroot /root /etc/init.d/autoconfig -o -N >/dev/null
then
if test -f $unixI -a -s $unixI
then
mv -f $unixI $unix
else
# we should never get here because we just made sure via
# autoconfig -n that a new kernel would get configured.
# just in case though...
if test -f $unixZ
then
gunzip -c $unixZ > $unix
touch -r $unixZ $unix
fi
fi
else
cat <<-\!!
ERROR IN KERNEL CONFIGURATION
The UNIX kernel is not properly installed on the system, probably as
a result of an autoconfig(1M) failure.
To correct the problem, return to inst by answering "n" to the restart
question below, then give the command "help kernelerror" to get more
information that will help you diagnose and solve the problem.
If you answer "y" to the restart question below, the system may not come
up properly, or the system may come up running an old kernel that might
be incompatible with the new software you just installed.
!!
status=1
fi
# Cleanup
#
if test -f $unixZ -a \( ! -f $unix -o ! -s $unix \)
then
gunzip -c $unixZ > $unix
touch -r $unixZ $unix
fi
rm -f $unixZ > /dev/null
#
# Wait for $unixZ to be removed before
# trying to gunzip the /unix. Just incase
# we need to retry miniroot install again.
#
if test -f $unixSZ -a -s $unixSZ
then
gunzip $unixSZ
fi
rm -f $unixSZ > /dev/null
# mrinstrc needs to know if autoconfig failed
exit $status

File diff suppressed because it is too large Load Diff

29
eoe/cmd/initpkg/mrinitrc.sh Executable file
View File

@@ -0,0 +1,29 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# Easy stuff that is delayed until entering initstate 2.
# Easy in that it doesn't have any other initstate 2 prereqs
# and in that it is unlikely to fail.
# Delayed until state 2 because it does have significant
# impact and isn't essential for single user.
date '+%nCurrent system date is %a %b %d %T %Z %Y%n'
test -d /var/tmp || mkdir /var/tmp 2>/dev/null
if test ! -f /usr/tmp/swap.virtual
then
touch /usr/tmp/swap.virtual
swap -a -v 80000 /usr/tmp/swap.virtual 0 0
echo "/usr/tmp/swap.virtual swap swap vlength=80000 0 0" >> /etc/fstab
fi
mrmode=`nvram mrmode 2>/dev/null`
if test "$mrmode" = test
then
echo "Miniroot test mode - type exit when ready to continue"
/bin/csh
fi

39
eoe/cmd/initpkg/mrinitxlvrc.sh Executable file
View File

@@ -0,0 +1,39 @@
#! /sbin/sh
#Tag 0x00000f00
# XLV startup for miniroot
# Executed from mrmountrc
# "$Revision: 1.11 $"
if [ -f /root/etc/sys_id ] ; then
name=`cat /root/etc/sys_id | sed 's/\([0-z]*\)\..*/\1/'`
elif [ -f /etc/sys_id ] ; then
name=`cat /etc/sys_id | sed 's/\([0-z]*\)\..*/\1/'`
else
name="IRIS"
fi
# Mark the plex from which we booted up clean; mark the others stale.
normalroot=`devnm / | sed 's/. .*/0/'` # Jam '0' on end of swap device
/sbin/xlv_set_primary $normalroot
/sbin/rm -rf /dev/dsk/xlv > /dev/null 2>&1
/sbin/rm -rf /dev/rdsk/xlv > /dev/null 2>&1
# Start up the plex revive daemon; xlv_admin may issue plex revive
# requests.
/sbin/xlv_plexd -m 4
# Set the geometry of the logical volume. Create the output in
# /root. Remember, even in the miniroot, we mount devices from
# /root/dev/dsk/xlv instead of /dev/dsk/xlv (except for /root itself).
#
/sbin/xlv_assemble -Pqr /root -h $name > /dev/null 2>&1
# Make sure the configuration makes it out to disk
/sbin/sync
# Start the label daemon
# We start it after xlv_assemble because xlv_labd will exit if there
# are no logical volumes.
/sbin/xlv_labd > /dev/null 2>&1

502
eoe/cmd/initpkg/mrinstrc.sh Executable file
View File

@@ -0,0 +1,502 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
SHELL=/bin/csh; export SHELL
MRNETRC=/etc/mrnetrc
# miniroot script - invoke inst in the miniroot.
#
# If inst exit's with a non-zero value (not successful),
# then:
# 1) if there is a core, move it to /root/usr/tmp
# 2) explain to the user what happened
#
# In any case, ask the user whether they want to go right back into
# inst, or they want to leave the miniroot and
# boot off the normal root.
#
# The expectation is that inst won't let the user quit
# until /root has a useful system installed on it. This is handled
# (or at least, user is notified it wasn't true) by sash setting
# the OSLoadOptions nvram variable to begin with "INST", and when
# we complete normally, the mrvolhdrrc script clears removes the
# leading INST, and sets it to start with "inst", so sash can do any
# necessary cleanup (this used to involve changing the volhdr
# root partition to be the same as swap, but no longer; we could just
# clear the leading "INST", but set to "inst" in case it turns out we want
# more cleanup later on). sash needs the code anyway to allow the user
# to cleanup if they don't want to (re)load the miniroot.
#
# Anytime inst exits, we let the user leave the miniroot,
# either because inst voluntarily exit'd, and it's ok, or
# because inst croaked, and we should let the user out of
# this mad house if they want.
tapedevice=`nvram tapedevice 2>/dev/null || echo 0`
dlserver=`nvram dlserver 2>/dev/null || echo 0`
instfromopt=
cdromBlockDev=/ # '/' is for sure not a block-device file
tapeRawDev=/ # '/' is for sure not a char-device file
mrmode=`nvram mrmode 2>/dev/null || echo 0`
# Determine if we were invoked as part of an automatic miniroot boot.
# If so, inst must be invoked in command mode with the provided
# command file.
automr_file=/var/tmp/.auto_mr
hist_file=/root/var/inst/hist
automr_vh=auto_mr
commandfile=
actual_sum=00000
hist_sum=
/sbin/dvhtool -v g $automr_vh $automr_file > /dev/null 2>&1
# We cannot rely on the dvhtool exit status
if [ -s $automr_file ] ; then
sa=`grep "^SA=" $automr_file | sed s/\^SA=//`
tape=`echo $tapedevice | sed s/\(mr\)$//`
# In case the user has changed install sites from the prom
if [ "$sa" = "$tape" ] ; then
commandfile=`grep "^CFILE=" $automr_file | sed s/\^CFILE=//`
# move the command file into a temporary name so if the machine
# panics or needs to be reset during inst we don't automatically
# run the command file again
if [ -r "$commandfile" ] ; then
mv -f "$commandfile" "$commandfile".O
commandfile="$commandfile".O
else
commandfile=
fi
# dlserver is a variable normally set in the prom
# that we must set manually
dlserver=`grep "^dlserver=" $automr_file | sed s/\^dlserver=//`
fi
# If user has provided a comparision hist file checksum, make
# sure actual hist file checksum is the same. Otherwise,
# bag command mode.
hist_sum=`grep "^SUM=" $automr_file | sed s/\^SUM=//`
if echo "$hist_sum" | grep . > /dev/null ; then
if [ -r "$hist_file" ] ; then
actual_sum=`sum -r $hist_file | awk '{print $1}'`
fi
if [ "$hist_sum" != "$actual_sum" ] ; then
commandfile=
fi
fi
fi
## Figure out what we booted from.
## If used bootp to boot from net, set inst -f option to the
## server and directory thereon from which we booted.
## If used local CDROM, set $cdromBlockDev for code that follows,
## which will mount the CDROM correctly and set inst -f option for it.
## Case 1: booting from net, using bootp
if echo "$tapedevice" | grep '.*bootp()[^ :()]*:[^ :()]*/sa(mr)' >/dev/null
then
# If tapedevice is read in as bootp()taylor:/var/boot/sa(mr)
# then we pass it to inst as -f taylor:/var/boot/sa
# On Indy's (ARCS proms?), tapedevice is preceeded by "network(0)".
# Strip that as well.
instfromopt=`echo "$tapedevice" |
sed 's;.*bootp()\([^ :()]*:[^ :()]*\)/sa(mr);-f\1;'`
machtype=`uname -m`
# Copy miniroot unix to /
location=`echo "$tapedevice" |
sed 's;.*\([^ :()]*:[^ :()]*\)/sa(mr);\1/miniroot;'`
kernel=$dlserver$location/unix.`uname -m`
# Check if the network it running ... just in case
$MRNETRC netisup
if [ $? -ne 0 ]
then
# Network down ... attempt a restart
$MRNETRC forcestart askipaddr
fi
tftp <<- EOF >/dev/null 2>&1
mode binary
get $kernel /unix
quit
EOF
if [ ! -f /unix -o ! -s /unix ]
then
# try again, might work this time...
tftp <<- EOF >/dev/null 2>&1
mode binary
get $kernel /unix
quit
EOF
if [ ! -f /unix -o ! -s /unix ]
then
echo "TFTP failure: get $kernel /unix\n\t(tapedevice=$tapedevice)"
fi
fi
## Case 2: booting from local CDROM, with ARCS proms
elif echo "$tapedevice" |
grep '.*scsi([0-9][0-9]*)cdrom([0-9][0-9]*)partition(8)(mr)' >&-
then
# On ARCS proms, if boot from CDROM, then tapedevice
# nicely shows that as: scsi(0)cdrom(7)partition(8)(mr)
cdromSCSIctlr=`echo "$tapedevice" |
sed 's;.*scsi(\([0-9][0-9]*\))cdrom([0-9][0-9]*)partition(8)(mr);\1;'`
cdromSCSIunit=`echo "$tapedevice" |
sed 's;.*scsi([0-9][0-9]*)cdrom(\([0-9][0-9]*\))partition(8)(mr);\1;'`
cdromBlockDev=/dev/dsk/dks${cdromSCSIctlr}d${cdromSCSIunit}s7
## Case 3: booting from local tape, with ARCS proms
elif echo "$tapedevice" |
grep '.*scsi([0-9][0-9]*)tape([0-9][0-9]*)(mr)' >&-
then
# On ARCS proms, if boot from Tape, then tapedevice
# nicely shows that as: scsi(0)tape(7)(mr)
tapeSCSIctlr=`echo "$tapedevice" |
sed 's;.*scsi(\([0-9][0-9]*\))tape([0-9][0-9]*)(mr);\1;'`
tapeSCSIunit=`echo "$tapedevice" |
sed 's;.*scsi([0-9][0-9]*)tape(\([0-9][0-9]*\))(mr);\1;'`
tapeRawDev=/dev/rmt/tps${tapeSCSIctlr}d${tapeSCSIunit}nrs
fi
# If booting from CDROM, then we mount the CDROM and pass inst -f/CDROM/dist
if test -b $cdromBlockDev
then
# If user had CDROM in their fstab, we already mounted it.
# We have to unmount it, and try to get that entry out of the
# miniroot /etc/fstab, so that we can mount it on /CDROM
# instead of on, as is likely, /root/CDROM. The umount
# command won't clean up /etc/mtab unless invoked with a
# block dev or mount pt that matches what it is mounted by.
# So we'll try that way if we can find the old fstab line.
cntFstabCDromLines=`egrep -c $cdromBlockDev'|/CDROM' /etc/fstab`
if test $cntFstabCDromLines -eq 1
then
egrep -v $cdromBlockDev'|/CDROM' /etc/fstab > /etc/fstab.NEW
oldCDromMntDev=`egrep $cdromBlockDev'|/CDROM' /etc/fstab | awk '
{print $1}'`
mv /etc/fstab.NEW /etc/fstab
( umount $oldCDromMntDev ) 1>&- 2>&-
fi
# In any case do our best to see that its unmounted
( umount $cdromBlockDev ) 1>&- 2>&-
# Now mkdir /CDROM
( rm -f /CDROM; test -d /CDROM || mkdir /CDROM ) 1>&- 2>&-
instfromopt="-f/CDROM/dist"
# Copy unix to / (ie. swap) ....
# First mount /CDROM and then copy unix ...
machtype=`uname -m`
echo "$cdromBlockDev /CDROM efs ro,noquota 0 0" >> /etc/fstab
mount /CDROM
cp /CDROM/dist/miniroot/unix.$machtype /unix
umount /CDROM
fi
# If booting from Tape, then set instfromopt accordingly
if test -c $tapeRawDev
then
instfromopt="-f$tapeRawDev"
fi
# If first argument is "before", then save the current size/checksum
# of the hist file in a signature file. If the argument is "after", then
# compare the history signature to the previous file. If the files
# differ, an install has been performed with the inst in this miniroot.
# If 6.2-6.4 is installed, this means /root/usr/sbin/inst won't be
# able to read the hist format on bootup, so downgrade using inst -Z.
chkhistformat()
{
sigfile=/tmp/hist$1.$$ # histbefore or histafter
rm -f $sigfile
if [ -f /root/var/inst/hist ]; then
/sbin/stat -qs /root/var/inst/hist > $sigfile
sum -r /root/var/inst/hist | nawk '{print $1'} >> $sigfile
else
cat /dev/null > $sigfile
fi
if [ "$1" = after -a -f /tmp/histbefore.$$ -a -f /tmp/histafter.$$ ]; then
cmp /tmp/histbefore.$$ /tmp/histafter.$$ > /dev/null 2>&1 || {
# Is 6.2-6.4 eoe.sw.unix installed?
echo admin hardware | /usr/sbin/inst -r /root -Vverbose:on 2>&1 \
| nawk -F= -v s=1 \
'{ if ($1 == "TARGOS" && match($2,"^[0-9]+$") \
&& (int($2) < 1270000000)) s=0 }
END { exit s }' || return
# Old inst needs old hist format
echo "Converting installation history format"
/usr/sbin/inst -r /root -Z
}
fi
}
# custom mode and commandfile mode should only ever run once between them
firsttime=1
while : reinvoking inst
do
instcmd=inst
test -f /usr/sbin/inst || {
echo Cannot find installation utility /usr/sbin/inst
instcmd=false
}
rm -f core
# Keep track of whether the hist file changes. Make a reference
# file whose timestamp is either now, or the same as the current
# hist file.
chkhistformat before
# Testing hook. You can shell escape from inst, make a
# symlink /dbx to a copy of dbx (or gnome?) under /root,
# and replace the miniroot /usr/sbin/inst with a non-stripped
# inst from under /root (copy or symlink), then exit
# the subshell, quit inst, answer 'n' to the restart question,
# and end back up running the non-stripped inst under dbx.
if test -f /dbx
then
trap 2
echo
echo Invoking $instcmd under dbx.
echo Use dbx command \"run -r /root\" to start $instcmd
echo
/dbx /usr/sbin/$instcmd
elif mrcustomrc iscustom && [ $firsttime -eq 1 ] ; then
# In custom mode, execute preinst and inst phases
# otherwise use inst commands from mrconfig and
# ignore exit codes here
firsttime=0
mrcustomrc preinst -r /root "$instfromopt"
mrcustomrc inst -r /root "$instfromopt"
/bin/true
elif [ -n "$commandfile" -a $firsttime -eq 1 ]; then
firsttime=0
# Only invoke inst in command mode once. Any subsequent
# invocation probably indicates trouble so interactive
# mode is the safest choice
$instcmd -r /root -c $commandfile
elif [ "$instfromopt" ]; then
$instcmd -r /root "$instfromopt"
else
$instcmd -r /root
fi
instExitVal=$?
# inst may have been in graphical mode in which case we need
# to bring back the textport for possible user interaction
restoretextport
# if irix 6.2/6.3/6.4 was installed, downgrade history to
# an older format.
chkhistformat after
# Should be "if test $instExitVal -ne 0" but new inst
# exits non-zero for a variety of trivial reasons.
if test $instExitVal -gt 128
then
# Handle non-successful inst exit values.
cat <<-\!!
Installation Termination Error
An error has occurred during your installation session.
The installation program has terminated abnormally.
!!
test $instExitVal -gt 128 && {
exitSignal=`expr $instExitVal - 128`
case $exitSignal in
4|5|6|7|8|10|11|12) # ILL|TRAP|ABRT|EMT|FPE|BUS|SEGV|SYS)
test -s core -a -d /root/usr/tmp &&
( file core | grep "dump of '$instcmd'" ) >&- 2>&- &&
echo '\nSaving state. Please wait ...'
gzip < core > /root/usr/tmp/$instcmd.core.Z &&
egrep Header core |
sed -n '
/.*\(.Header:[ -#%-~]*\$\).*/s//\1/p
' > /root/usr/tmp/$instcmd.ident &&
rm core &&
sync &&
cat <<-!!
The $instcmd program dumped core. A copy of the core
was saved in /root/usr/tmp/$instcmd.core.Z
!!
;;
esac
}
cat <<-!!
You may be able to proceed with the installation by reentering $instcmd and
continuing the installation process. To do this, answer "n" to the restart
question below. If you answer "y" to the restart question, the system will
attempt to boot the UNIX kernel in /unix. In either case, your system has
been left in an unknown state and re-installation of the software you were
trying to install is recommended.
!!
fi
# run autoconfig and move /root/unix.install to /root/unix,
# except in custom mode, where this is handled by mrcustomrc
if mrcustomrc iscustom ; then
mrcustomrc autoconfig
else
mrconfigrc
fi
configExitVal=$?
if [ -d /root/dev/dsk/xlv -o -d /dev/dsk/xlv ] ; then
#
# The xlv device directory exists, look for logical volumes.
#
mrcnt=`/bin/ls /root/dev/dsk/xlv 2> /dev/null | /sbin/wc -w`
rcnt=`/bin/ls /dev/dsk/xlv 2> /dev/null | /sbin/wc -w`
cnt=`expr $rcnt + $mrcnt`
if [ $cnt -eq 0 ] ; then
#
# There are no logical volumes so remove the directories.
#
rm -rf /root/dev/dsk/xlv > /dev/null 2>&1
rm -rf /root/dev/rdsk/xlv > /dev/null 2>&1
else
#
# There are logical volumes. Verify that the xlv software
# is present on this system.
#
if [ ! -x /root/sbin/xlv_assemble ] ; then
cat <<-\!!
WARNING: There appear to be xlv volumes but the xlv software does not
appear to be installed. To correct the problem, return to inst by
answering "n" to the restart question below and then install the xlv
subsystem. If you answer "y" to the restart question below, the system
may not come up properly.
!!
fi
fi
fi
# If inst was invoked as part of an automatic miniroot boot and
# the install did not core dump and the kernel was built properly
# exit quietly and attempt to restart the system.
# If inst is reinvoked, make sure it is in interactive mode
if echo "$commandfile" | grep . > /dev/null ; then
commandfile=
/sbin/dvhtool -v d $automr_vh > /dev/null 2>&1
if [ $instExitVal -lt 128 -a $configExitVal -eq 0 ] ; then
exit 0
fi
fi
# Same for mrmode=custom, except if there is an old kernel
# might as well attempt a reboot. Report autoconfig status
# and run postinst.
if mrcustomrc iscustom ; then
mrcustomrc postinst -r /root "$instfromopt"
if [ $configExitVal -eq 0 -o -s /root/unix ]; then
exit 0
else
mrmode=0
fi
fi
while : asking user whether to restart the system
do
echo 'Ready to restart the system. Restart? { (y)es, (n)o, (sh)ell, (h)elp }: \c'
read line
case "$line" in
[yY]*)
break 2 # leaves inst reinvoking loop
;;
[nN]*)
echo Reinvoking software installation.
break # reinvoking inst
;;
sh|SH|shell|SHELL)
( echo set prompt="'miniroot> '" > /.prompt ) > /dev/null
csh
echo
;;
shroot)
chroot /root /bin/csh
echo
;;
[hH]*)
cat <<-\!!
yes - Will leave this miniroot and reboot
from your system disk.
no - Will reinvoke the software installation tool
from this miniroot.
sh - Invoke a subshell (using C Shell csh),
in the miniroot, as root. You can also
type "shroot" to chroot csh below /root.
help - show this message
!!
;;
*)
cat <<-\!!
To reboot from your system disk, type "yes" and press ENTER.
To resume installing software, type "no" and press ENTER.
Type "help" for additional explanation.
!!
esac
done # asking user whether to restart the system
done # reinvoking inst

View File

@@ -0,0 +1,53 @@
#include <stdio.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <net/if.h>
/*
*
* This code is to be used in miniroot instead of using
* netstat in the mrnetrc script.
*
* The problem with using netstat is that is uses NLIST
* but it is possible that the kernel has not been
* placed on the /swap filesystem yet. Thus causing
* netstat to fail and print "/unix no namelist" error message.
*
* The script that calls this routine either expects success (0)
* or failure (1). This is the reason why the if a system call
* errors the return value is "-1".
*
*/
main()
{
int s, n;
char buf[BUFSIZ];
struct ifconf ifc;
struct ifreq ifreq, *ifr;
if ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
return(-1);
ifc.ifc_len = sizeof (buf);
ifc.ifc_buf = buf;
if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
return(-1);
ifr = ifc.ifc_req;
for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++) {
if (strncmp(ifr->ifr_name,"lo0",3) != 0) {
ifreq = *ifr;
if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0)
return(-1);
if ((ifreq.ifr_flags & (IFF_UP|IFF_RUNNING))
== (IFF_UP|IFF_RUNNING))
return(0);
}
}
/*
* At this point the network is not up and running ....
*/
return (1);
}

View File

@@ -0,0 +1,94 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# Ignore SIGHUP. This is needed so that processes that haven't had
# a chance to run long enough to daemonize won't get killed when
# this script exits.
#
trap "" 1
LOGGER=/usr/bsd/logger
case "$1" in
start)
# check case where old miniroot is being reused. we do not want
# modified syslog.conf in place initially
test -s /etc/syslog.conf.orig && mv /etc/syslog.conf.orig /etc/syslog.conf 2>/dev/null
cp /etc/syslog.conf /etc/syslog.conf.orig 2>/dev/null
/usr/etc/syslogd
;;
restart)
test -d /root/var/adm || mkdir -p /root/var/adm 2>/dev/null
/usr/etc/syslogd
;;
stop)
killall -TERM syslogd
;;
move)
( cat /etc/syslog.conf | sed "s/ \/var\/adm\/SYSLOG/ \/root\/var\/adm\/SYSLOG/" > /etc/syslog.conf.sav ) 2> /dev/null
if [ -s /etc/syslog.conf.sav ] ; then
mv -f /etc/syslog.conf.sav /etc/syslog.conf
test -d /root/var/adm || mkdir -p /root/var/adm 2>/dev/null
(cat /var/adm/SYSLOG >> /root/var/adm/SYSLOG) 2>/dev/null
rm -f /var/adm/SYSLOG 2>/dev/null
killall -HUP syslogd
fi
rm -f /etc/syslog.conf.sav 2>/dev/null
;;
addhost)
shift 2>/dev/null
tmp1=/etc/syslog.conf1.$$
tmp2=/etc/syslog.conf2.$$
tmp3=/etc/syslog.conf3.$$
sed -n 's/^##may be uncommented##//p' /etc/syslog.conf >$tmp1 2>/dev/null
if [ -s $tmp1 ]; then
( for host in $* ; do
echo '## remote loghost '$host' ##'
sed 's/ @.*/ @'$host'/g' $tmp1
echo '## done loghost '$host' ##'
done ) >$tmp2 2>/dev/null
fi
if [ -s $tmp2 ]; then
cat /etc/syslog.conf $tmp2 > $tmp3 2>/dev/null
mv $tmp3 /etc/syslog.conf
killall -HUP syslogd
fi
rm -f $tmp1 $tmp2 $tmp3 2>/dev/null
;;
localoff) # comment-out the local entries
nawk ' /## remote loghost .* /,/## done loghost .* ##/ { print;next; }
{ printf "## savelocal ##%s\n", $0 }' /etc/syslog.conf \
>/etc/syslog.conf.sav 2>/dev/null
mv /etc/syslog.conf.sav /etc/syslog.conf
killall -HUP syslogd
;;
localon) # restore the commented-out local entries
sed 's/## savelocal ##//g' /etc/syslog.conf \
>/etc/syslog.conf.sav 2>/dev/null
mv /etc/syslog.conf.sav /etc/syslog.conf
killall -HUP syslogd
;;
*)
echo "usage: $0 {start|stop|restart|move|addhost ipaddr}"
;;
esac

169
eoe/cmd/initpkg/mrmkfsrc.sh Normal file
View File

@@ -0,0 +1,169 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# miniroot script - handles running mkfs on specified file system.
#
# This script is called from mrmountrc,
# and from inst to handle admin:mkfs.
# It is not invoked directly from inittab.
interactive=1
if [ "$1" = "-a" ]; then
interactive=0
shift
fi
if [ $# -lt 1 ]; then
echo "Usage: mrmkfsrc device" 1>&2
echo " mrmkfsrc -a device fstype blocksize" 1>&2
exit 1
fi
# type, blocksize and mkfsopts are only used in automatic mode (-a)
device="$1"; test $# -gt 0 && shift
fstype="$1"; test $# -gt 0 && shift
bsize="$1"; test $# -gt 0 && shift
mkfsopts="$*" # additional args for mkfs
test -b "$device" || {
{ test -c "$device" && echo Specify block device, not raw.; } ||
{ test -n "$device" && echo Unable to mkfs \""$device"\": No such device; } ||
echo mrmkfsrc device option missing - internal error
exit 1
}
# If device is mounted, need to unmount it.
directory=`mount -p | awk '$1 == "'"$device"'" { print $2 }'`
test -d "$directory" && {
echo Unmounting device \""$device"\" from directory \""$directory"\".
# umount below directory, silently.
umount /root/hw 2>&-
umount -T efs,xfs -b /,/root,"$directory" 2>&-
# umount directory itself. Let user see errors.
umount "$directory" || { echo Unmount failed.; exit 1; }
}
# Raw device is much faster, especially on large disks.
mntflags=`awk < /etc/fstab '$1 == "'"$device"'" { print $4}'`
trialrawdevice=`echo "$mntflags" | sed 's/.*,raw=\([^,]*\).*/\1/'`
# If fstab doesn't say what the rawdevice is, try simply
# replacing "/dsk/" with "/rdsk/" in device pathname.
test -c "$trialrawdevice" || trialrawdevice=`echo "$device" |
sed -n '/\/dev\/dsk\//s;/dev/dsk/;/dev/rdsk/;p'`
# If trialrawdevice is raw match to device, mkfs it instead.
#
# I show the user the device name "$device", but actually
# mkfs "$mkfsdevice", which is either equal to "$device" or
# is the raw character device equivalent to the block device
# "$device". I do this because otherwise I have to show the
# user that we are not mkfs'ing exactly what they asked to
# mkfs, and I fear such a discrepancy in what the user sees
# will cause more pain and suffering than will this white lie.
# Seems better not to confuse the user with the details of
# this performance tweak.
mkfsdevice="$device"
if test -b "$device" -a -c "$trialrawdevice" &&
test `stat -qd "$device"` -eq `stat -qd "$trialrawdevice"`
then
mkfsdevice="$trialrawdevice"
fi
# If non-interactive, make fs now and exit without prompting
if [ "$interactive" = 0 ]; then
if [ "$fstype" = efs ]; then
mkfs -t efs $mkfsopts $mkfsdevice
exit $?
elif [ "$fstype" = xfs ]; then
bsopts=""
if test "$bsize" != "" &&
echo "$mkfsopts" | grep -vq "\-b[ \t]*size=" ; then
# mkfsopts overrides bsize as mkfs disliked multiple -b opts
bsopts="-b size=$bsize"
fi
mkfs -t xfs $bsopts $mkfsopts $mkfsdevice
exit $?
else
echo "Invalid filesystem type $fstype for $device"
exit 1
fi
fi
while : user calls sh or help
do
echo '\n'Make new file system on "$device" '[yes/no/sh/help]: \c'
read line
case "$line" in
yes|YES)
echo '\n'About to remake '(mkfs)' file system on: "$device"
echo This will destroy all data on disk partition: "$device".
echo '\n\tAre you sure? [y/n] (n): \c'
read ok
case "$ok" in
[yY]*)
echo '\n\tBlock size of filesystem 512 or 4096 bytes? \c'
read bsize
case "$bsize" in
512|1024|2048|4096)
echo '\n'Doing: mkfs -b size=$bsize $device
mkfs -t xfs -b size=$bsize $mkfsdevice
exit 0
;;
*)
echo Did not attempt mkfs, no valid size given.
;;
esac
;;
*)
echo Did not attempt mkfs.
exit 1
;;
esac
;;
no|NO)
echo Did not attempt mkfs.
exit 1
;;
sh|SH)
( echo set prompt="'miniroot> '" > /.prompt ) 2>/dev/null
csh
echo
;;
[hH]*)
cat <<-!!
yes - Will cause mkfs to be run on partition:
$device
Any data on this partition will be lost.
If there might be useful data here, you
should back it up before consenting to this
mkfs.
no - Will return without attempting mkfs.
sh - Invoke a subshell, permitting use of available
IRIX utilities to repair this partition.
help - show this message
!!
;;
*)
cat <<-\!!
Type one of the words: "yes", "no", "sh" or "help".
Then press the Enter key.
!!
;;
esac
done

492
eoe/cmd/initpkg/mrmountrc.sh Executable file
View File

@@ -0,0 +1,492 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# miniroot script - mount normal file systems when entering state 2.
#
# This script is run in the miniroot to mount the normal file systems.
# Since it is marked with action "bootwait" in inittab, it is processed
# the first time init goes from single-user to multi-user state after
# the system is booted.
#
# It has to:
# Mount the normal root file system under /root
# Initialize any logical volumes specified in /root/etc/lvtab
# Mount "some" of the other file systems specified in /root/etc/fstab,
# or, if there is no such fstab, try to mount partition 6 as /root/usr.
# With the user's permission and if necessary, mkfs root or usr.
#
# Notes:
#
# The normal file system is presumed to be on the 0 partition
# of the same device as the miniroot was booted from.
#
# That is, the result of `devnm /` (usually swap partition 1)
# has the last byte of the special file name forced to '0',
# and the result is assumed to be the normal root partition.
#
# If this assumed normal root partition does not seem to mount
# then we offer to mkfs it for the user.
#
# However, with larger disks and RoboInst (non-interactive installs),
# sometimes it is desired to install software on a different disk or
# partition than the default. Allow a different partition to be
# mounted on /root, but query before proceding if an interactive
# install.
#
# The only other file systems in /root/etc/fstab that are mounted
# are those that are "efs" or "xfs" but not "noauto", as determined
# the command: mount -c -T efs,xfs -b /root.
#
# This script makes use of a new mount -P and -M options to cause
# pathnames in the fstab to be interpreted relative to /root.
#
# Note also that we send the 'mrquota' flag to mount.This instructs the
# kernel to keep quotas turned on if the superblock already has quotas
# enabled. Without this quotas will always get turned off on the /root
# filesystem.
# Returns success (0) if able to create any directories that did
# not previously exist, which are listed as mount points in fstab.
# Returns 1 otherwise.
mkmountdirs()
{
mstat=1
for mdir in `nawk '{ if (match("^#",$1)) next;
if ($3=="efs" || $3=="xfs") print $2}' /etc/fstab`
do
test ! -d "$mdir" && mkdir -p "$mdir" 2>&- && test -d "$mdir" && mstat=0
done
return $mstat
}
case $1 in
mntlocal)
echo "Mounting file systems:\n"
test -d /root || mkdir /root > /dev/null 2>&1
normalroot=`devnm / | sed 's/. .*/0/'` # Jam '0' on end of swap device
while { mount -o mrquota -c $normalroot /root; test $? -ne 0; }
do # while unable to mount /root
fsstat $normalroot >&- 2>&-
case $? in
0) # fsstat says file system clean but not mounted?
if mrcustomrc iscustom; then
LOGGER="/usr/bsd/logger -t roboinst"
if [ "`devnm /root 2>/dev/null`" != "`devnm /`root" ] ; then
# in nvram mrmode=custom mode -- can't allow interaction!
# must assume that it is OK
whatsthere=`devnm /root | sed 's/ .*//'`
echo "\n$whatsthere is mounted on /root instead of the default $normalroot."
echo "There is no way to interactively change this when nvram mrmode=custom."
break
else
# uh, oh. Nothing mounted!
# Since non-interactive, must abandon ship!
# this section changes when 'on error' gets added.
msg="Error mounting partition $normalroot when mrmode=custom"
msg2="This is your system disk: without it we have nothing"
msg3="on which to install software, and no recourse."
$LOGGER "state=mrmountrc status=$msg"
$LOGGER "state=mrmountrc status=$msg2"
$LOGGER "state=mrmountrc status=$msg3"
echo "$msg"
echo "$msg2"
echo "$msg3 Let the cascade failures begin!"
exit 1
fi
else
if [ "`devnm /root 2>/dev/null`" = "`devnm /`root" ] ; then
# nothing mounted there, problem!
echo '\n'Unable to mount partition: $normalroot on /root.
echo This is your system disk: without it we have nothing
echo on which to install software.
echo
echo Please manually correct your configuration and try again.
echo '\n\tPress Enter to invoke C Shell csh: \c'
read line
( echo set prompt="'\@nAfter repairs, type "'"exit"'" to try mounting /root again.\@nminiroot> '" > /.prompt ) > /dev/null
csh
echo
( echo set prompt="'miniroot> '" > /.prompt ) > /dev/null
else
# interactive mode, make sure that it's OKAY
whatsthere=`devnm /root | sed 's/ .*//'`
echo "\n$whatsthere is mounted on /root instead of the default partition $normalroot."
echo "This is where the software will be installed."
echo "\n\tIs this OK? [y|sh][y] \c"
read line
if [ "$line" = "" -o "$line" = "y" -o "$line" = "Y" ] ; then
echo "Installig software on $whatsthere.\n"
break
else
( echo set prompt="'\@nAfter repairs, type "'"exit"'" to try mounting /root again.\@nminiroot> '" > /.prompt ) > /dev/null
csh
echo
( echo set prompt="'miniroot> '" > /.prompt ) > /dev/null
fi
fi
fi
;;
1) # fsck -y by mount -c failed - sicko file system
echo Unable to repair file system on partition: $normalroot
echo This is your system disk: without it we have nothing
echo on which to install software.
echo
mrmkfsrc $normalroot
;;
2) # fsstat says file system is mounted
break # oh well. Break out of mount loop
;;
3) # fsstat didnt find any file system
echo No valid file system found on: $normalroot
echo This is your system disk: without it we have nothing
echo on which to install software.
echo
mrmkfsrc $normalroot
;;
esac
echo "\nTrying again to mount $normalroot on /root.\n"
done
# Mount graph to /root/hw since autoconfig is looking /root/hw/root
# key on /root/hw/.invent ... if console doesn't exist ... mount hwgraph
if [ ! -d /root/hw ]; then
/bin/rm -rf /root/hw > /dev/null 2>&1
mkdir /root/hw
/etc/mnthwgfs /root/hw
else
if [ ! -d /root/hw/.invent ]; then
/etc/mnthwgfs /root/hw
fi
fi
# Copy over the ioconfig.conf file and then run ioconfig
# to create the disk devices before we try and mount anything
# This is also a good time to create tape devices.
if [ -f /root/etc/ioconfig.conf ] ; then
cp /root/etc/ioconfig.conf /etc
fi
/sbin/ioconfig -f /hw
cd /dev; ./MAKEDEV MAXPTY=10 MAXGRO=4 MAXGRI=4 tape scsi > /dev/null
# Avoid repeated reboots on same miniroot appending
# repeated copies of /root/etc/fstab to /etc/fstab,
# and pick up results of mounting /root, above:
test -f /etc/fstab.Sav || mount -p > /etc/fstab.Sav
cp /etc/fstab.Sav /etc/fstab
if test -f /root/etc/lvtab
then
echo "\n LV volumes are no longer supported in this release.";
echo " Please use lv_to_xlv(1) to convert to XLV volumes.\n";
fi
test -x /root/sbin/xlv_assemble && mrinitxlvrc
# In custom mode, adjust some configuration files
# with information provided by the server.
mrcustomrc mounthook
if test -f /root/etc/fstab
then
# Goal: Append to /etc/fstab path adjusted contents of /root/etc/fstab
# Then mount local efs,xfs file systems under /root.
# Use 3 new mount options:
# -M to specify alternate mtab, and
# -P to specify prefix to add to mnt path.
# -T to specify efs and xfs types.
#
# Do 2 XLV conversions here:
# 1) Convert from pre 6.4 xlv names (/dev/dsk/xlv -> /dev/xlv)
# 2) Prefix '/root' in front of the devicenames
# (step 2 isn't necessary for hwg devices since /root/hw exists)
mount -M /root/etc/fstab -P /root -p |
sed -e 's;/dev/dsk/xlv/;/dev/xlv/;' \
-e 's;/dev/rdsk/xlv/;/dev/rxlv/;' \
-e 's;/dev/xlv/;/root/dev/xlv/;' \
-e 's;/dev/rxlv/;/root/dev/rxlv/;' \
| awk '$2 != "/root"' >> /etc/fstab
mkdir /root/etc/fscklogs > /dev/null 2>&1
while : attempting to mount
do
if mount -c -T efs,xfs -b /root > /root/etc/fscklogs/miniroot 2>&1 ; then
cat /root/etc/fscklogs/miniroot
break
elif mrcustomrc iscustom && mkmountdirs ; then
# created a directory that did not exist,
# so try again
continue
else
cat /root/etc/fscklogs/miniroot
echo
echo "Unable to mount all local efs,xfs file systems under /root"
echo "Copy of above errors left in /root/etc/fscklogs/miniroot"
echo
sleep 5
break
fi
done
else # no /root/etc/fstab
if prtvtoc -s -h $normalroot |
awk '$1 == 6 && ( $2 == "efs" || $2 == "xfs" )' |
grep . > /dev/null
then
# Goal: Since there is no fstab, this is probably a clean install.
# If the main drive has a partition 6, get a file system
# on it (if there isn't already one there, and if the user
# agrees) and get it mounted at /root/usr. Get var, usr/var
# /etc/fstab and /root/etc/fstab set up correctly.
test -d /root/usr || mkdir /root/usr > /dev/null 2>&1
normalusr=`devnm / | sed 's/. .*/6/'` # Jam '6' on end of swap device
while { mount -o mrquota -c $normalusr /root/usr; test $? -ne 0; }
do # while unable to mount /usr
fsstat $normalusr >&- 2>&-
case $? in
0) # fsstat says file system clean but not mounted?
echo '\n'Unable to mount partition: $normalusr on /root/usr.
echo
echo This is your usr file system: you will need it mounted
echo to install software.
echo
echo Please manually correct your configuration and try again.
echo '\n\tPress Enter to invoke C Shell csh: \c'
read line
( echo set prompt="'\@nAfter repairs, type "'"exit"'" to try mounting /usr again.\@nminiusr> '" > /.prompt ) > /dev/null
csh
echo
( echo set prompt="'miniusr> '" > /.prompt ) > /dev/null
;;
1) # fsck -y by mount -c failed - sicko file system
echo '\n'Unable to repair usr file system on partition: $normalusr
echo
echo This is your usr file system: you will need it mounted
echo to install software. You can either obtain a shell "sh"
echo and attempt manual repairs, or you can say "yes" and
echo agree to make a new file system on your usr partition.
echo
mrmkfsrc $normalusr && continue
;;
2) # fsstat says file system is mounted
break # oh well. Break out of mount loop
;;
3) # fsstat didnt find any file system
echo '\n'No valid file system found on: $normalusr.
echo
echo This is your usr file system: you will need it mounted
echo to install software. You can either obtain a shell "sh"
echo and attempt manual repairs, or you can say "yes"
echo and agree to make a new file system on your usr partition.
echo
mrmkfsrc $normalusr && continue
;;
esac
while : asking if should try mount again
do
echo
echo Try again to mount $normalusr on /root/usr? '[yes/no/sh/help]: \c'
read line
case "$line" in
yes|YES)
continue 2
;;
no|NO)
echo Giving up on trying to mount usr partition.
break 2
;;
sh|SH)
( echo set prompt="'miniroot> '" > /.prompt ) 2>/dev/null
csh
echo
continue 1
;;
[hH]*)
cat <<-!!
yes - Will try again to mount the following device
$normalusr
below /root/usr.
no - Will give up on mounting your usr partition,
and go on to invoke the Software Installation
Utility. If you have a small root partition
currently mounted under /root, you probably
won't have enough disk space to install
software.
sh - Invoke a subshell, permitting use of available
IRIX utilities to repair this partition.
help - show this message
!!
continue 1
;;
*)
cat <<-\!!
Type one of the words: "yes", "no", "sh" or "help".
Then press the Enter key.
!!
continue 1
;;
esac
done # asking if should try mount again
done # while trying to mount usr file system ...
fi # if there's a partition 6 ...
# There was no fstab - we have root and maybe usr mounted,
# so create an fstab reflecting this new state of affairs,
# and fix up var and maybe usr/var correctly. We are
# probably here on an install to clean disks, but don't
# be so sure about that - maybe user just nuked fstab.
(
if test ! -d /root/etc
then
rm /root/etc # rm etc if non-directory
mkdir /root/etc # make etc dir
fi
rm -f /root/etc/fstab # maybe it was a fifo or ... ??
touch /root/etc/fstab # safer create than '>'
rtype=`/etc/fstyp $normalroot`
# put root entry in fstab
test -f /root/etc/fstab &&
echo '/dev/root / ' $rtype ' rw,raw=/dev/rroot 0 0' > /root/etc/fstab
fsstat $normalusr
if test $? -eq 2
then
# if usr mounted, put it in fstab and fix var, usr/var
utype=`/etc/fstyp $normalusr`
test -f /root/etc/fstab &&
echo '/dev/usr /usr ' $utype ' rw,raw=/dev/rusr 0 0' >> /root/etc/fstab
echo '/dev/usr /root/usr ' $utype ' rw,raw=/dev/rusr 0 0' >> /etc/fstab
if test ! -d /root/usr/var
then
rm /root/usr/var # rm usr/var if non-directory
mkdir /root/usr/var # make usr/var dir
fi
if test -d /root/usr/var
then
rmdir /root/var # rm var if empty dir
rm /root/var # rm var if non-dir
mv /root/var /root/var.sav # mv var if nonempty dir
ln -s usr/var /root/var # make var a symlink to usr/var
else
if test ! -d /root/var # no usr/var, just use var
then
rm /root/var # rm var if non-directory
mkdir /root/var # make var dir
fi
fi
else
# if usr not mounted, just fix var as real directory
if test ! -d /root/var
then
rm /root/var # rm var if non-directory
mkdir /root/var # make var dir
fi
fi
) 1>&- 2>&- # quiet ..
fi # if fstab, mount that, else try usr part 6 .. fi
# show user what's mounted
mount -p | awk '
$3 == "efs" || $3 == "xfs" { printf " %-23s on %s\n", $1, $2; }
'
echo
echo
;;
rootonly)
# Attempt to mount /root and return status
test -d /root || mkdir /root > /dev/null 2>&1
normrootroot=`devnm / | sed 's/. .*/0/'` # Jam '0' on end of swap device
mount -o mrquota -c $normrootroot /root
exit $?
;;
unmntlocal)
/sbin/umount -k /root/hw
/sbin/umount -ak -b /proc,/,/hw
sync
;;
mntany)
shift
/sbin/mount $*
if [ ! -d /root/hw ]; then
/bin/rm -rf /root/hw > /dev/null 2>&1
mkdir /root/hw
fi
# Only mount /root/hw if /root is mounted and /root/hw is not
rootdev=`stat -qd /root`
if [ -d /root/hw ] &&
[ `stat -qd /` -ne "$rootdev" ] &&
[ `stat -qd /root/hw` -eq "$rootdev" ] ; then
/etc/mnthwgfs /root/hw
fi
;;
unmntany)
# Since it is very difficult to determine if we actually need
# to unmount /root/hw (since /root may be specified in a
# variety of ways), the easiest solution is to always unmount
# /root/hw and then see if the root filesystem is still mounted.
# If it is, remount /root/hw
shift
/sbin/umount -k /root/hw
/sbin/umount $*
if [ `stat -qd /` -ne `stat -qd /root` ] ; then
/etc/mnthwgfs /root/hw
fi
;;
*)
echo Usage: mrmountrc '{mntlocal|unmntlocal|mntany dirs|unmntany dirs}'
;;
esac

831
eoe/cmd/initpkg/mrnetrc.sh Executable file
View File

@@ -0,0 +1,831 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# mrnetrc {start|stop|netisup|forcestart [askipaddr]|sethostname|setipaddr
# |addhost hostname|validaddr ipaddr|sethostaddr hostname ipaddr
# |gethostaddr hostname}
#
# Invoke with one of following:
#
# start Copy up /root net config files and try to
# start network. Don't fuss or interact if fails.
#
# stop Invoke /etc/init.d/network stop.
#
# netisup Return success iff network seems to be up.
#
# forcestart Set hostname, ip addr and run network start.
# Ok to ask user for hostname and/or ipaddr,
# if unable to discover automatically.
#
# Expects to be called from inst if earlier
# "mrnetrc start" failed to bring up networking,
# and user of inst tries to set "from" to a
# network address (has ':' in name). Assumes earlier
# "mrnetrc start" copied up an available network config
# files from the normal /root file system.
#
# If optional 2nd arg "askipaddr" is present,
# then don't guess the ipaddr, ask instead.
# This "mrnetrc forcestart askipaddr" case is
# used to implement "mrnetrc setipaddr", below.
#
# sethostname Ask user for this systems hostname and
# place in /etc/sys_id. Then do forcestart.
#
# setipaddr Ask user for this hosts ipaddr and put
# into /etc/hosts (first removing any
# conflicting entries with same hostname).
# Then do forcestart. Actually implemented
# by just calling "mrnetrc forcestart askipaddr".
#
# addhost hostname
# If /etc/hosts doesn't already have an entry
# for specified hostname, then ask for ipaddr
# of that host, and append an entry for it in
# /etc/hosts.
#
# validaddr ipaddr
# Exit 1 if the ip address is bogus (see below),
# otherwise exit 0.
#
# sethostaddr hostname ipaddr
# Set the ip address of a host in /etc/hosts
# gethostaddr hostname
# Get the ip address of a host in /etc/hosts,
# returns "0" if not found.
#
# Ignore SIGHUP. This is needed so that processes that haven't had
# a change to run long enough to daemonize won't get killed when
# this script exits.
#
trap "" 1
#-------------- useful functions ---------------------
# comment_filter
#
# this sed script strips comment and empty lines.
comment_filter()
{
sed -n -e '/#.*/s///' -e '/[ ]*$/s///' -e /./p
# beware ^^^^^^^ tab character
}
# gethostidbyname hostname
#
# Given a host or alias name that is in /etc/hosts, print the
# corresponding ip address of the first matching line on stdout.
#
# If hostname not found in /etc/hosts, print "0". Comments beginning
# with '#' and ending with '\n' are suppressed. Lines with < 2 fields
# (space or tab separated) are ignored. This should match the way
# gethostbyname(3N) parses /etc/hosts.
gethostidbyname()
{
test -s "/etc/hosts" || { echo 0; return; }
comment_filter < /etc/hosts | awk '
BEGIN { ipaddr = 0; }
NF >= 2 {
for (i = 2; i <= NF; i++) {
if ($i == "'"$1"'") {
ipaddr = $1
exit
}
}
}
END { print ipaddr }
'
}
# gethostnamebyipaddr ipaddr
#
# Given an ip address, print the first corresponding hostname
# for it in /etc/hosts. If not found, print empty string.
gethostnamebyipaddr()
{
test -s "/etc/hosts" || return
comment_filter < /etc/hosts | awk '
NF >= 2 && $1 == "'"$1"'" {
print $2
exit
}
'
}
# removehostsconflicts host
#
# Typically, only first /etc/hosts entry for a specified host
# is recognized. Remove all lines matching on "$host", so that
# they do not conflict. Call before appending entry to the
# end of /etc/hosts.
# Treats comment lines like any other: if any field but the first
# matches "$host", remove the line. Would be best if we treated
# comments special: passing them all through, unless they were a
# comment on a line that was being removed. This however is a
# level of subtlety that is ill-defined, hard to do, and not worth it.
removehostsconflicts()
{
test -f /etc/hosts || return
awk < /etc/hosts > /etc/hosts.tmp '
{ for (i = 2; i <= NF; i++) {
if ($i == "'"$1"'")
next
}
}
{ print }
'
mv /etc/hosts.tmp /etc/hosts
}
# bogus ipaddr
#
# Decide if ip address bogus, such as 0, 0.0.0.0, 127.*.*.*
# (localhost) and 192.0.2.1 (test).
# Return 0 for success -- meaning _is_ bogus.
# Return 1 for failure -- meaning is not bogus.
#
# Set variable $reason with explanation, so that caller
# can if it chooses display the reason an address is bogus.
bogus()
{
inet_aton "$1" || {
reason='\nInvalid ascii Internet address representation: <'"$1"'>
Typical address is up to 4 . separated numbers. Example: 192.0.2.2'
return 0;
}
case "$1" in
0|0x0|0.0|0.0.0|0.0.0.0)
reason='\nInternet address of zero <'"$1"'> not usually valid'
return 0
;;
127.*.*.*)
reason='\nInternet addresses 127.*.*.* reserved for loopback'
return 0
;;
192.0.2.1)
reason='\nInternet address <192.0.2.1> is for testing. It loops back by default'
return 0
;;
"")
reason='\nPlease specify non-empty Internet address'
return 0;
;;
*)
return 1
;;
esac
}
# confirm message ...
#
# Display message. Ask "Are you sure".
# Return with success if user answers yes.
confirm()
{
echo "$*"
echo '\n\tAre you sure? [y/n] (n): \c'
read line
case "$line" in
[yY]*) return 0;;
*) return 1;;
esac
}
copynetfiles()
{
(
cp /root/etc/sys_id /etc/sys_id
cp /root/etc/config/ifconfig-*.options /etc/config
cp /root/usr/etc/resolv.conf /etc/resolv.conf # old path
cp /root/etc/resolv.conf /etc/resolv.conf # new path
cp /root/etc/config/netif.options /etc/config/netif.options
chmod +x /etc/config/netif.options # old inst does "test -x" !?!
cp /root/etc/hosts /etc/hosts ||
echo "127.0.0.1 localhost loghost" > /etc/hosts
chmod +x /etc/hosts # old inst does "test -x" !?!
chkconfig -f network on
) 2>/dev/null
}
savenetfiles()
{
(
mkdir /etc/config/.savedconfig
mv /etc/config/ifconfig-*.options /etc/config/.savedconfig
mv /etc/config/netif.options /etc/config/.savedconfig
mv /etc/sys_id /etc/.sys_id.saved
cp /etc/hosts /etc/.hosts.saved
) 2>/dev/null
}
restorenetfiles()
{
(
rm /etc/config/ifconfig-*.options /etc/hosts /etc/sys_id
mv /etc/config/.savedconfig/ifconfig-*.options /etc/config
mv /etc/config/.savedconfig/netif.options /etc/config
mv /etc/.hosts.saved /etc/hosts
mv /etc/.sys_id.saved /etc/sys_id
rm -rf /etc/config/.savedconfig
) 2>/dev/null
}
# $1 is the default (builtin) interface name
restartnetwork()
{
chkconfig -f network on
chkconfig verbose
isverbose=$?
# turn on verbose so we can inhibit that nasty graphical message
chkconfig -f verbose on
(
/etc/init.d/network stop
ifconfig $1 down
/etc/init.d/network start
) >/dev/null 2>&1
if test $isverbose -ne 0 ; then
chkconfig verbose off
fi
}
defaultinterface()
{
# this works even if there are interfaces without miniroot drivers
hinv -c network | sed -ne 's/^Integr.* \([a-z][a-z]*0\),.*$/\1/p'
}
# return the number of interfaces (excluding lo0)
numinterfaces()
{
ifconfig -a | awk '/^[a-z][a-z]*[0-9][0-9]*:/ {num += 1;}
/^lo0:/ {num -= 1;}
END {print num;}'
}
ishex()
{
echo "$1" | grep -i "^0x[0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f]$" > /dev/null
}
# $1 is the interface name
# $2 is the optional pathname prefix (probably /root)
getinterfacenum()
{
test $# -eq 0 && return
interfacefile="/etc/config/netif.options"
if test $# -gt 1 ; then
interfacefile=$2$interfacefile
fi
(
# mimic what happens in /etc/init.d/network script so we can
# accurately predict what ifconfig options file will have the
# integral interface information
if_num=9
if ( ifconfig ipg0 || ifconfig xpi0 || ifconfig rns0 ) >/dev/null 2>&1
then
if2name="$1"
num=2
else
if1name="$1"
num=1
fi
test -s "$interfacefile" || { echo -n $num; return; }
. "$interfacefile"
num=1
while test $num -le $if_num; do
eval _ifname='$'if${num}name
if test "$_ifname" = "$1" ; then
echo -n $num
return
fi
num=`expr $num + 1`
done
)
}
# $1 is ip address
getclassdefaultnetmask()
{
test $# -eq 1 || return
echo "$1" | nawk -F\. '{
if ($1 < 128) {print "0xff000000"}
else if ($1 < 192) {print "0xffff0000"}
else if ($1 < 224) {print "0xffffff00"}
else {print "0xffffffff"}
}'
}
# $1 is optional path prefix (ie. /root)
getnetmask()
{
nvramnetmask=`nvram netmask 2>/dev/null`
if test $nvramnetmask && \
( ishex "$nvramnetmask" || ! bogus "$nvramnetmask" ) ; then
echo -n "$nvramnetmask"
return
fi
interface=`defaultinterface`
prefix=""
if test $# -gt 0 ; then
prefix="$1"
fi
num=`getinterfacenum "$interface" "$prefix"`
test "$num" || exit 1
ethnetmask=0
ifconfigname=$prefix/etc/config/ifconfig-"$num".options
if test -s "$ifconfigname" ; then
configoptions="`cat $ifconfigname 2> /dev/null`"
set $configoptions
while test $# -gt 1 ; do
if test "$1" = "netmask" ; then
ethnetmask=$2
break
fi
shift
done
fi
# debugging code was useful
# echo 1>&2 mrnetrc getnetmask: ethnetmask= "\"$ethnetmask\""
if ishex "$ethnetmask" || ! bogus "$ethnetmask" ; then
echo -n "$ethnetmask"
fi
}
# $1 is hostname
# $2 is ip address
# $3 is interface name
# $4 is netmask
buildnetworkfiles()
{
test $# -eq 4 || return 1
savenetfiles
echo "$1" > /etc/sys_id
hostname "$1"
echo "if1name=$3\nif_num=1\nif1addr=$1\n" > /etc/config/netif.options
if test -n "$4" ; then
echo netmask "$4" > /etc/config/ifconfig-1.options
fi
removehostsconflicts "$1"
echo "$2 $1" >> /etc/hosts
}
# converts $1 IP address (or netmask) argument to hex format
tohex()
{
echo $1 | awk -F. '
/^0x/ && NF == 1 {a=substr($1,3);printf "%s\n",a; exit 0}
NF == 2 {printf "%02x%06x\n",$1,$2; exit 0}
NF == 3 {printf "%02x%02x%04x\n",$1,$2,$3; exit 0}
NF == 4 {printf "%02x%02x%02x%02x\n",$1,$2,$3,$4; exit 0}
{exit 1}
'
}
# $1 is the hostname ( if empty minimal networking is started using ifconfig )
# $2 is the root path where to look for network config files (ie /root or "")
# $2 is used to determine the netmask in the event nvram netmask is not set
setupbuiltinnetworking()
{
test $# -eq 2 || return 1
etheripaddr=`nvram netaddr 2>/dev/null || echo 0`
bogus "$etheripaddr" && return 1
interface=`defaultinterface`
test $interface || return 1
ethernetmask=`getnetmask "$2"`
# debugging code
# echo "mrnetrc: setupbuiltinnetworking \"$interface\" \"$etheripaddr\" \"$ethernetmask\""
# if no hostname provided we should configure networking manually and
# bypass the network script entirely since it will put us in standalone
if test -z "$1" ; then
killall routed
if test "$ethernetmask" ; then
ifconfig "$interface" inet "$etheripaddr" primary netmask "$ethernetmask"
else
ifconfig "$interface" inet "$etheripaddr" primary
fi
hostid 0x`tohex $etheripaddr`
if chkconfig routed ; then
routed_opts="`cat /etc/config/routed.options 2> /dev/null`"
routed "$routed_opts"
fi
if mrinterface ; then
if test -s /etc/sys_id ; then
hostname `sed -n p /etc/sys_id`
removehostsconflicts `hostname`
echo "$etheripaddr `hostname`" >> /etc/hosts
fi
return 0
fi
return 1
fi
# otherwise, save off all the old networking files and create
# new ones with the new derived values and then restart networking
buildnetworkfiles $1 $etheripaddr $interface $ethernetmask
restartnetwork $interface
hostid 0x`tohex $etheripaddr`
removehostsconflicts $1
echo "$etheripaddr $1" >> /etc/hosts
if ! mrinterface ; then
restorenetfiles
if test -f /etc/sys_id ; then
hostname `sed -n p /etc/sys_id`
fi
return 1
fi
return 0
}
#-------------- main procedures -----------------------
case "$1" in
start)
# This is a no-op in custom mode, since minimal networking has
# already started if we got this far.
if mrcustomrc iscustom ; then
exit 0
fi
# Best effort network start. Copy up user's network
# configuration from /root, and run "network start"
# Don't fuss or interact if unable to do some or all of this.
# If later on, we decide we really must have networking on,
# then call "mrnetrc forcestart" at that time.
copynetfiles
if test -f /etc/sys_id -a -f /root/etc/hosts
then
# Use "sed -n p" instead of "cat" because cat command
# can fail, writing to a fifo, when the next fifo inode
# number assigned by the kernel happens to match the
# inode number of the file being cat'd. The failure
# complains: Input/output files '/etc/sys_id' identical
hostname `sed -n p /etc/sys_id`
/etc/init.d/network start
fi
;;
stop)
/etc/init.d/network stop
;;
netisup)
# If network already started successfully, return success (0) else failure.
#
# Use mrinterface to check for the network interfaces that are UP.
# mrinterface will return 3 possible values : -1 = error
# 0 = success (network UP - found network interface)
# 1 = failure
#
mrinterface
;;
forcestart)
# Note the NVRAM's netaddr. We might use this to guess
# the desired hostname, if sys_id doesn't help. And
# later we might use it to determine this hosts ip address,
# if the address (if any) listed for this host in /etc/hosts
# is bogus.
nvramipaddr=`nvram netaddr 2>/dev/null || echo 0`
# Determine hostname from /etc/sys_id, or by looking up
# the NVRAM's netaddr in the /etc/hosts file, or from
# asking user. Then put it in /etc/sys_id, if need be.
# See explanation above for use of "sed -n p" instead of "cat".
test -s /etc/sys_id && host=`sed -n p /etc/sys_id` || {
# Try to find a hostname by looking up nvram's netaddr
# in /etc/hosts.
host=`gethostnamebyipaddr "$nvramipaddr"`
# If that came up empty, have to ask the user.
# We accept any non-zero length string.
while test -z "$host"
do
echo 'What is the hostname (system name) of your machine? \c'
read host
if [ x"$host" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
host=
fi
done
echo "$host" > /etc/sys_id
}
# Set the system hostname
hostname "$host"
defaultint=`defaultinterface`
defaultnetmask=`getnetmask`
askuser=0
if test $# -eq 2 -a askipaddr = "$2" || \
test -z "$defaultint" || bogus "$nvramipaddr" ; then
askuser=1
fi
# While still bogus, ask user if ok.
# If user confirms, quit asking.
if test "$askuser" -eq 1 ; then
if test `numinterfaces` -eq 1 ; then
interface=$defaultint
else
interface=
fi
while ! ifconfig "$interface" >/dev/null 2>&1; do
if test -n "$interface" ; then
confirm Using network interface "$interface".' \c' && break
fi
if test -z "$defaultint" ; then
echo What network interface would you like to configure? '\c'
else
echo What network interface would you like to configure?
echo Press Enter for builtin interface [$defaultint] '\c'
fi
read interface
if test -z "$interface" ; then
interface=$defaultint
fi
if [ x"$interface" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
interface=
fi
done
ipaddr=
while bogus "$ipaddr" ; do
if test -n "$ipaddr" ; then
echo "$reason"
confirm Using network address: "$ipaddr" for: "$host".' \c' && break
fi
echo What is the network address of "$host"? '\c'
read ipaddr
if [ x"$ipaddr" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
ipaddr=
fi
done
else
interface=$defaultint
ipaddr=$nvramipaddr
fi
if test -z "$defaultnetmask" -o "$nvramipaddr" != "$ipaddr" -o \
"$interface" != "$defaultint" ; then
netmask=
while ! ishex "$netmask" && bogus "$netmask" ; do
if test -n "$netmask" ; then
echo "$netmask" is an invalid netmask.
fi
defaultnetmask=`getclassdefaultnetmask "$ipaddr"`
echo What is the netmask for "$ipaddr"?
echo "Press Enter for the IP class default [$defaultnetmask]: \c"
read netmask
if test -z "$netmask" ; then
netmask="$defaultnetmask"
break
fi
if [ x"$netmask" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
netmask=
fi
done
else
netmask=$defaultnetmask
fi
buildnetworkfiles "$host" "$ipaddr" "$interface" "$netmask"
echo Starting network with hostname: "$host", at ip address: "$ipaddr"
restartnetwork "$interface"
mrinterface
;;
sethostname)
# Ask the user for the hostname to set.
# We accept any non-zero length string.
host=
while test -z "$host"
do
echo 'What is the hostname (system name) of your machine? \c'
read host
if [ x"$host" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
host=
fi
done
echo "$host" > /etc/sys_id
# restart the network
exec $0 forcestart
echo Failed to restart the network 1>&2
;;
setipaddr)
exec $0 forcestart askipaddr
echo Failed to invoke $0 forcestart askipaddr 1>&2
;;
validaddr)
bogus "$2" && exit 1
exit 0
;;
sethostaddr)
bogus "$3" && exit 1
bogus "$2" || exit 1
removehostsconflicts "$2"
echo "$3 $2" >> /etc/hosts
;;
gethostaddr)
bogus "$2" || exit 1
gethostidbyname "$2"
;;
addhost)
# put entry for specified host (2nd arg) in /etc/hosts file.
test $# -eq 2 || exit
host=$2
# is this host already in hosts -- if so, nothing to do, just leave
hostipaddr=`gethostidbyname "$host"`
test $hostipaddr != 0 && exit 0
# if asked to add host by name that looks like an ipaddr,
# then do nothing - user provided host ipaddr instead of hostname,
# so don't need to translate name to ipaddr -- already is.
bogus "$host" || exit 0
# if this is the same host we booted from, get the address from bootp
tapedevice=`nvram tapedevice 2>/dev/null || echo 0`
boothost=`echo "$tapedevice" | sed -n 's;.*bootp()\([^ :]*\).*;\1;p'`
bootfile=`echo "$tapedevice" | sed -n 's;.*bootp()\([^ ()]*\).*;-b\1;p'`
if [ "$boothost" = "$host" ]; then
/usr/etc/bootpc -r $bootfile -x4 > /tmp/bootp$$ 2>/dev/null
if [ -s /tmp/bootp$$ ]; then
ipaddr=`sed -n 's/^bootpaddr=//p' /tmp/bootp$$`
fi
rm -f /tmp/bootp$$ > /dev/null 2>&1
bogus "$ipaddr" || {
echo "$ipaddr $host" >> /etc/hosts
exit 0
}
fi
# ask user for ipaddr of host
while : asking
do
echo What is the network address of "$host"? '\c'
read ipaddr
if [ x"$ipaddr" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
else
break;
fi
done
# While still bogus, ask user if ok.
# If user confirms, quit asking.
while bogus "$ipaddr"
do
echo "$reason"
confirm Using network address: "$ipaddr" for: "$host".' \c' && break
echo What is the network address of "$host"? '\c'
read ipaddr
if [ x"$ipaddr" = x"!" ]; then
echo "Type exit when ready to continue"
/bin/csh
ipaddr=
fi
done
# Now we can append our line to /etc/hosts
echo "$ipaddr $host" >> /etc/hosts
;;
safestart)
# basically like "start", but traps the output and if any errors
# occur, will shutdown and do a "setupbuiltinnetworking"
defaultint=`defaultinterface`
if test -s /root/etc/config/netif.options -a -s /root/etc/sys_id -a -s /root/etc/hosts ; then
# there's a chance that all the needed configuration files are valid
copynetfiles
hostname=`sed -n p /etc/sys_id`
hostname $hostname
restartnetwork "$defaultint"
fi
if ! mrinterface ; then
ifconfig "$defaultint" down
setupbuiltinnetworking "$hostname" /root
fi
mrinterface
;;
startdefaultinterface)
# the hostname and rbase of tree to look for network files (/root or "")
# if an empty hostname is provided, networking is configured manually
# using ifconfig rather than calling the network scripts
test $# -eq 3 || exit 1
setupbuiltinnetworking "$2" "$3"
;;
*)
echo "Usage: $0 {start|stop|netisup|forcestart [askipaddr]|sethostname|setipaddr|addhost hostname|validaddr ipaddr|sethostaddr host ipaddr|startdefaultinterface host rbase }"
;;
esac

View File

@@ -0,0 +1,21 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
# miniroot script - used by other mr*rc scripts for common settings
PATH=/sbin:/usr/bin:/usr/bsd:/usr/sbin:/etc:/usr/etc:
# possibly temporary hack to get ~/.swmgrrc to eval to something useful:
HOME=/root; export HOME
# sane terminal modes, erase, kill, intr because documented that way
stty sane tab3 erase '^H' kill '^U' intr '^C' 2>/dev/null
# Scripts catch but no-op SIGINT (from ^C) so that they
# are not disrupted by user hitting ^C, but still allow
# any subshells to default SIGINT. Ditto SIGQUIT (3), I guess.
trap : 2 3
umask 022

666
eoe/cmd/initpkg/mrreorgrc.sh Executable file
View File

@@ -0,0 +1,666 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# miniroot script - reorganize file systems when entering state 2.
# Handles file system layout changes between IRIX 4 and 5.
# Actions:
# If separate /usr file system
# make /var a symlink to /usr/var
# else
# make /var a new directory
# Move $USRDIRStoMV from /usr to /var.
# Move /usr/lib/cron stuff to /var/cron and /etc/cron.d
# See comments below describing $STATE
STATE=/root/.mrreorgrc_tmp_state
# Short circuit case where nothing to do.
if test $# -eq 1 \
-a \( \
x"$1" = xreorg -a -f /root/.varupdate \
-o \
x"$1" = xcleanup -a ! -d $STATE \
\)
then
exit
fi
# Move the following from /usr to /var,
# and create symlinks in /usr pointing to /var.
USRDIRStoMV="spool adm mail preserve tmp lib/inst lib/rfindd"
MOUNTDIRS=
# Rotate $LOG to $LOG.O if it has > 10 kbytes.
LOG=/tmp/mrreorgrc.out
> $LOG # be sure it exists to avoid an error message from du
if test 0"`du -s $LOG | awk '{print $1}'`" -gt 20
then
mv $LOG $LOG.O
fi
# Send stdout, stderr to $LOG
#
# Take stdin from /dev/null, so that we don't
# need a "-f" flag on each cp/mv/ln/rm below.
#
# Save dups of 0,1,2 file descriptors on 3,4,5
# in case we really want to interact.
exec 3<&0 4>&1 5>&2 </dev/null >>$LOG 2>&1
# Use "show" (like echo) to display user messages:
show()
{
echo "$@" # into LOG
echo "$@" 1>&5 # to what was stderr
}
# write to $LOG: current date, command and actions
echo
date
echo $0: $*
set -x
#-------------- useful functions ---------------------
# checkdir name var
# Test whether name refers to a directory.
# If it does, increment var: test -d name && var++
# Symlinks to directories don't count.
checkdir()
{
test ! -l $1 -a -d $1 && eval $2=`eval expr '$'$2 + 1`
}
# device filename
# Determine the device (st_dev) representing
# the file system on which resides "filename".
device()
{
stat -qd $1 || echo 0
}
# mkunique name uniquename
# Given filename "name", append the suffix .sav and
# the smallest non-negative integer suffix N such that
# "name.savN" does not refer to a file of any sort.
# Set the shell variable named by the 2nd argument
# "uniquename" to the resulting unique name "name.savN"
# Try suffix ".sav" with no number first.
mkunique()
{
ls -ld $1.sav || {
eval $2=$1.sav
return
}
n=0
while ls -ld $1.sav$n
do
n=`expr $n + 1`
done
eval $2=$1.sav$n
}
# purge filename undoscript
# Get rid of "filename"by moving it to
# "filename.savN", for the smallest natural number N
# such that this name is unique.
#
# Write the undo mv command to the
# file "undoscript" named by the 2nd argument.
purge()
{
mkunique $1 uniquename
mv $1 $uniquename && echo mv $uniquename $1 > $2
}
# unpurge undoscript
# Reverse affects of purge.
# Simply execute the undoscript provided,
# then remove the undoscript itself.
unpurge()
{
sh -x $1
rm $1
}
# Keep track of actions done during reorg, using state
# files kept under STATE=/root/.mrreorgrc_tmp_state.
# These state files will survive reloading the miniroot,
# will not survive re-mkfs'ing /root, and will be cleaned
# out once inst exits.
setstate()
{
touch $STATE/$1
}
clearstate()
{
rm $STATE/$1
}
teststate()
{
test -f $STATE/$1
}
scriptname()
{
echo $STATE/$1
}
# reverse arg1 arg2 ...
# Emit (on stdout) arguments in reverse order supplied
reverse()
{
for i
do
revarg="$i $revarg"
done
echo "$revarg"
}
dirname()
{
ans=`/usr/bin/expr "${1:-.}/" : '\(/\)/*[^/]*//*$' `
if [ -n "$ans" ];then
echo $ans
else
ans=`/usr/bin/expr "${1:-.}/" : '\(.*[^/]\)//*[^/][^/]*//*$' `
if [ -n "$ans" ];then
echo $ans
else
echo "."
fi
fi
}
false()
{
test -f /not_a_file..3.2.1.boom
}
true()
{
:
}
#-------------- main procedure -----------------------
case $1 in
reorg)
# The file /.varupdate is shipped in IRIX 5 and higher eoe1.sw.unix
# Don't reorg any file system containing this file.
test -f /root/.varupdate && exit
#-------------- Force all fstab mounts ---------------
# This script can fail if the umount/mount sequence
# below changes what's mounted. Quietly avoid that,
# by doing an extra umount/mount pair.
umount -kt efs -b /
mount -ct efs -b /
#-------------- anything in /usr to move? ------------
# If there are no directories on the $USRDIRStoMV under /usr,
# then:
# 1) If /var has most (at least all but 3) of these
# directories already, restore /.varupdate file,
# 2) Else show message about not doing reorg.
# 3) In either case, exit -- no reorg done.
nusrdirs=0 # How many $USRDIRStoMV found under /usr
ndirstomv=0 # How many $USRDIRStoMV altogether
nvardirs=0 # How many $USRDIRStoMV found under /var
set +x # suppress noise from following for loop
for i in $USRDIRStoMV
do
checkdir /root/usr/$i nusrdirs
ndirstomv=`expr $ndirstomv + 1`
checkdir /root/var/`basename $i` nvardirs
done
echo nusrdirs $nusrdirs, ndirstomv $ndirstomv, nvardirs $nvardirs
set -x # resume noisy output
# fuzzy logic: allow for 1 to 3 (like usr/lib/rfindd)
# items in $USRDIRStoMV list to not exist.
ndirstomv=`expr $ndirstomv - 3`
if test $nusrdirs -eq 0 -a $ndirstomv -le $nvardirs
then
# reorg already done; someone removed /.varupdate
# Beware ** following must have leading tabs **
cat <<-\!! > /root/.varupdate
Please don't remove this file /.varupdate.
This file is a marker used by the miniroot "mrreorgrc" script to
identify file systems which have been reorganized from the IRIX 4
(and before) file system layout to the IRIX 5 layout.
This one time reorganization moves the /usr subdirectories:
spool adm mail preserve tmp lib/inst lib/rfindd
to /var, where /var will be a symlink to /usr/var in the case
that this system has a separately mounted /usr file system.
Removing this file /.varupdate will increase slightly the risk
that the "mrreorgrc" (formerly part of the instdriver script)
which runs automatically each time the miniroot is loaded to
use inst, will inadvertently try to move a major /usr or
/var subdirectory again.
(The contents of this file, the above text, don't matter.
All that matters is the presence or absence of this file.)
Silicon Graphics
March 2, 1994
!!
exit # leave silently
fi
if test $nusrdirs -eq 0
then
# typically here after mkfs on clean install; better not to worry user.
: show Skipping file system reorganization: nothing under /usr to move.
exit
fi
#-------------- be sure /var not mount point --------
# Don't reorg if /root and /root/var are separate file systems,
# or if /root, /root/usr and /root/usr/var are all separate.
# Must compute these dev* values before umount below, and
# then use these values in the /var creation logic after umount.
devroot=`device /root`
devusr=`device /root/usr`
devvar=`device /root/var`
devusrvar=`device /root/usr/var`
if test -d /root/var -a ! -l /root/var -a $devroot -ne $devvar
then
show Skipping file system reorganization: /root/var is mount point.
exit
fi
if test -d /root/usr -a $devroot -ne $devusr -a \
-d /root/usr/var -a $devusr -ne $devusrvar
then
show Skipping file system reorg: /root/usr, /root/usr/var are both mount points.
exit
fi
for i in $USRDIRStoMV
do
usrdir=/root/usr/$i
devusrdir=`device $usrdir`
if test ! -l $usrdir -a -d $usrdir -a $devusr -ne $devusrdir
then
MOUNTDIRS="$MOUNTDIRS $usrdir"
fi
done
show File system reorganization ... '\c'
# Begin actually making changes. Above was read-only.
#-------------- Create place for state files ---------
mkdir $STATE
test -d $STATE || { show Failed - Cannot write /root; exit; }
#-------------- Create /var or /usr/var---------------
# If /root/var already a directory (or symlink thereto)
# on the same file system as /usr, but not to usr itself
# (so the mv's work) then let it be. Otherwise, make it so.
umount -kt efs -b /,/root,/root/usr
# must unmount stuff below /usr so mv's, purge's work
varinode=`stat -iq /root/var || echo 0`
usrinode=`stat -iq /root/usr || echo 0`
test -d /root/var -a $devvar -eq $devusr -a $varinode -ne $usrinode || {
rmdir /root/var && setstate rmdir_var
purge /root/var `scriptname unpurge_var`
if test $devroot -eq $devusr
then
# easy case: /root and /root/usr same file system
# Just put /var there too.
mkdir /root/var && setstate mkdir_var
else
# more work: make /root/usr/var the real /var,
# and make /root/var a symlink to usr/var.
purge /root/usr/var `scriptname unpurge_usr_var`
mkdir /root/usr/var && setstate mkdir_usr_var
ln -s usr/var /root/var && setstate mksymlink_var
fi
}
# final check that mv's from /root/usr to /root/var work:
for i in 0 1 2 3 4 5 6 7 8 9
do
f=/root/usr/.mrreorgrc.$i
g=/root/var/.mrreorgrc.$i
{ stat -qd $f || stat -qd $g; } && continue
mkdir $f
mv $f $g && rmdir $g || {
rmdir $f
show Failed - Cannot mv from /root/usr to /root/var
# Don't cleanup above /var, /usr/var creation.
# Leave failure evidence around for analysis.
# Aren't supposed to be here anyway, because above
# checks for /var, et al mount points should be
# sufficient to ensure that such mv's "usually" work.
exit
}
break
done
#-------------- mv /usr/$USRDIRStoMV to /var ---------
# Move /usr subdirectories:
# USRDIRStoMV="spool adm mail preserve tmp lib/inst lib/rfindd"
# to /var.
for i in $USRDIRStoMV
do
echo
usr_name=/root/usr/$i
base=`basename $i`
var_name=/root/var/$base
# example sym_prefix's (relative symlink prefix):
# usr_name sym_prefix
# /root/usr/adm ..
# /root/usr/tmp ..
# /root/usr/lib/inst ../..
# /root/usr/lib/rfindd ../..
sym_prefix=`echo $usr_name |
sed -e 's;/root/usr/;;' -e 's;[^/][^/]*;..;g'`
purge $var_name `scriptname unpurge_var.$base`
# Determine if $usr_name is a symlink that points (perhaps
# multi-hop) at $var_name. Do so by temporarily placing a
# directory at $var_name, seeing if $usr_name stat's as a
# directory, removing the $var_name directory, and seeing
# if $usr_name no longer stat's as a directory.
mkdir $var_name
usrWasDir=`test -d $usr_name && echo true || echo false`
rmdir $var_name
if `$usrWasDir` && test ! -d $usr_name
then
# $usr_name -> $var_name. Desired reorg action: noop.
unpurge `scriptname unpurge_var.$base`
elif echo "$MOUNTDIRS" | grep "$usr_name" > /dev/null
then
show "\nSkipping relocation of $usr_name since it is at or below a mount point."
unpurge `scriptname unpurge_var.$base`
else
mv $usr_name /root/var &&
setstate mv.$base
ln -s $sym_prefix/var/$base $usr_name &&
setstate ln.$base
fi
done
echo
mount -ct efs -b /,/root,/root/usr
# remount any further stuff below /usr
echo
#-------------- move /usr/lib/cron -------------------
# If /usr/lib/cron exists, then
# move its log files to /var/cron
# move other files to /etc/cron.d
if test -d /root/usr/lib/cron
then
cd /root/usr/lib/cron
purge /root/var/cron `scriptname unpurge_var_cron`
mkdir /root/var/cron && setstate mkdir_var_cron
test -d /root/var/cron &&
mv *log /root/var/cron &&
setstate mv.var_cron
purge /root/etc/cron.d `scriptname unpurge_etc_cron.d`
mkdir /root/etc/cron.d && setstate mkdir_etc_cron.d
test -d /root/etc/cron.d &&
mv `ls -A1` /root/etc/cron.d &&
setstate mv.etc_cron.d
cd /
fi
rmdir /root/usr/lib/cron && setstate rmdir_usr_lib_cron
purge /root/usr/lib/cron `scriptname unpurge_usr_lib_cron`
#-------------- done with reorg ----------------------
ls -lt $STATE
# simulatation of: head $STATE/*
for i in $STATE/*
do
: '==> '$i' <=='
sed 10q $i
:
done
d=/root/var/inst
while :
do
test -d $d && break
d=`dirname $d`
done
gzip -c $LOG > $d/.mrreorgrc.debug.Z
show done
;;
cleanup)
test -d $STATE || exit # exit if no reorg in progress
if test -f /root/.varupdate
then
#-------------- cleanup ------------------------------
# We just upgraded to IRIX 5. Cleanup the saved files
# that were left around in case we had to undo the reorg.
# The old instdriver reorg code only did one thing here:
# remove /root/var.sav if it had less than 20 files below it.
# Why risking removing a small var.sav? Let's leave it,
# and do nothing (other than clean out $STATE, below).
: noop
else
#-------------- undo ---------------------------------
# Apparently didn't upgrade to IRIX 5 after all.
# Undo the reorg changes done above, in reverse order.
#-------------- Force all fstab mounts ---------------
# This script can fail if the umount/mount sequence
# below changes what's mounted. Quietly avoid that,
# by doing an extra umount/mount pair.
umount -kt efs -b /
mount -ct efs -b /
unpurge `scriptname unpurge_usr_lib_cron`
teststate rmdir_usr_lib_cron &&
mkdir /root/usr/lib/cron &&
clearstate rmdir_usr_lib_cron
if test -d /root/usr/lib/cron
then
teststate mv.etc_cron.d &&
test -d /root/etc/cron.d && {
cd /root/etc/cron.d
mv `ls -A1` /root/usr/lib/cron
cd /
} &&
clearstate mv.etc_cron.d
teststate mkdir_etc_cron.d &&
rmdir /root/etc/cron.d &&
clearstate mkdir_etc_cron.d
unpurge `scriptname unpurge_etc_cron.d`
teststate mv.var_cron &&
test -d /root/var/cron && {
cd /root/var/cron
mv *log /root/usr/lib/cron
cd /
} &&
clearstate mv.var_cron
teststate mkdir_var_cron &&
rmdir /root/var/cron &&
clearstate mkdir_var_cron
unpurge `scriptname unpurge_var_cron`
fi
umount -kt efs -b /,/root,/root/usr
# must unmount stuff below /usr so mv's works
for i in `reverse $USRDIRStoMV`
do
echo
usr_name=/root/usr/$i
base=`basename $i`
var_name=/root/var/$base
teststate ln.$base &&
test -l $usr_name &&
rm $usr_name &&
clearstate ln.$base
teststate mv.$base &&
test -d `dirname $usr_name` &&
test ! -d $usr_name &&
mv $var_name $usr_name &&
clearstate mv.$base
unpurge `scriptname unpurge_var.$base`
done
mount -ct efs -b /,/root,/root/usr
# remount any further stuff below /usr
teststate mksymlink_var &&
test -l /root/var &&
rm /root/var &&
clearstate mksymlink_var
teststate mkdir_usr_var &&
rmdir /root/usr/var &&
clearstate mkdir_usr_var
unpurge `scriptname unpurge_usr_var`
teststate mkdir_var &&
rmdir /root/var &&
clearstate mkdir_var
unpurge `scriptname unpurge_var`
teststate rmdir_var &&
mkdir /root/var &&
clearstate rmdir_var
fi
ls -lt $STATE
# simulatation of: head $STATE/*
for i in $STATE/*
do
: '==> '$i' <=='
sed 10q $i
:
done
rm -r $STATE
d=/root/var/inst
while :
do
test -d $d && break
d=`dirname $d`
done
gzip -c $LOG > $d/.mrreorgrc.debug.Z
;;
*)
show Usage: mrreorgrc '{reorg|cleanup}'
;;
esac

38
eoe/cmd/initpkg/mrvolhdrrc.sh Executable file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
#Tag 0x00000f00
#ident "$Revision $"
. mrprofrc
# see comments in mrinstrc for details. No longer
# has much to do...
case $1 in
bootnorm) # mark us has having completed normally.
oval="`nvram OSLoadOptions`"
case "$oval" {
INST*) MAJ=0; MIN=0
dvhtool -v get sash /tmp/sash$$
eval `strings /tmp/sash$$ 2>&- | sed -n \
's/^.*Version \([0-9]*\)\.\([0-9]*\) .*$/MAJ=\1; MIN=\2;/p'`
rm /tmp/sash$$ 2>&-
if [ "$MAJ" -lt 6 -o \( "$MAJ" -eq 6 -a "$MIN" -lt 4 \) ]; then
# On pre-6.4 sash, clear OSLoadOptions since setting it
# to instauto will cause sash to set it to just auto, which
# will cause sash not to autoboot on the second reboot.
oval=""
else
# On 6.4 and later, sash understands that "instfoo" means
# a miniroot install completed successfully, and sets it
# to NULL before returning to multi-user mode.
oval="inst${oval#INST}"
fi
nvram OSLoadOptions "$oval"
}
;;
*)
echo Usage: mrvolhdrrc bootnorm
esac

9
eoe/cmd/initpkg/multi.sh Normal file
View File

@@ -0,0 +1,9 @@
#! /sbin/sh
#Tag 0x00000800
#
# Take the system multi user. This is a nop if the system is already
# multi user.
#
# $Revision: 1.5 $
/sbin/telinit 2

View File

@@ -0,0 +1,93 @@
#ident "$Revision: 1.51 $"
# make script for rc0.d stuff
#
# Sequence number utilization
#
# These are all the known users of sequence numbers in the /etc/rc0.d
# directory. Please keep this list up to date...
#
# Name Description
#
# K02CMW - shut down Compartmented Mode Window management
# K02xdm - shut down xdm (unused in the CMW case)
# K03announce - display shut down message
# K04cachefs - unmount cachefs file systems
# * K10cadmin - shut down Cadmin daemons
# K15cron - shut down cron
# K18uucp - shut down uucp
# K20mail - shut down mail
# K22acct - shut down process accounting
# K25lp - shut down SysV printer support (in print ISM >= 5.3)
# K26bsdlpr - shut down BSD printer support (in print ISM >= 5.3)
# * K27audit - shut down C2 auditing
# * K28nsr - shut down IRIS NetWorker
# K30cdromd - stop CD rom access daemons
# K30msdosd - stop MSDOS filesystem access daemons
# K30netls -
# K32rfindd -
# * K35atria -
# K35lt -
# K35nck -
# * K37failsafe - shut down IRIS FailSafe and clean up
# * K38aliases-ip -
# * K38BDSpro - shut down Bulk Data Service server
# K40network - shut down network (NFS, automount, etc)
# * K45sysctlr - shut down Everest system controller daemon
# * K66nqs - Network Queueing System
# K72callsvr - ???
# K75array - shut down array services
# K78winattr -
# K80postinst - clean up any failed installation operations
# K82sysetup - stop syslogd
# K83swap - remove all swap files except /dev/swap
# K84filesystems - unmount all filesystems other than / and /usr
# * K88epoch - stop EPOCH daemons
# * K92volmgr - stop IRIS Volume Manager volumes
# K92lv - stop all LV volumes
# K98usr - unmount /usr
#
# * - unbundled products that must fit into this sequence
# ??? - these may no longer be active
#
include $(ROOT)/usr/include/make/commondefs
# XXX you must uncomment for loop in install rule if you uncomment this
#STARTLST=
STOPLST1=K40network K82sysetup K84filesystems K38aliases-ip
STOPLST2=K02CMW K02xdm K03announce K15cron K20mail K80postinst K98usr K83swap \
K99disk_patch
STOPLST =$(STOPLST1) $(STOPLST2)
INSDIR =/etc/rc0.d
FRMDIR =../init.d
default:$(FRC)
clean:
clobber:clean
FRC:
install:default
$(INSTALL) -idb "std.sw.unix mr" -dir $(INSDIR)
for f in $(STOPLST1); do \
fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
$(INSTALL) -idb "std.sw.unix mr" -F $(INSDIR) -lns $$fn $$f; \
done
for f in $(STOPLST2); do \
fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
$(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
done
$(INSTALL) -idb "std.sw.unix" -idb "mach(CPUBOARD=IP19 CPUBOARD=IP21 CPUBOARD=IP25)" -F $(INSDIR) \
-lns $(FRMDIR)/sysctlr K45sysctlr
$(INSTALL) -idb "eoe2.sw.uucp" -F $(INSDIR) -lns $(FRMDIR)/uucp K18uucp
# for f in $(STARTLST); do \
# fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
# $(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
# done

51
eoe/cmd/initpkg/rc0.sh Normal file
View File

@@ -0,0 +1,51 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.33 $"
# "Run Commands" for init state 0
# Leaves the system in a state where it is safe to turn off the power
# or go to firmware.
if [ -d /etc/rc0.d ]
then
for f in /etc/rc0.d/K*
{
if [ -s ${f} ]
then
/sbin/sh ${f} stop
fi
}
# system cleanup functions ONLY (things that end fast!)
for f in /etc/rc0.d/S*
{
if [ -s ${f} ]
then
/sbin/sh ${f} start
fi
}
fi
trap "" 15
/sbin/suattr -C CAP_KILL,CAP_MAC_WRITE+ipe -c "kill -15 -1"
sleep 1
/sbin/suattr -C CAP_SHUTDOWN+ip -c "/sbin/killall 9"
# unmount anything that didn't get unmounted before.
_DLMNTS=""
if [ "`/sbin/nvram diskless 2> /dev/null`" -eq 1 ] ; then
_DLMNTS=",/swap,/sbin"
fi
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/umount -ak -b /proc,/debug,/hw,/var,/usr,/dev/fd${_DLMNTS}"
# install reconfigured kernel
if test -x /unix.install; then
mv /unix.install /unix
fi
# sometimes one of the umount -k's during shutdown will block, and keep
# / from being umounted cleanly
/sbin/killall umount
sync

60
eoe/cmd/initpkg/rc1.sh Normal file
View File

@@ -0,0 +1,60 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.18 $"
# "Run Commands" for init state 1
# Leaves the system in state S for system maintenance.
# The sequence is the same as for state 0 except for the
# transition to state S
echo 'The system is coming down. Please wait.'
# The following segment is for historical purposes.
# There should be nothing in /etc/shutdown.d.
if [ -d /etc/shutdown.d ]
then
for f in /etc/shutdown.d/*
{
if [ -f /etc/shutdown.d/$f ]
then
/bin/sh ${f}
fi
}
fi
# End of historical section
if [ -d /etc/rc0.d ]
then
for f in /etc/rc0.d/K*
{
if [ -s ${f} ]
then
/bin/sh ${f} stop
fi
}
# system cleanup functions ONLY (things that end fast!)
for f in /etc/rc0.d/S*
{
if [ -s ${f} ]
then
/bin/sh ${f} start
fi
}
fi
trap "" 15
/sbin/suattr -C CAP_KILL,CAP_MAC_WRITE+ipe -c "kill -15 -1"
sleep 10
/sbin/suattr -C CAP_SHUTDOWN+ip -c "/sbin/killall 9"
sleep 3
# unmount anything that didn't get unmounted before.
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/umount -ak -b /proc,/debug,/hw"
sync
sync; sync
echo '
The system is down.'
sync
/sbin/init S

View File

@@ -0,0 +1,119 @@
#ident "$Revision: 1.85 $"
# make script for rc2.d stuff
#
# Sequence number utilization
#
# These are all the known users of sequence numbers in the /etc/rc2.d
# directory. Please keep this list up to date...
#
# Name Description
#
# S00announce - display startup message
# S00disk_patch - warn about downrev stiction-prone ibm drives
# S04usr - mount /usr
# * S06volmgr - start up IRIS Volume Manager volumes
# * S08CMWchkconfig - note and repair CMW configuration errors
# * S10epoch - start up EPOCH daemons
# S12filesystems - mount the rest of the filesystems in /etc/fstab
# S14quotas - initialize file space quotas
# S16postinst - clean up any failed installation operations
# S20sysetup - set hostname, start syslogd, etc
# S21perf -
# S22acct -
# S23autoconfig - check if we need a new kernel built
# S30network - start up network (NFS, automount, etc)
# S32aliases-ip -
# S33sysctlr - start up Everest system controller daemon
# S33sn0start - Log messages on the SN0 system, start up the
# system controller, etc.
# S33partcfg - start up the Partition Config Daemon
# S34snmp - start up SNMP agents
# * S35audit - start up C2 auditing
# * S37failsafe - start up IRIS FailSafe
# * S38BDSpro - start up Bulk Data Service server
# S40nck -
# S45netls -
# S48savecore - check for coredumps
# S49swap - add swap files
# S50mail - start up mail processing
# S58rmtmpfiles - clean up /tmp and leftover editor files
# S60lp - start SysV printer support (in print ISM >= IRIX 5.3)
# S61bsdlpr - start BSD printer support (in print ISM >= IRIX 5.3)
# S62array - start array services
# * S65nsr - start IRIS NetWorker daemons
# * S66nqs - Network Queueing System
# S70uucp - start UUCP support
# S72callsvr - ???
# S75cron - start cron support
# * S77atria -
# * S80lt - ???
# S83audio - installed in dmedia ism
# S85svideo - ???
# S88configmsg - print "files have changed" message for inst
# S90chkdev - check that tape and floppy devices exist; must follow
# - autoconfig, and should precede mediad
# S94grio - start guarantee rate i/o daemon
# * S95avail - start availability monitor
# S96jserver - ???
# S96fontserver - start the X11 font server daemon
# * S97cadmin - start Cadmin daemons
# S97mediad - removable media; installed from cmd/mediad
# * S98CMW - Compartmented Mode Window Management
# S98rfindd -
# S98xdm - start the screen manager (unused in the CMW case)
# S99cachefs - mount cachefs file systems
# - may be depndent upon removable media
#
# * - unbundled products that must fit into this sequence
# ??? - these may no longer be active
#
include $(ROOT)/usr/include/make/commondefs
STARTMR=S12filesystems S20sysetup S58rmtmpfiles S90chkdev
STARTSTD=S04usr S16postinst S23autoconfig S30network S32aliases-ip \
S34snmp S48savecore S49swap S50mail S75cron \
S88configmsg S94grio S96fontserver S98CMW S98xdm S00announce \
S00disk_patch S08CMWchkconfig
# XXX if you uncomment this you must uncomment the for loop under install:
#STOPLST =
INSDIR =/etc/rc2.d
FRMDIR =../init.d
default:$(FRC)
clean:
clobber:clean
FRC:
install:default
$(INSTALL) -idb "std.sw.unix mr" -dir $(INSDIR)
for f in $(STARTMR); do \
fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
$(INSTALL) -idb "std.sw.unix mr" -F $(INSDIR) -lns $$fn $$f; \
done
for f in $(STARTSTD); do \
fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
$(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
done
$(INSTALL) -idb "std.sw.unix" -idb "mach(CPUBOARD=IP19 CPUBOARD=IP21 CPUBOARD=IP25)" -F $(INSDIR) \
-lns $(FRMDIR)/sysctlr S33sysctlr
$(INSTALL) -idb "std.sw.unix" -idb "mach(CPUBOARD=IP27)" -F $(INSDIR) \
-lns $(FRMDIR)/sn0start S33sn0start
$(INSTALL) -idb "std.sw.unix" -idb "mach(CPUBOARD=IP27)" -F $(INSDIR) \
-lns $(FRMDIR)/partcfg S33partcfg
$(INSTALL) -idb "std.sw.unix" -idb "mach(CPUBOARD=IP30)" -F $(INSDIR) \
-lns $(FRMDIR)/machdepstart.ip30 S48machdepstart
$(INSTALL) -idb "eoe2.sw.uucp" -F $(INSDIR) -lns $(FRMDIR)/uucp S70uucp
$(INSTALL) -idb "std.sw.quotas" -F $(INSDIR) -lns $(FRMDIR)/quotas S14quotas
# for f in $(STOPLST); do \
# fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
# $(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
# done

86
eoe/cmd/initpkg/rc2.sh Normal file
View File

@@ -0,0 +1,86 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.23 $"
# "Run Commands" executed when the system is changing to init state 2,
# traditionally called "multi-user".
# Mount /proc if it is not already mounted.
/etc/mntproc
# Pickup start-up packages for mounts, daemons, services, etc.
set `who -r`
if [ $9 = "S" ]
then
#
# Coming from single-user
#
BOOT=yes
if [ -f /etc/rc.d/PRESERVE ] # historical segment for vi and ex
then
mv /etc/rc.d/PRESERVE /etc/init.d
ln /etc/init.d/PRESERVE /etc/rc2.d/S02PRESERVE
fi
elif [ $7 = "2" ]
then
#
# Coming from some other state (ie: not single user)
# Shut down any services available in the other state.
#
echo 'Changing to state 2.'
if [ -d /etc/rc2.d ]
then
for f in /etc/rc2.d/K*
{
if [ -s ${f} ]
then
/sbin/sh ${f} stop
fi
}
fi
fi
#
# Execute all package initialization scripts
# (ie: mount the filesystems, start the daemons, etc)
#
if [ -d /etc/rc2.d ]
then
for f in /etc/rc2.d/S*
{
if [ -s ${f} ]
then
/sbin/sh ${f} start
fi
}
fi
#
# Historical - run any scripts in /etc/rc.d
#
if [ "${BOOT}" = "yes" -a -d /etc/rc.d ]
then
for f in `ls /etc/rc.d`
{
if [ ! -s /etc/init.d/${f} ]
then
/sbin/sh /etc/rc.d/${f}
fi
}
fi
#
# Make the SysAdmin warm and fuzzy
#
if [ "${BOOT}" = "yes" -a $7 = "2" ]
then
if chkconfig verbose
then
echo "The system is ready."
fi
elif [ $7 = "2" ]
then
echo 'Change to state 2 has been completed.'
fi

View File

@@ -0,0 +1,43 @@
#ident "$Header: /proj/irix6.5.7m/isms/eoe/cmd/initpkg/rc3.d/RCS/Makefile,v 1.12 1992/11/11 17:48:29 curtis Exp $"
# make script for rc3.d stuff
#
# Sequence number utilization
#
# These are all the known users of sequence numbers in the /etc/rc0.d
# directory. Please keep this list up to date...
#
# Name Description
#
# * - unbundled products that must fit into this sequence
#
include $(ROOT)/usr/include/make/commondefs
# XXX if you define these you must uncomment the for loops under install:
#STARTLST =
#STOPLST =
INSDIR = /etc/rc3.d
FRMDIR = /etc/init.d
default:$(FRC)
clean:
clobber:clean
FRC:
install: default
$(INSTALL) -idb "std.sw.unix" -dir $(INSDIR)
# for f in $(STOPLST); do \
# fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
# $(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
# done
# for f in $(STARTLST); do \
# fn=$(FRMDIR)/`expr $$f : '...\(.*\)'` ; \
# $(INSTALL) -idb "std.sw.unix" -F $(INSDIR) -lns $$fn $$f; \
# done

30
eoe/cmd/initpkg/rc3.sh Normal file
View File

@@ -0,0 +1,30 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.9 $"
# "Run Commands" executed when the system is changing to init state 3,
# same as state 2 (multi-user) but with remote file sharing.
set `who -r`
if [ -d /etc/rc3.d ]
then
for f in /etc/rc3.d/K*
{
if [ -s ${f} ]
then
/bin/sh ${f} stop
fi
}
for f in /etc/rc3.d/S*
{
if [ -s ${f} ]
then
/bin/sh ${f} start
fi
}
fi
if [ $9 = 'S' ]
then
echo '
The system is ready.'
fi

23
eoe/cmd/initpkg/reboot.sh Normal file
View File

@@ -0,0 +1,23 @@
#! /sbin/sh -e
#Tag 0x00000800
# Reboot the system--take it down and let it come back up
#
# $Revision: 1.11 $"
if test -n "$REMOTEHOST"; then
echo "Reboot `hostname -s`? \c"
read reply
case "$reply" in
[yY]*)
;;
*)
echo "'Reboot' cancelled."
exit 0
;;
esac
fi
/etc/shutdown -y -g0 -i6
sleep 10 2> /dev/null

File diff suppressed because it is too large Load Diff

73
eoe/cmd/initpkg/setsid.c Normal file
View File

@@ -0,0 +1,73 @@
/*
* setsid command args ...
*
* Does setsid(2) system call and exec's command args ...
* Causes resulting command to run as process group leader.
* Useful in /etc/inittab, for :wait: and :bootwait:
* (which unlike other entries, init doesn't make group leaders)
* which want to interact on the console with the user,
* and have ^C (stty intr) work.
*
* For example, use this by changing the inittab line:
* prei:2:bootwait:/etc/mrinitrc </dev/console >/dev/console 2>&1
* to the line:
* prei:2:bootwait:setsid /dev/console /etc/mrinitrc
*
* Silicon Graphics
* Paul Jackson
* March 11, 1994
*/
#include <unistd.h>
#include <fcntl.h>
#include <termio.h>
main (int argc, char *const *argv)
{
char *msg;
int ercfd;
int i, retry=0;
pid_t tpgrp;
char *ttyd = argv[1];
char cons[8];
/* dup stderr for error message if exec fails */
ercfd = dup(2);
fcntl (ercfd, F_SETFD, FD_CLOEXEC);
retryit:
close(0);
close(1);
close(2);
setsid();
open(ttyd, O_RDWR);
open(ttyd, O_RDWR);
open(ttyd, O_RDWR);
if(!retry && ioctl(1, TIOCGPGRP, &tpgrp) == -1) {
/* didn't get a controlling tty; try console device matching
* nvram console, or keyboard SIGINT and some scripts will fail. */
if(sgikopt("console", cons, sizeof(cons)) == 0) {
ttyd = (*cons == 'd') ? "/dev/ttyd1" : "/dev/tport";
retry++;
goto retryit;
}
}
argv += 2;
argc -= 2;
execv (*argv, argv);
msg = "setsid execv failed:";
write (ercfd, msg, strlen(msg));
for (i=0; i<argc; i++) {
write (ercfd, " ", 1);
write (ercfd, argv[i], strlen(argv[i]));
}
write (ercfd, "\n", 1);
exit (1);
}

197
eoe/cmd/initpkg/shutdown.sh Normal file
View File

@@ -0,0 +1,197 @@
#! /sbin/sh
#Tag 0x00000f00
#ident "$Revision: 1.34 $"
# Sequence performed to change the init stat of a machine.
# This procedure checks to see if you are permitted and allows an
# interactive shutdown. The actual change of state, killing of
# processes and such are performed by the new init state, say 0,
# and its /etc/rc0.
# Usage: shutdown [ -y ] [ -g<grace-period> ] [ -i<init-state> ] [ -p ]
# -p requests that the machine powerdown, if supported (Indigo^2).
# Ignored if init-state is not 0.
# same path as default superuser path in /etc/default/login
# guards against getting wrong versions of programs/scripts
# for commands invoked by relative name
PATH=/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/etc:/usr/etc:/usr/bin/X11
# I18N
# ----------------------------------------------------------------------------
ask() {
#! ask msg default
#! default should be 0 for "no", "yes" otherwise
#! returns 0 for "no", otherwise "yes"
yesstr=`gettxt ${msgfile}:171 "yes"`
nostr=`gettxt ${msgfile}:172 "no"`
choicefmt=`gettxt ${msgfile}:169 "(%s/%s)"`
defaultfmt=`gettxt ${msgfile}:170 "[%s]"`
shortyes=`echo $yesstr | cut -c1`
shortno=`echo $nostr | cut -c1`
fmt=${choicefmt}${defaultfmt}
if [ $2 -eq 0 ]
then
str=`printf "${choicefmt}${defaultfmt} : " "$yesstr" "$nostr" "$nostr"`
else
str=`printf "${choicefmt}${defaultfmt} : " "$yesstr" "$nostr" "$yesstr"`
fi
printf "%s%s" "$1" "$str"
read ans
# convert answer to lowercase
ans=`echo $ans | tr '[A-Z]' '[a-z]'`
case "$ans" in
${yesstr}*) ret=1
;;
${nostr}*) ret=0
;;
${shortyes}*) ret=1
;;
${shortno}*) ret=0
;;
*) ret=$2
;;
esac
return ${ret}
} # End of ask
msgfile=uxsgicore
# ----------------------------------------------------------------------------
# Check the user id.
if [ -x /usr/bin/id ]
then
eval `id | sed 's/[^a-z0-9=].*//'`
if [ "${uid:=0}" -ne 0 ]
then
printf "`gettxt ${msgfile}:710 '%s: Only root can run /etc/shutdown.'`\n" $0
exit 2
fi
fi
grace=60
askconfirmation=yes
initstate=0
while [ $# -gt 0 ]
do
case $1 in
-g[0-9]* )
grace=`expr "$1" : '-g\(.*\)'`
;;
-i[Ss016] )
initstate=`expr "$1" : '-i\(.*\)'`
;;
-i[2345] )
initstate=`expr "$1" : '-i\(.*\)'`
printf "`gettxt ${msgfile}:711 '%s: Initstate $initstate is not for system shutdown'`\n" $0
exit 1
;;
-y )
askconfirmation=
;;
-p )
poweroff=yes
;;
-* )
printf "`gettxt ${msgfile}:712 'Illegal flag argument \'%s\''`\n" $1
exit 1
;;
* )
printf "`gettxt ${msgfile}:713 'Usage: %s [ -y ] [ -g<grace> ] [ -i<initstate> ]'`\n" $0
exit 1
esac
shift
done
#
# ask shutdown reason as soon as possible
#
/usr/etc/amsdreasons -i ${initstate}
#
# IRIX does not provide /etc/bupscd. However, the following lines could
# be re-enabled by VARs who do (e.g. Sinix)
#
# if [ -n "${askconfirmation}" -a -x /etc/ckbupscd ]
# then
# # Check to see if backups are scheduled at this time
# BUPS=`/etc/ckbupscd`
# if [ "$BUPS" != "" ]
# then
# echo "$BUPS"
# ask "`gettxt ${msgfile}:714 'Do you wish to abort this shutdown and return to \ncommand level to do these backups ? '`" 0
# if [ $? -ne 0 ] # check for yes
# then
# exit 1
# fi
# fi
# fi
#
if [ -z "${TZ}" -a -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
fi
printf "%s" "`gettxt ${msgfile}:715 'Shutdown started. '`"
date
sync
cd /
trap "exit 1" 1 2 15
a="`who | wc -l`"
if [ ${a} -gt 1 -a ${grace} -gt 0 ]
then
if [ -x /sbin/wall ]
then
printf "`gettxt ${msgfile}:716 'The system will be shut down in %s seconds.\nPlease log off now.\n'`" "${grace}"| \
/sbin/wall &
fi
sleep ${grace}
fi
if [ -x /sbin/wall ]
then
echo `gettxt ${msgfile}:717 "THE SYSTEM IS BEING SHUT DOWN! Log off now."` | /sbin/wall &
fi
if [ ${grace} -gt 60 ]
then
sleep 60
else
sleep ${grace}
fi
if [ ${askconfirmation} ]
then
ask "`gettxt ${msgfile}:718 'Do you want to continue with the shutdown ? '`" 0
b=$?
else
b=1
fi
if [ $b -eq 0 ]
then
if [ -x /sbin/wall ]
then
echo `gettxt ${msgfile}:719 "False Alarm: The system will not be brought down."` | /sbin/wall
fi
echo `gettxt ${msgfile}:720 'Shut down aborted.'`
exit 1
fi
if [ "$poweroff" = yes -a "$initstate" = "0" ]
then
:
/sbin/uadmin 256 9 # set poweroff flag
fi
/sbin/init ${initstate}

22
eoe/cmd/initpkg/single.sh Normal file
View File

@@ -0,0 +1,22 @@
#! /sbin/sh
#Tag 0x00000f00
#
# Take the system single user. This is a nop if the system is already
# single user.
#
# $Revision: 1.5 $
if test -n "$REMOTEHOST"; then
echo "Shutdown `hostname`? \c"
read reply
case "$reply" in
[yY]*)
;;
*)
echo "'single' cancelled."
exit 0
;;
esac
fi
/sbin/telinit s

View File

@@ -0,0 +1,7 @@
#! /sbin/sh
#ident "$Revision: 1.15 $"
#
# Unmounts all but the root file system (/).
#
exec /sbin/suattr -C CAP_MOUNT_MGT+ip -c "/sbin/umount -ak -b /proc,/debug,/hw"

View File

@@ -0,0 +1,22 @@
#! /sbin/sh
#ident "$Revision: 1.6 $"
# unmount what we didn't in rc0.
if [ "`/sbin/nvram diskless 2> /dev/null`" -eq 1 ] ; then
_DLMNTS=",/swap,/sbin,/usr"
fi
/sbin/suattr -C CAP_MOUNT_MGT+ip -c "/etc/umount -ak -b /proc,/debug,/hw${_DLMNTS}" > /dev/console 2>&1
#
# xlv_shutdown gracefully shuts down all xlv volumes (except
# a root xlv volume, if one exists). The filesystems should be
# unmounted before the underlying xlv volumes are 'disassembled'.
# However, xlv_shutdown does make sure this is actually the case;
# if they are still left mounted for some reason, it doesn't
# shutdown the corresponding logical volume.
#
if [ -x /sbin/xlv_shutdown ]; then
/sbin/suattr -C CAP_DEVICE_MGT+ip -c "/sbin/xlv_shutdown"
fi

29
eoe/cmd/initpkg/xdm Normal file
View File

@@ -0,0 +1,29 @@
#!/sbin/sh
#
# Start X Display Manager
#
# $Revision: 1.2 $
#
IS_ON=/etc/chkconfig
XSGI=/usr/bin/X11/Xsgi
XDM=/usr/bin/X11/xdm
case "$1" in
'start')
if test -x $XDM; then
if $IS_ON windowsystem && test -x $XSGI || $IS_ON xdm; then
exec $XDM
fi
fi
;;
'stop')
/etc/killall -TERM xdm
;;
*)
echo "usage: /etc/init.d/xdm {start|stop}"
;;
esac