diff options
Diffstat (limited to 'source/a/sysvinit-scripts/scripts')
-rw-r--r-- | source/a/sysvinit-scripts/scripts/inittab | 2 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rc.6 | 22 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rc.M | 13 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rc.S | 50 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh | 96 | ||||
-rw-r--r-- | source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh.diff | 18 |
6 files changed, 139 insertions, 62 deletions
diff --git a/source/a/sysvinit-scripts/scripts/inittab b/source/a/sysvinit-scripts/scripts/inittab index 9f8b422d1..ba6fe79e9 100644 --- a/source/a/sysvinit-scripts/scripts/inittab +++ b/source/a/sysvinit-scripts/scripts/inittab @@ -49,7 +49,7 @@ pf::powerfail:/sbin/genpowerfail start pg::powerokwait:/sbin/genpowerfail stop # These are the standard console login getties in multiuser mode: -c1:12345:respawn:/sbin/agetty 38400 tty1 linux +c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux c2:12345:respawn:/sbin/agetty 38400 tty2 linux c3:12345:respawn:/sbin/agetty 38400 tty3 linux c4:12345:respawn:/sbin/agetty 38400 tty4 linux diff --git a/source/a/sysvinit-scripts/scripts/rc.6 b/source/a/sysvinit-scripts/scripts/rc.6 index ca1b4c8eb..465a0a4a7 100644 --- a/source/a/sysvinit-scripts/scripts/rc.6 +++ b/source/a/sysvinit-scripts/scripts/rc.6 @@ -124,6 +124,13 @@ if echo "$PS" | /bin/grep -q -w pppd ; then fi fi +# Shut down YP services: +if [ -x /etc/rc.d/rc.yp ]; then + if grep -wq stop /etc/rc.d/rc.yp ; then + /etc/rc.d/rc.yp stop + fi +fi + # Bring down the networking system, but first make sure that this # isn't a diskless client with the / partition mounted via NFS: if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then @@ -158,14 +165,17 @@ if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit . /etc/rc.d/rc.acpid stop fi -# Kill all processes. -# INIT is supposed to handle this entirely now, but this didn't always -# work correctly without this second pass at killing off the processes. -# Since INIT already notified the user that processes were being killed, -# we'll avoid echoing this info this time around. -if [ ! "$1" = "fast" ]; then # shutdown did not already kill all processes +# Stop udev: +if [ -x /etc/rc.d/rc.udev ]; then + sh /etc/rc.d/rc.udev force-stop +fi + +# Kill all remaining processes. +if [ ! "$1" = "fast" ]; then + echo "Sending all processes the SIGTERM signal." /sbin/killall5 -15 /bin/sleep 5 + echo "Sending all processes the SIGKILL signal." /sbin/killall5 -9 fi diff --git a/source/a/sysvinit-scripts/scripts/rc.M b/source/a/sysvinit-scripts/scripts/rc.M index 8772409ed..63cb88015 100644 --- a/source/a/sysvinit-scripts/scripts/rc.M +++ b/source/a/sysvinit-scripts/scripts/rc.M @@ -83,8 +83,9 @@ if [ -x /usr/bin/fc-cache ]; then /usr/bin/fc-cache -f & fi -# If we are returning from single-user mode we will need to restart -# udevd on systems that use udev: +# Run rc.udev again. This will start udev if it is not already running +# (for example, upon return from runlevel 1), otherwise it will trigger it +# to look for device changes and to generate persistent rules if needed. if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then if ! grep -wq nohotplug /proc/cmdline ; then if [ -x /etc/rc.d/rc.udev ]; then @@ -187,9 +188,11 @@ if [ -x /etc/rc.d/rc.bluetooth ]; then sh /etc/rc.d/rc.bluetooth start fi -# Start wicd: -if [ -x /etc/rc.d/rc.wicd ]; then +# Start wicd or networkmanager: +if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then sh /etc/rc.d/rc.wicd start +elif [ -x /etc/rc.d/rc.networkmanager ]; then + sh /etc/rc.d/rc.networkmanager start fi # These GTK+/pango files need to be kept up to date for @@ -225,7 +228,7 @@ fi # Start netatalk. (a file/print server for Macs using Appletalk) if [ -x /etc/rc.d/rc.atalk ]; then - /etc/rc.d/rc.atalk + /etc/rc.d/rc.atalk start fi # Start smartd, which monitors the status of S.M.A.R.T. compatible diff --git a/source/a/sysvinit-scripts/scripts/rc.S b/source/a/sysvinit-scripts/scripts/rc.S index c02f1e276..97ff7be4c 100644 --- a/source/a/sysvinit-scripts/scripts/rc.S +++ b/source/a/sysvinit-scripts/scripts/rc.S @@ -19,21 +19,27 @@ if [ -d /sys ]; then fi fi +# If /run exists, mount a tmpfs on it (unless the +# initrd has already done so): +if [ -d /run ]; then + if ! grep -wq "tmpfs /run tmpfs" /proc/mounts ; then + /sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755 + fi +fi + # Load the loop device kernel module: if [ -x /etc/rc.d/rc.loop ]; then . /etc/rc.d/rc.loop start fi -# Initialize udev to manage /dev entries and hotplugging for 2.6.x kernels. +# Initialize udev to manage /dev entries and hotplugging for 3.x kernels. # You may turn off udev by making the /etc/rc.d/rc.udev file non-executable -# or giving the "nohotplug" option at boot, but in the 2.6.x+ kernels udev -# has taken over the job of hotplug (finding hardware and loading the kernel -# modules for it, as well as creating device nodes in /dev). Realize that -# if you turn off udev that you will have to load all the kernel modules -# that you need yourself (possibly in /etc/rc.d/rc.modules, which does not -# promise to list all of them), and make any additional device nodes that you -# need in the /dev directory. Even USB and IEEE1394 devices will need to have -# the modules loaded by hand if udev is not used with a 2.6 kernel. So use it. :-) +# or giving the "nohotplug" option at boot, but realize that if you turn off +# udev that you will have to load all the kernel modules that you need +# yourself (possibly in /etc/rc.d/rc.modules, which does not promise to list +# all of them), and make any additional device nodes that you need in the +# /dev directory. Even USB and IEEE1394 devices will need to have the +# modules loaded by hand if udev is not used. So use it. :-) if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then if ! grep -wq nohotplug /proc/cmdline ; then if [ -x /etc/rc.d/rc.udev ]; then @@ -103,10 +109,7 @@ if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then echo "${PASS}" | /sbin/cryptsetup ${LUKSOPTS} luksOpen $DEV $LUKS fi else - for i in seq 1 3 ; do - /sbin/cryptsetup ${LUKSOPTS} luksOpen $DEV $LUKS </dev/tty0 >/dev/tty0 2>&1 - [ $? -eq 0 ] && break - done + /sbin/cryptsetup ${LUKSOPTS} luksOpen $DEV $LUKS </dev/tty0 >/dev/tty0 2>&1 fi elif echo $OPTS | grep -wq swap ; then # If any of the volumes is to be used as encrypted swap, @@ -134,12 +137,13 @@ if [ -x /sbin/hwclock ]; then CLOCK_OPT="--directisa" fi if grep -wq "^UTC" /etc/hardwareclock ; then - echo "Setting system time from the hardware clock (UTC)." + echo -n "Setting system time from the hardware clock (UTC): " /sbin/hwclock $CLOCK_OPT --utc --hctosys else - echo "Setting system time from the hardware clock (localtime)." + echo -n "Setting system time from the hardware clock (localtime): " /sbin/hwclock $CLOCK_OPT --localtime --hctosys fi + date fi # Test to see if the root partition is read-only, like it ought to be. @@ -250,18 +254,14 @@ else read junk; fi # Done checking root filesystem -# Any /etc/mtab that exists here is old, so we delete it to start over: -/bin/rm -f /etc/mtab* -# Remounting the / partition will initialize the new /etc/mtab: -/sbin/mount -w -o remount / -# Read in the correct / filesystem complete with arguments so mount will -# show them correctly. This does not stop those arguments from functioning -# but does prevent a small bug with /etc/mtab. -/bin/grep ' / ' /proc/mounts | grep -v "^rootfs" > /etc/mtab +# Any /etc/mtab that exists here is old, so we start with a new one: +/bin/rm -f /etc/mtab{,~,.tmp} && /bin/touch /etc/mtab + +# Add entry for / to /etc/mtab: +/sbin/mount -f -w / -# Fix /etc/mtab to list sys and proc if they were not yet entered in -# /etc/mtab because / was still mounted read-only: +# Add /proc and /sys mounts to /etc/mtab: if [ -d /proc/sys ]; then /sbin/mount -f proc /proc -t proc fi diff --git a/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh b/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh index 5ef34d4d8..0bfca50d1 100644 --- a/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh +++ b/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh @@ -1,9 +1,11 @@ #!/bin/bash # Skript to rescan SCSI bus, using the # scsi add-single-device mechanism -# (c) 1998--2008 Kurt Garloff <kurt@garloff.de>, GNU GPL v2 or later +# (c) 1998--2010 Kurt Garloff <kurt@garloff.de>, GNU GPL v2 or v3 # (c) 2006--2008 Hannes Reinecke, GNU GPL v2 or later -# $Id: rescan-scsi-bus.sh,v 1.48 2010/08/10 19:32:22 garloff Exp $ +# $Id: rescan-scsi-bus.sh,v 1.56 2012/01/14 22:23:53 garloff Exp $ + +SCAN_WILD_CARD=4294967295 setcolor () { @@ -47,8 +49,9 @@ white_out () # Return hosts. sysfs must be mounted findhosts_26 () { - hosts= - for hostdir in /sys/class/scsi_host/host*; do + hosts=`find /sys/class/scsi_host/host* -maxdepth 4 -type d -o -type l 2> /dev/null | awk -F'/' '{print $5}' | sed -e 's~host~~' | sort -nu` + scsi_host_data=`echo "$hosts" | sed -e 's~^~/sys/class/scsi_host/host~'` + for hostdir in $scsi_host_data; do hostno=${hostdir#/sys/class/scsi_host/host} if [ -f $hostdir/isp_name ] ; then hostname="qla2xxx" @@ -57,14 +60,15 @@ findhosts_26 () else hostname=`cat $hostdir/proc_name` fi - hosts="$hosts $hostno" + #hosts="$hosts $hostno" echo "Host adapter $hostno ($hostname) found." done if [ -z "$hosts" ] ; then echo "No SCSI host adapters found in sysfs" exit 1; fi - hosts=`echo $hosts | sed 's/ /\n/g' | sort -n` + # Not necessary just use double quotes around variable to preserve new lines + #hosts=`echo $hosts | tr ' ' '\n'` } # Return hosts. /proc/scsi/HOSTADAPTER/? must exist @@ -337,11 +341,22 @@ idlist () getluns() { sgdevice - if test -z "$SGDEV"; then return; fi - if test ! -x /usr/bin/sg_luns; then echo 0; return; fi - LLUN=`sg_luns -d /dev/$SGDEV 2>/dev/null` - if test $? != 0; then echo 0; return; fi - echo "$LLUN" | sed -n 's/.*lun=\(.*\)/\1/p' + if test -z "$SGDEV"; then return 1; fi + if test ! -x /usr/bin/sg_luns; then echo 0; return 1; fi + LLUN=`sg_luns /dev/$SGDEV 2>/dev/null | sed -n 's/ \(.*\)/\1/p'` + if test $? != 0; then echo 0; return 1; fi + #echo "$LLUN" | sed -n 's/.*lun=\(.*\)/\1/p' + for lun in $LLUN ; do + # Swap LUN number + l0=$(printf '%u' 0x$lun) + l1=$(( ($l0 >> 48) & 0xffff )) + l2=$(( ($l0 >> 32) & 0xffff )) + l3=$(( ($l0 >> 16) & 0xffff )) + l4=$(( $l0 & 0xffff )) + l0=$(( ( ( ($l4 * 0xffff) + $l3 ) * 0xffff + $l2 ) * 0xffff + $l1 )) + printf "%u\n" $l0 + done + return 0 } # Wait for udev to settle (create device nodes etc.) @@ -351,6 +366,10 @@ udevadm_settle() print_and_scroll_back " Calling udevadm settle (can take a while) " /sbin/udevadm settle white_out + elif test -x /sbin/udevsettle; then + print_and_scroll_back " Calling udevsettle (can take a while) " + /sbin/udevsettle + white_out else usleep 20000 fi @@ -361,7 +380,7 @@ dolunscan() { SCSISTR= devnr="$host $channel $id $lun" - echo "Scanning for device $devnr ... " + echo -e " Scanning for device $devnr ... " printf "${yellow}OLD: $norm" testexist # Special case: lun 0 just got added (for reportlunscan), @@ -382,10 +401,6 @@ dolunscan() echo -e "${norm}\e[B\e[B" if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/delete - if test $RC -eq 1 -o $lun -eq 0 ; then - # Try readding, should fail if device is gone - echo "$channel $id $lun" > /sys/class/scsi_host/host${host}/scan - fi # FIXME: Can we skip udevadm settle for removal? #udevadm_settle usleep 20000 @@ -440,7 +455,7 @@ doreportlun() lun=0 SCSISTR= devnr="$host $channel $id $lun" - echo -en "Scanning for device $devnr ...\r" + echo -en " Scanning for device $devnr ...\r" lun0added= #printf "${yellow}OLD: $norm" # Phase one: If LUN0 does not exist, try to add @@ -470,10 +485,31 @@ doreportlun() fi fi targetluns=`getluns` + REPLUNSTAT=$? lunremove= #echo "getluns reports " $targetluns + olddev=`find /sys/class/scsi_device/ -name $host:$channel:$id:* 2>/dev/null` + oldluns=`echo "$olddev" | awk -F'/' '{print $5}' | awk -F':' '{print $4}'` + oldtargets="$targetluns" + # OK -- if we don't have a LUN to send a REPORT_LUNS to, we could + # fall back to wildcard scanning. Same thing if the device does not + # support REPORT_LUNS + # TODO: We might be better off to ALWAYS use wildcard scanning if + # it works + if test "$REPLUNSTAT" = "1"; then + if test -e /sys/class/scsi_host/host${host}/scan; then + echo "$channel $id -" > /sys/class/scsi_host/host${host}/scan 2> /dev/null + udevadm_settle + else + echo "scsi add-single-device $host $channel $id $SCAN_WILD_CARD" > /proc/scsi/scsi + fi + targetluns=`find /sys/class/scsi_device/ -name $host:$channel:$id:* 2>/dev/null | awk -F'/' '{print $5}' | awk -F':' '{print $4}' | sort -n` + let found+=`echo "$targetluns" | wc -l` + let found-=`echo "$olddev" | wc -l` + fi + if test -z "$targetluns"; then targetluns="$oldtargets"; fi # Check existing luns - for dev in /sys/class/scsi_device/${host}:${channel}:${id}:*; do + for dev in $olddev; do [ -d "$dev" ] || continue lun=${dev##*:} newsearch= @@ -589,11 +625,14 @@ if test -x /usr/bin/sg_inq; then sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3) sg_version=${sg_version##0.} #echo "\"$sg_version\"" - if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then - sg_len_arg="-36" - else + #if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then + #sg_len_arg="-36" + #else sg_len_arg="--len=36" - fi + #fi +else + echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils" + echo " or rescan-scsi-bus.sh might not fully work." fi # defaults @@ -677,12 +716,15 @@ for host in $hosts; do # It's pointless to do a target scan on FC if test -n "$lipreset" ; then echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null; + udevadm_settle fi - # Always trigger a rescan for FC to update channels and targets - echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null; + # We used to always trigger a rescan for FC to update channels and targets + # Commented out -- as discussed with Hannes we should rely + # on the main loop doing the scan, no need to do it here. + #echo "- - -" > /sys/class/scsi_host/host$host/scan 2> /dev/null; + #udevadm_settle channelsearch= idsearch= - udevadm_settle else channelsearch=$opt_channelsearch idsearch=$opt_idsearch @@ -707,3 +749,7 @@ fi echo "$found new device(s) found. " echo "$rmvd device(s) removed. " +# Local Variables: +# sh-basic-offset: 2 +# End: + diff --git a/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh.diff b/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh.diff new file mode 100644 index 000000000..89e276935 --- /dev/null +++ b/source/a/sysvinit-scripts/scripts/rescan-scsi-bus.sh.diff @@ -0,0 +1,18 @@ +--- rescan-scsi-bus.sh.orig 2012-01-14 16:43:33.000000000 -0600 ++++ rescan-scsi-bus.sh 2012-09-07 12:51:52.003994404 -0500 +@@ -625,11 +625,11 @@ + sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3) + sg_version=${sg_version##0.} + #echo "\"$sg_version\"" +- if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then +- sg_len_arg="-36" +- else ++ #if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then ++ #sg_len_arg="-36" ++ #else + sg_len_arg="--len=36" +- fi ++ #fi + else + echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils" + echo " or rescan-scsi-bus.sh might not fully work." |