Browse Source

have shutdown code run /etc/rc with arg of "shutdown"; rc.shutdown becomes completely admin-editable

OPENBSD_2_6
deraadt 25 years ago
parent
commit
5e54c51bd5
2 changed files with 21 additions and 14 deletions
  1. +17
    -1
      src/etc/rc
  2. +4
    -13
      src/etc/rc.shutdown

+ 17
- 1
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.107 1999/08/31 03:47:16 deraadt Exp $
# $OpenBSD: rc,v 1.108 1999/09/03 18:11:48 deraadt Exp $
# System startup script run by init on autoboot # System startup script run by init on autoboot
# or after single-user. # or after single-user.
@ -16,6 +16,22 @@ HOME=/; export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH export PATH
if [ $1x = shutdownx ]; then
dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
chmod 600 /var/db/host.random >/dev/null 2>&1
if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then
echo /etc/rc.shutdown in progress...
. /etc/rc.shutdown
echo /etc/rc.shutdown complete.
if [ "X${powerdown}" = X"YES" ]; then
exit 2
fi
else
echo single user: not running /etc/rc.shutdown
fi
exit 0
fi
# Configure ccd devices. # Configure ccd devices.
if [ -f /etc/ccd.conf ]; then if [ -f /etc/ccd.conf ]; then
ccdconfig -C ccdconfig -C


+ 4
- 13
src/etc/rc.shutdown View File

@ -1,21 +1,12 @@
# $OpenBSD: rc.shutdown,v 1.4 1999/07/25 19:32:17 deraadt Exp $
# $OpenBSD: rc.shutdown,v 1.5 1999/09/03 18:11:48 deraadt Exp $
# #
# If it exists, this script is run at system-shutdown by reboot(8), # If it exists, this script is run at system-shutdown by reboot(8),
# halt(8).
# If the architecture supports keyboard requested halting, it is also
# run by init(8) when such an event happens.
# halt(8). If the architecture supports keyboard requested halting,
# it is also run by init(8) when such an event happens.
# #
echo /etc/rc.shutdown in progress...
# save part of our entropy pool for reuse on reboot
dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
chmod 600 /var/db/host.random >/dev/null 2>&1
powerdown=NO # set to YES for powerdown
# #
# Your shell code goes here # Your shell code goes here
# #
echo shutdown complete.
exit 0 # An exit code of 2 will cause init(8) to attempt powerdown.

Loading…
Cancel
Save