summaryrefslogtreecommitdiffstats
path: root/initramfs
diff options
context:
space:
mode:
authorOliver Tappe2007-05-06 00:43:26 +0200
committerOliver Tappe2007-05-06 00:43:26 +0200
commit2879d8906ed019d0e8f1c1ed108623a76d593380 (patch)
tree50620f0ace743d8a08d52a2cbcb76885b11f09c6 /initramfs
parent* fixed syntax problems (diff)
downloadcore-2879d8906ed019d0e8f1c1ed108623a76d593380.tar.gz
core-2879d8906ed019d0e8f1c1ed108623a76d593380.tar.xz
core-2879d8906ed019d0e8f1c1ed108623a76d593380.zip
* added option -S to mkdxsinitrd in order to pass in the system name
* replaced $DISTRO by $DISTRO_NAME and $DISTRO_VER * added $SYSTEM_NAME and used it at a couple of places where $DISTRO was used before * removed the two tries to fetch the config-tgz without any system name, as these are never generated by the demuxer anyway. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1007 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rwxr-xr-xinitramfs/initrd-stuff/bin/servconfig7
-rw-r--r--initramfs/initrd-stuff/etc/functions22
-rwxr-xr-xinitramfs/initrd-stuff/init20
-rwxr-xr-xinitramfs/mkdxsinitrd35
4 files changed, 49 insertions, 35 deletions
diff --git a/initramfs/initrd-stuff/bin/servconfig b/initramfs/initrd-stuff/bin/servconfig
index 42fb0f4a..4b9ee775 100755
--- a/initramfs/initrd-stuff/bin/servconfig
+++ b/initramfs/initrd-stuff/bin/servconfig
@@ -58,10 +58,9 @@ cfgcomplete
# ... in the near future ...
cp -a /rootfs/* /mnt 2>/dev/null
-# set greeting and add information on booted system (distro)
-distroname=${DISTRO%-*}
-len=$(expr length ${SLXVERSION}${distroname})
-vdstr="V${SLXVERSION}/${distroname})"
+# set greeting and add information on booted system
+len=$(expr length ${SLXVERSION}${SYSTEM_NAME})
+vdstr="V${SLXVERSION}/${SYSTEM_NAME})"
while [ $len -le 28 ] ; do
vdstr="$vdstr "
len=$(expr $len + 1)
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions
index fa10b8f9..b01884f4 100644
--- a/initramfs/initrd-stuff/etc/functions
+++ b/initramfs/initrd-stuff/etc/functions
@@ -63,7 +63,7 @@ trigger_device_events () {
}
#############################################################################
-# mini udev of busybox (most probably obsolete: or distro specific
+# mini udev of busybox (most probably obsolete: or distro specific
# udev_hotplug)
runudev () {
if [ -x /bin/mdev ] ; then
@@ -243,7 +243,7 @@ done
brctl addif ${bridge} ${pdev}
}
#############################################################################
-# replace @@@serverip@@@ with real serverip. Allows the usage of a variable
+# replace @@@serverip@@@ with real serverip. Allows the usage of a variable
# for the server ip address (e.g. in machine-setup or kernel commandline)
checkip ()
{
@@ -341,7 +341,7 @@ echo "dhcp finished at $(sysup)" > /tmp/dhcp-done
#############################################################################
# function for retrieving configuration file (machine-setup) via tftp from a
-# predefined server or given source (file=tftp-server:/path via kernel
+# predefined server or given source (file=tftp-server:/path via kernel
# command line)
# tftpget is helper function for fileget
tftpgetunpack () {
@@ -376,7 +376,7 @@ if [ -n "$filesrc" ] ; then
tftpgetunpack $tftp $cfgfile $tftpserver
else
# predefined value for openslx environment; it is expected that this
- # directory is just below the tftpboot/tftproot (path to which the
+ # directory is just below the tftpboot/tftproot (path to which the
# daemon is restricted to)
local cfgdir="client-config"
local tftpserver=$(checkip ${serverip})
@@ -385,8 +385,8 @@ else
echo -e "\n## Configuration via fileget: Hierarchy is distro client \
and as last\n# distro/default" >> /tmp/confviafile
mac=$(echo $macaddr|sed "s/:/-/g")
- for cfgfile in $cfgdir/$DISTRO/01-$mac.tgz $cfgdir/$DISTRO/default.tgz \
- $cfgdir/01-$mac.tgz $cfgdir/default.tgz ; do
+ for cfgfile in $cfgdir/$SYSTEM_NAME/01-$mac.tgz \
+ $cfgdir/$SYSTEM_NAME/default.tgz ; do
tftpgetunpack $cfgfile $tftpserver && break
done
fi
@@ -403,7 +403,7 @@ testmkd () {
}
#############################################################################
-# function for writing a syslog-ng.conf file. First parameter is absolute
+# function for writing a syslog-ng.conf file. First parameter is absolute
# destination (incl. /mnt prefix)
# sysngwriter $dest $start_syslog
sysngwriter () {
@@ -482,7 +482,7 @@ return 0
}
#############################################################################
-# ldconfig is needed if rootfilesystem is composed of several parts search
+# ldconfig is needed if rootfilesystem is composed of several parts search
# for ldconfig and execute it
# check that /mnt/etc/ld.so.conf is never lost
ldconfig () {
@@ -876,14 +876,14 @@ include_in_fsroot_union () {
if [ "X$union_type" == "XUnionFS" ]; then
[ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && echo "Using unionctl to mount ${root_path}_${union_id} (type: $union_type)"
unionctl /mnt/ --add --after 1 --mode ro /mnt/tmp/${root_path}_${union_id}
- elif [ "X$union_type" == "XAUFS" ]; then
+ elif [ "X$union_type" == "XAUFS" ]; then
#unionctl for aufs is a sh script needing tools not included in our initrd
[ "$DEBUGLEVEL" -gt 2 -a "$DEBUGLEVEL" != 8 ] && echo "Using aufs-mount to mount ${root_path}_${union_id} (type: $union_type)"
mount -n -o remount,add:1:/mnt/tmp/${root_path}_${union_id}=ro none /mnt
else
error $init_loadunions nonfatal
fi
- done
+ done
}
# kdmrc template started from distro specific functions files
@@ -1084,7 +1084,7 @@ config_samba () {
config_portmap () {
:
}
-# start nis/ypbind
+# start nis/ypbind
config_nis () {
:
}
diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init
index 9e829375..02dd457a 100755
--- a/initramfs/initrd-stuff/init
+++ b/initramfs/initrd-stuff/init
@@ -37,7 +37,9 @@ export date="${slxconf_date}"
export DEBUGLEVEL=0
export KERNEL="${slxconf_kernver}"
export NWMODULES="${slxconf_listnwmod}"
-export DISTRO="${slxconf_distro}"
+export DISTRO_NAME="${slxconf_distro_name}"
+export DISTRO_VER="${slxconf_distro_ver}"
+export SYSTEM_NAME="${slxconf_system_name}"
export SLXVERSION="${slxconf_slxver}"
# do not use dnbd cache file
@@ -480,9 +482,9 @@ fi
union_type=""
# try to use unionfs for rw access if available
-if [ -n "${unionfs}" ]; then
+if [ -n "${unionfs}" ]; then
modprobe ${MODPRV} unionfs && union_type="UnionFS"
- if [ -z "$union_type" ]; then
+ if [ -z "$union_type" ]; then
error "$init_loadufs" nonfatal
unset unionfs
# if unionfs is not available, check for aufs and inform user
@@ -490,9 +492,9 @@ if [ -n "${unionfs}" ]; then
fi
fi
# try to use aufs for rw access if available
-if [ -n "${aufs}" ]; then
+if [ -n "${aufs}" ]; then
modprobe ${MODPRV} aufs && union_type="AUFS"
- if [ -z "$union_type" ]; then
+ if [ -z "$union_type" ]; then
error "$init_loadaufs" nonfatal
unset aufs
# if aufs is not available, check for unionfs and inform user
@@ -509,13 +511,13 @@ if [ -n "${unionfs}" -o -n "${aufs}" ] ; then
if [ "$union_type" == "UnionFS" ]; then
mount -n -t unionfs -o dirs=${rwdir}/uniontmp:/rorootfs=${nfsro}ro \
none /mnt
- elif [ "$union_type" == "AUFS" ]; then
+ elif [ "$union_type" == "AUFS" ]; then
mount -n -t aufs -o br:/${rwdir}/uniontmp:/rorootfs=ro none /mnt
fi
mkdir -p /mnt/uniontmp
mount -n --move ${rwdir}/uniontmp /mnt/uniontmp
chmod 0755 /mnt/uniontmp /mnt
- # run ldconfig if switched on via kernel command line (token ldsc) or
+ # run ldconfig if switched on via kernel command line (token ldsc) or
# triggered by unionized root filesystem
ldcfg
# runlevel directories should contain no links
@@ -643,12 +645,12 @@ if [ -z "$uniondirs" ]; then
# does it contain "://"?
if [ "$aufs" != "${aufs#*://}" ]; then
uniondirs="$aufs"
- fi
+ fi
elif [ "$union_type" == "UnionFS" ]; then
# does it contain "://"?
if [ "$unionfs" != "${unionfs#*://}" ]; then
uniondirs="$unionfs"
- fi
+ fi
fi
fi
# if locations are given that should be unioned with the fs root, do it
diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd
index e00e158b..5e566a85 100755
--- a/initramfs/mkdxsinitrd
+++ b/initramfs/mkdxsinitrd
@@ -170,17 +170,20 @@ else
SLX_VERSION=$(slxversion)
fi
sed -e "s,@@@INSTDIR@@@,${INSTDIR},g;s,@@@KERNVER@@@,${KERNVER},g" \
- -e "s,@@@DISTRO@@@,${DISTRO}-${DISTRO_VER},g;s,@@@NETIF@@@,${NET_IF},g" \
+ -e "s,@@@DISTRO_NAME@@@,${DISTRO_NAME},g" \
+ -e "s,@@@DISTRO_VER@@@,${DISTRO_VER},g" \
+ -e "s,@@@NETIF@@@,${NET_IF},g" \
-e "s,@@@NWMODULES@@@,${NWMODULES},g" \
-e "s,@@@COMDIRINDXS@@@,${COMDIRINDXS},g" \
-e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \
-e "s,@@@DATE@@@,${DATE},g;/^#[^!].*/d" \
${SLX_SHARE_PATH}/initramfs/${FILENAME} >> ${INSTDIR}/${FILENAME}
# ugly hack for creating a general slx config file instead of "patching"
- # the stage3 init - fixme: version string should be added in a more clever way
+ # the stage3 init
echo -e "slxconf_date=${DATE}\nslxconf_kernver=${KERNVER}\n\
-slxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro=${DISTRO}-${DISTRO_VER}\n\
-slxconf_slxver=\"${SLX_VERSION}\"" > ${INSTDIR}/etc/sysconfig/slxsystem.conf
+slxconf_listnwmod=\"${NWMODULES}\"\nslxconf_distro_name=${DISTRO_NAME}\n\
+slxconf_distro_ver=${DISTRO_VER}\nslxconf_system_name=${SYSTEM_NAME}\n\
+slxconf_slxver=\"${SLX_VERSION}\"" \ > ${INSTDIR}/etc/sysconfig/slxsystem.conf
sed -e "s,^#!/bin/sh,#!/bin/ash," -i ${INSTDIR}/${FILENAME}
fi
fi
@@ -304,7 +307,7 @@ cp -a ${themes}* ${INSTDIR}/usr/share/themes
#########################################################################
# End of function declaration
-while getopts :dhk:c:i:r:o:s:f:n:m:Sut:I:a: a ; do
+while getopts :dhk:c:i:r:o:s:f:n:m:S:ut:I:a: a ; do
case $a in
\:|\?)
case $OPTARG in
@@ -317,6 +320,7 @@ while getopts :dhk:c:i:r:o:s:f:n:m:Sut:I:a: a ; do
r) echo "-r requires root dir parameter";;
s) echo "-s may require theme name";;
I) echo "-I requires network interface parameter";;
+ S) echo "-S requires the system name";;
V) echo "-V requires an executable to run inside linuxrc";;
*) echo "Unknown option: -$OPTARG"
echo "Try mkinitrd -h";;
@@ -332,6 +336,7 @@ while getopts :dhk:c:i:r:o:s:f:n:m:Sut:I:a: a ; do
m) MISCMODULES=$OPTARG ;;
r) ROOTDIR=$OPTARG;;
s) theme=$OPTARG;;
+ S) SYSTEM_NAME=$OPTARG;;
t) use_tpm=1;;
d) IRFSDEBUG=$OPTARG;;
l) local_init_script="$OPTARG";; # use for pre/postinit.local?
@@ -349,6 +354,14 @@ precheck
#Change to the directory this script is located in
goto_script_dir
+if [ -z "$ROOTDIR" ] ; then
+ echo "No ROOTDIR given - please use the -r flag! Exiting..."
+ exit 1
+fi
+if [ -z "$SYSTEM_NAME" ] ; then
+ echo "No system name given - please use the -S flag! Exiting..."
+ exit 1
+fi
# set temporary setup directory, clean it and setup basic directory
# structure
if [ -z "$INSTDIR" ] ; then
@@ -362,16 +375,16 @@ mkdir -p ${INSTDIR}/usr/share
# needed for KNOPPIX hwsetup tool not to be confused with ${D_SYSCONFDIR}
mkdir -p ${INSTDIR}/etc/sysconfig
-# set DISTRO & DISTRO_VER from ROOTDIR:
+# set DISTRO_NAME & DISTRO_VER from ROOTDIR:
VENDOR_OS=$(basename $ROOTDIR)
-DISTRO=${VENDOR_OS%%-*}
+DISTRO_NAME=${VENDOR_OS%%-*}
# select distro type
DISTRO_VER=${VENDOR_OS#*-}
# drop distro type, keep from version onwards
DISTRO_VER=${DISTRO_VER%%-*}
# remove any optional stuff after version
-copy_distro_stuff ${DISTRO} ${DISTRO_VER}
+copy_distro_stuff ${DISTRO_NAME} ${DISTRO_VER}
if [ -z "$NWMODULES" ] ; then
#NWMODULES="forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32 8139too 8139cp"
@@ -472,7 +485,7 @@ cobi cowdev bin &>/dev/null || \
# echo "Program iscsid not found; could be ignored ..."
# distro specific additional stuff
-case "${DISTRO}" in
+case "${DISTRO_NAME}" in
debian*)
cp ${ROOTDIR}/lib/libnss_compat.so.2 ${INSTDIR}/lib;;
esac
@@ -639,9 +652,9 @@ fi
# overwrites the system default one. postinit.local may be part of
# fileget tgz (in stage3)
for cfg in default/initramfs/preinit.local \
- ${DISTRO}-${DISTRO_VER}/initramfs/preinit.local \
+ ${SYSTEM_NAME}/initramfs/preinit.local \
default/initramfs/postinit.local \
- ${DISTRO}-${DISTRO_VER}/initramfs/postinit.local ; do
+ ${SYSTEM_NAME}/initramfs/postinit.local ; do
test -f ${SLX_PRIVATE_PATH}/config/$cfg && \
cp ${SLX_PRIVATE_PATH}/config/$cfg ${INSTDIR}/bin
done