summaryrefslogtreecommitdiffstats
path: root/initrd/distro-specs/gentoo/functions-2005.1
diff options
context:
space:
mode:
Diffstat (limited to 'initrd/distro-specs/gentoo/functions-2005.1')
-rw-r--r--initrd/distro-specs/gentoo/functions-2005.1216
1 files changed, 211 insertions, 5 deletions
diff --git a/initrd/distro-specs/gentoo/functions-2005.1 b/initrd/distro-specs/gentoo/functions-2005.1
index 7852853c..c28eccae 100644
--- a/initrd/distro-specs/gentoo/functions-2005.1
+++ b/initrd/distro-specs/gentoo/functions-2005.1
@@ -14,13 +14,18 @@ preinit () {
}
postinit () {
- :
+# rm -rf /mnt/etc/runlevels/default/*
+:
}
# distro specific general function called from servconfig script
config_distro () {
-echo -e "dxs version 4.0a\initramfs generation date $date" \
+echo -e "dxs version 4.0a\ninitramfs generation date $date" \
>> /mnt/etc/gentoo-release
+echo -e "# changes made to this file by $0 (initrd from $date)" \
+ > /etc/rc.conf
+# keytable is set by hwautocfg script (added just for convenience here)
+config_rc_entry "KEYMAP" "${KEYTABLE}"
}
# udev service - not checked!
@@ -37,6 +42,21 @@ apprear." nonfatal
fi
}
+# linking runlevel scripts
+rllinker () {
+local script="$1"
+local need="$2"
+# empty runlevel links - decision on running certain services is
+# passed via configuration
+ln -s /etc/init.d/$1 /mnt/etc/runlevels/default/$1
+echo $1 >> /mnt/etc/runlevels/default/.critical
+# hack to remove unneeded dependency stuff
+#if [ "$script" != "vmware-prep" ] ; then
+# sed "/depend/,/}/d" /mnt/etc/init.d/$1 > /etc/rls
+# cp /etc/rls /mnt/etc/init.d/$1
+#fi
+}
+
# initialize boot.ld - skript to be executed during early system startup
# (before most of the normal boot init scripts)
# this script should operate like a normal runlevel script
@@ -50,15 +70,201 @@ local info="$3"
case "$switch" in
init)
echo -e "#!/sbin/runskript\n# skeleton of /etc/${D_INITDIR}/$name \
-generated by $0" >/mnt/etc/${D_INITDIR}/$name
- echo -e "\n\nstart() {\tebegin \"$info\"" \
+generated by $0\ndepend() {\n\t:\n}" >/mnt/etc/${D_INITDIR}/$name
+ echo -e "\n\nstart() {\n\tebegin \"$info\"" \
>>/mnt/etc/${D_INITDIR}/$name
chmod u+x /mnt/etc/${D_INITDIR}/$name
;;
close)
- echo -e "\t;;\n stop)\n\t;;\nesac\nexit 0" \
+ echo -e "\n}\n\nstop() {\n\t:\n}\n# vim:ts=4" \
>>/mnt/etc/${D_INITDIR}/$name
;;
esac
}
+# group of functions for the normal runlevels
+# function for ntp configuration (unchecked)
+config_ntp () {
+if [ -f /mnt/etc/init.d/ntp ] ; then
+ if ! strinfile "ntp:" /mnt/etc/passwd ; then
+ echo -e "ntp:x:74:65534:NTP daemon:/var/lib/ntp:/bin/false" \
+ >>/mnt/etc/passwd
+ echo -e "ntp:!:13099:0:99999:7:::" >>/mnt/etc/shadow
+ fi
+ testmkd /mnt/var/lib/ntp/var/run/ntp &>/dev/null
+ if [ "x$start_ntp" = "xinitial" ] ; then
+ echo -e "\t# entries added by $0 (InitRamFS from $date)\n\
+\t( ntpdate -s -b $ntp_servers >${LOGFILE} 2>&1 && {\n\t which \
+hwclock &>/dev/null && hwclock -w;} ) &" \
+ >>/mnt/etc/${D_INITDIR}/boot.ld
+ elif [ "x$start_ntp" = "xyes" ] ; then
+ rllinker "ntp"
+ fi
+fi
+}
+
+# function for atd (unchecked)
+config_atd () {
+if [ "x$start_atd" = "xyes" ]; then
+ rllinker "atd"
+fi
+}
+
+# cron service
+config_cron () {
+if [ "x$start_cron" = "xyes" ] ; then
+ if [ -f /mnt/etc/init.d/cron ] ; then
+ :
+ else
+ error " The cron start script seems not to be installed, so requesting \
+\n the start of cron services make no sense." nonfatal
+ fi
+fi
+}
+
+# syslog service
+config_syslog () {
+if [ "x$start_syslog" = "xyes" ] ; then
+ if [ -f /mnt/etc/init.d/syslog-ng ] ; then
+ rllinker syslog-ng
+ else
+ error " The syslog start script does not seem to be installed, so \
+requesting\n the start of service does not make much sense." nonfatal
+ fi
+fi
+}
+
+# secure shell service
+config_sshd () {
+if [ "x$start_sshd" = "xyes" ] ; then
+ if [ -f /mnt/etc/init.d/sshd ] ; then
+ rllinker "sshd"
+ else
+ error " The sshd start script does not seem to be installed, so \
+requesting\n the start of service does not make much sense." nonfatal
+ fi
+fi
+}
+
+# snmp agent for remote monitoring (unchecked)
+config_snmp () {
+if [ "x$start_snmp" = "xyes" ] ; then
+ if [ -f /mnt/etc/init.d/snmpd ] ; then
+ rllinker "snmpd"
+ testmkd /mnt/var/lib/net-snmp >/dev/null 2>&1
+ fi
+ # fixme!!
+ # write service monitor depending on services started
+ fi
+}
+
+# configure X display manager (runlevel links and kind of manager)
+config_xdm () {
+if [ -f /mnt/etc/init.d/xdm ] ; then
+ sed -e "s,DISPLAYMANAGER=.*,DISPLAYMANAGER=\"xdm\"," /mnt/etc/rc.conf \
+ > /etc/rc.conf
+ cp /etc/rc.conf /mnt/etc/rc.conf
+ ln -s /etc/init.d/xdm /mnt/etc/runlevels/boot/xdm
+ ln -s /etc/init.d/xdm /mnt/etc/runlevels/default/xdm
+ echo "xdm" >> /mnt/etc/runlevels/boot/.critical
+fi
+}
+
+# change entries in rc.conf (most for convenience only)
+config_rc_entry () {
+local var=$1
+local value=$2
+sed -e "s,$var=.*,$var=\"$value\"," /mnt/etc/rc.conf \
+ > /etc/rc.conf
+cp /etc/rc.conf /mnt/etc/rc.conf
+}
+
+# configure gdm
+config_gdm () {
+config_rc_entry "DISPLAYMANAGER" "gdm"
+# fixmee!! check for needed directories and permissions
+#testmkd /mnt/var/lib/gdm
+#testmkd /mnt/var/log/gdm
+#strinfile "gdm:" /mnt/etc/passwd || echo "gdm:x:50:15:Gnome Display Manager \
+#Daemon:/var/lib/gdm:/bin/false" >>/mnt/etc/passwd
+# hack - gdm should be user 50 and shadow group 15
+#chown 50:15 /mnt/var/lib/gdm /mnt/var/log/gdm
+#chmod 0750 /mnt/var/lib/gdm /mnt/var/log/gdm
+#rllinker "gdm" ??
+}
+
+# configure kdm as display manager
+config_kdm () {
+config_rc_entry "DISPLAYMANAGER" "kdm"
+}
+
+# configure bluetooth services
+config_bt () {
+rllinker "bluetooth"
+}
+
+# set consolefont
+consolefont () {
+echo -e "\tsetfont ${CONSOLE_FONT} >${LOGFILE} 2>&1\n" \
+ >>/mnt/etc/${D_INITDIR}/boot.ld
+config_rc_entry "CONSOLEFONT" "${CONSOLE_FONT}"
+}
+
+# acpi and powersave
+config_acpi () {
+rllinker acpid
+# remove dependencies (runs unneeded services ...)
+sed "/depend/,/}/d" /mnt/etc/init.d/acpid > /etc/rls
+cp /etc/rls /mnt/etc/init.d/acpid
+}
+
+# configure dbus (inter application communication for kde and gnome), hal
+# (hardware abstraction layer - used e.g. by powersaved) and resmgr
+# (resource manager - the user gets permissions to devices when loggin on)
+config_dreshal () {
+ :
+}
+
+# configure automounter
+config_automount () {
+if [ -f /mnt/etc/init.d/autofs ] ; then
+ rllinker autofs
+ if [ -n "${automnt_src}" ] ; then
+ # local directory and home directory server from machine-setup
+ [ -z "${automnt_dir}" ] && automnt_dir="/home"
+ strinstr "/" "${automnt_dir}" && error " Only toplevel directories \
+are allowed as mount points for user home\n directories. Please set the \
+variable \${automnt_dir} appropriately in\n machine-setup file." nonfatal
+ automnt_dir=${automnt_dir#/}
+ echo -e "/home\t/etc/auto.${automnt_dir}\n" >> /mnt/etc/auto.master
+ echo -e "# /etc/auto.${automnt_dir} created by $0:\n" \
+ > /mnt/etc/auto.${automnt_dir}
+ echo -e "*\t-rsize=32768,wsize=32768,rw\t${automnt_src}/&" \
+ >> /mnt/etc/auto.${automnt_dir}
+ config_portmap
+ fi
+else
+ error " Automounter seems not to be installed" nonfatal
+fi
+}
+
+# start name service caching daemon (recommended in combination with
+# ldap source as user admin base)
+config_nscd () {
+if [ -f /mnt/etc/init.d/nscd ] ; then
+ #testmkd /mnt/var/run/nscd
+ rllinker "nscd"
+fi
+}
+
+# start portmapper (needed at least for nfs and nis services - unchecked)
+config_portmap () {
+rllinker "portmap"
+}
+
+# start vmware and vmware preparation services
+config_vmware () {
+rllinker "vmware-prep"
+rllinker "vmware"
+}
+