summaryrefslogtreecommitdiffstats
path: root/initramfs
diff options
context:
space:
mode:
authorOliver Tappe2008-01-11 17:03:15 +0100
committerOliver Tappe2008-01-11 17:03:15 +0100
commit5a884d7cf51c20d79f9be88b93519e65b21cd41b (patch)
tree8e7afe3507e89660cee1088c7e562b829cd76a0f /initramfs
parent* added TODO about lacking performance of set...Attrs() (diff)
downloadcore-5a884d7cf51c20d79f9be88b93519e65b21cd41b.tar.gz
core-5a884d7cf51c20d79f9be88b93519e65b21cd41b.tar.xz
core-5a884d7cf51c20d79f9be88b93519e65b21cd41b.zip
* added hook mechanism to initramfs-init which can be used by plugins
to trigger execution of their own script at a certain point in the initramfs-init execution path. This is not active yet * added basic implementation outline for Theme (a.k.a splash) plugin - unable to test anything, though, as VMware does not seem to provide a VESA framebuffer, so splashy won't run git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1466 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rw-r--r--initramfs/initrd-stuff/etc/functions11
-rwxr-xr-xinitramfs/initrd-stuff/init22
2 files changed, 32 insertions, 1 deletions
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions
index e6c57d82..830e7008 100644
--- a/initramfs/initrd-stuff/etc/functions
+++ b/initramfs/initrd-stuff/etc/functions
@@ -553,6 +553,17 @@ fi
}
#############################################################################
+# execute all shell scripts in the given init-hook folder
+runinithook () {
+local hook=$1
+if [ -d /initramfs/init-hooks/$hook ]; then
+ for hook_script in /initramfs/init-hooks/$hook/*; do
+ . hook_script
+ done
+fi
+}
+
+#############################################################################
# localization simply derived from $language variable set in machine-setup or
# other sources - mostly taken from knoppix
localization () {
diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init
index f3d4ae7a..7cfba25b 100755
--- a/initramfs/initrd-stuff/init
+++ b/initramfs/initrd-stuff/init
@@ -12,8 +12,8 @@
#
# Main script for new type of initial ramdisk for OpenSLX linux stateless
# clients version 4
-
#############################################################################
+
# device files get their own filesystem (to be move mounted later)
devdir="/dev"
mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir}
@@ -94,6 +94,8 @@ nfsro="nfs"
# admin has to wait until second run of hwsetup late in stage3)
hwautocfg pre
+runinithook '00-started'
+
# run pre init script and user defined preinit.local, copied by mkdxsinitrd
# from /var/lib/openslx/config/... in stage2
preinit
@@ -277,6 +279,8 @@ $0\n# deprecated: please use rootfs=nfs://...\nnfsroot=\"${nfsroot}\"\n" \
esac
done
+runinithook '05-have-kernelvars'
+
# splashy stuff
[ ${nosplash} = 0 ] && /bin/splashy boot 2>/dev/null
@@ -417,6 +421,8 @@ sed "s,@@@serverip@@@,$serverip," -i /etc/machine-setup
# ... or via tftp file get (in background)
[ -n "$file" ] && fileget &
+runinithook '15-have-ip-config'
+
# if root filesystem should be imported via local or a network block device
if [ -n "${bldmod}" ] ; then
# load block device driver(s) if needed
@@ -591,6 +597,8 @@ if [ -z "${bldmod}" -a -z "${bldserver}" ] ; then
[ $DEBUGLEVEL -eq 20 ] && echo "** finished nfs mount at $(sysup)"
fi
+runinithook '20-have-network-root'
+
# get the complete collection of kernel modules available
mount -n --bind /mnt/lib/modules/${KERNEL} /lib/modules/${KERNEL} || \
error "$init_moddir"
@@ -605,6 +613,8 @@ $(sysup)"
hwautocfg main &
fi
+runinithook '25-started-hw-config'
+
union_type=""
# try to use unionfs for rw access if available
if [ -n "${unionfs}" ]; then
@@ -702,6 +712,8 @@ elif [ -z "${cowloop}" ] ; then
# run some specific stuff !?
fi
+runinithook '50-have-layered-fs'
+
# splashy stuff
[ ${nosplash} = 0 ] && /bin/splashy_update "progress 50" 2>/dev/null
@@ -758,6 +770,8 @@ else
error "$init_infldcfg" nonfatal
fi
+runinithook '60-have-servconfig'
+
# splashy stuff
[ ${nosplash} = 0 ] && /bin/splashy_update "progress 80" 2>/dev/null
@@ -798,6 +812,8 @@ if [ -n "$uniondirs" ]; then
include_in_fsroot_union "$union_type" "$uniondirs"
fi
+runinithook '70-before-plugins'
+
# check for any plugin-specific runlevel scripts and run them, if found:
if [ -d /initramfs/plugin-init.d ]; then
for plugin_starter in /initramfs/plugin-init.d/*; do
@@ -807,6 +823,8 @@ if [ -d /initramfs/plugin-init.d ]; then
done
fi
+runinithook '80-after-plugins'
+
# post init for some distro specific
postinit
[ -s /initramfs/postinit.local ] && {
@@ -855,6 +873,8 @@ unset client debug date initrd ip bldroot nfsroot rootfs ticks vci vga
unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \
SLXVERSION UDEVD_EXPECTED_SEQNUM PATH
+runinithook '99-handing-over'
+
# splashy stuff
[ ${nosplash} = 0 ] && /bin/splashy_update "progress 100" 2>/dev/null