#!/bin/sh
|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: target/idunn/initramfs/etc_rc.d_rc.sysinit.sh
|
|
# Copyright (C) 2008 - 2009 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; version 2 of the License. A copy of the
|
|
# GNU General Public License can be found in the file COPYING.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
. /etc/rc.d/functions.in
|
|
|
|
banner "I am Idunn, take an apple and live forever."
|
|
|
|
# keep the console clean
|
|
if [ -x /bin/dmesg ]; then
|
|
dmesg -n 3
|
|
dmesg > /var/log/boot.log
|
|
fi
|
|
|
|
title "Mounting special filesystems"
|
|
check mount -n -t proc proc /proc
|
|
check mount -n -t sysfs sysfs /sys
|
|
check mount -n -t tmpfs tmp /tmp
|
|
status
|
|
|
|
# Parse command line
|
|
init=
|
|
root=
|
|
rootdelay=
|
|
root_mode=
|
|
|
|
for x in $(cat /proc/cmdline | tr -d ";\"'"); do
|
|
case "$x" in
|
|
ro|rw) root_mode=$x ;;
|
|
root=*|init=*|rootdelay=*)
|
|
eval "$x" ;;
|
|
esac
|
|
done
|
|
|
|
root_method=device
|
|
case "$root" in
|
|
nfs:*) root="${root#nfs:}"
|
|
root_method=nfs
|
|
;;
|
|
UUID=*|LABEL=*)
|
|
root_method=find
|
|
;;
|
|
/dev/*)
|
|
;;
|
|
*)
|
|
[ -z "$root" ] || root="/dev/$root"
|
|
;;
|
|
esac
|
|
|
|
cat > /etc/conf/idunn <<EOT
|
|
rootfs="/rootfs"
|
|
root="$root"
|
|
rootdelay="${rootdelay:-0}"
|
|
root_method="$root_method"
|
|
root_mode="${root_mode:-ro}"
|
|
init="${init:-/sbin/init}"
|
|
initopt="$*"
|
|
EOT
|
|
|
|
title "Preparing /dev"
|
|
check mount -n -t tmpfs udev /dev
|
|
check mkdir /dev/pts
|
|
check mount -n -t devpts devpts /dev/pts
|
|
check cp -a /lib/udev/devices/* /dev
|
|
status
|
|
|
|
title "Starting supervisor"
|
|
check start-stop-daemon -S -b -x /usr/bin/runsvdir -- /var/service/
|
|
status
|
|
|
|
# wait for udev
|
|
while [ ! -d /dev/.udev/ ]; do
|
|
sleep 1;
|
|
done
|
|
|
|
# load/blacklist modules
|
|
if [ -x /sbin/modprobe -a -n "$modules" ]; then
|
|
title "Preloading requested kernel modules"
|
|
for x in $(echo "$modules" | tr ':' ' '); do
|
|
if expr "$x" : - > /dev/null; then
|
|
echo "blacklist ${x#-}" >> /etc/modprobe.conf
|
|
else
|
|
check modprobe $(echo "$x" | tr ',' ' ')
|
|
fi
|
|
done
|
|
status
|
|
fi
|
|
|
|
force_shell=
|
|
use_lvm=
|
|
use_mdadm=
|
|
|
|
if [ -n "$idunn" ]; then
|
|
for x in $(echo "$idunn" | tr ':' ' '); do
|
|
case "$x" in
|
|
*=*) y="${x#*=}"
|
|
x="${x%%=*}"
|
|
;;
|
|
no*) x="${x#no}"
|
|
y="no"
|
|
;;
|
|
*) y="yes"
|
|
;;
|
|
esac
|
|
|
|
case "$x" in
|
|
shell) force_shell=$y ;;
|
|
lvm|mdadm) eval use_${x}=$y ;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
# assuming the network module is built-in or preloaded, start it earlier
|
|
for x in $(unet pending); do
|
|
title "Starting network (interface:$x)"
|
|
check unet $x up
|
|
status
|
|
done
|
|
|
|
title "Triggering coldplug"
|
|
check udevadm trigger
|
|
check udevadm settle
|
|
status
|
|
|
|
# and for those which appeared after udevtrigger
|
|
for x in $(unet pending); do
|
|
title "Starting network (interface:$x)"
|
|
check unet $x up
|
|
status
|
|
done
|
|
|
|
if [ "$use_mdadm" = "yes" ]; then
|
|
title "Detecting RAID volumes"
|
|
check mdadm -Esv > /etc/mdadm.conf
|
|
status
|
|
fi
|
|
|
|
if [ -s /etc/mdadm.conf ]; then
|
|
title "Starting RAID volumes"
|
|
check mdadm -As
|
|
sleep 1
|
|
status
|
|
fi
|
|
|
|
if [ "$use_lvm" = "yes" ]; then
|
|
title "Detecting LVM volumes"
|
|
check vgscan
|
|
status
|
|
fi
|
|
|
|
if [ -n "$(ls -1 /etc/lvm/archive/*.vg 2> /dev/null)" ]; then
|
|
title "Starting LVM volumes"
|
|
modprobe dm-mod
|
|
check vgchange -ay
|
|
status
|
|
fi
|