summaryrefslogtreecommitdiffstats
path: root/initramfs/distro-specs/gentoo/functions-default
diff options
context:
space:
mode:
Diffstat (limited to 'initramfs/distro-specs/gentoo/functions-default')
-rw-r--r--initramfs/distro-specs/gentoo/functions-default321
1 files changed, 0 insertions, 321 deletions
diff --git a/initramfs/distro-specs/gentoo/functions-default b/initramfs/distro-specs/gentoo/functions-default
deleted file mode 100644
index 988e7412..00000000
--- a/initramfs/distro-specs/gentoo/functions-default
+++ /dev/null
@@ -1,321 +0,0 @@
-# Copyright (c) 2003 - 2006 - RZ Uni Freiburg
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
-#
-# This program/file is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your feedback to feedback@openslx.org
-#
-# General information about OpenSLX can be found under http://openslx.org
-#
-# Configuration script for Gentoo linux distribution to configure OpenSLX
-# linux diskless clients (executed within initialramfs after genconfig)
-
-# empty functions are defined at the beginning of /etc/functions
-
-# distro specific general function called from servconfig script
-config_distro () {
- echo -e "OpenSLX version ${SLXVERSION}\ninitramfs generation date $date" \
- >> /mnt/etc/gentoo-release
- echo -e "# changes made to this file by $0 (initramfs from $date)" \
- > /etc/rc.conf
- # keytable is set by hwautocfg script (added just for convenience here)
- config_rc_entry "KEYMAP" "${KEYTABLE}" "conf.d/keymaps"
- # fixme: check for strange udev rules which want to rename eth* names!
-}
-
-# linking runlevel scripts and defining execution order
-rllinker () {
-local script="$1"
-local after="$2"
-# empty runlevel links - decision on running certain services is
-# passed via configuration
-if strinstr "$script" "boot boot.slx ${D_INITSCRIPTS}" ; then
- ln -s /etc/${D_INITDIR}/$script /mnt/etc/runlevels/boot/$script
- echo $script >> /mnt/etc/runlevels/boot/.critical
-else
- ln -s /etc/${D_INITDIR}/$script /mnt/etc/runlevels/default/$script
- echo $script >> /mnt/etc/runlevels/default/.critical
-fi
-if [ -n "$after" ] ; then
- sedscript "$after"
- sed -f /tmp/sedscript -i /mnt/etc/${D_INITDIR}/$script
-else
- sed "/depend/,/}/d" -i /mnt/etc/${D_INITDIR}/$script
-fi
-}
-
-# sed script writer
-sedscript () {
-echo -e "/depend/,/}/{\n/^[[:space:]]/d\n/depend/i\\" >/tmp/sedscript
-echo -e "# modified within initial ramfs/stage3\n/depend/a\\" >>/tmp/sedscript
-echo -e "\tafter $1\n}" >> /tmp/sedscript
-}
-
-# setup initial boot scripts (rather strange concept I did not get
-# completely)
-initial_boot () {
-local scripts=$*
-local after=""
-local script
-d_mkrlscript init boot "Starting Gentoo base initialization"
-cat >>/mnt/etc/${D_INITDIR}/boot <<EOF
- #"Mounting /proc, /sys and /dev/pts filesystems"
- # file /etc/fstab in some scenarios not available
- mount -t proc proc /proc &>/dev/null
- if [ -d /sys ] ; then
- while read a b c ; do
- case "\$b" in
- sysfs)
- #echo -n "Mounting /sys filesystem"
- echo -e "sysfs\t\t/sys\t\tsysfs\t\trw\t\t 0 0\n" >>/etc/fstab
- mount -t sysfs sysfs /sys
- ret=0
- break
- ;;
- esac
- done < /proc/filesystems
- fi
- # Function try() needed by udev, since it's a critical task...
- # Originally from /sbin/rc gentoo-sysinit-script
- try() {
- local errstr
- local retval=0
-
- if [ -c /dev/null ]; then
- errstr="\$((eval \$*) 2>&1 >/dev/null)"
- else
- errstr="\$((eval \$*) 2>&1)"
- fi
- retval=\$?
- if [ "\${retval}" -ne 0 ]
- then
- splash "critical" &
-
- echo -e "\${ENDCOL}\${NORMAL}[\${BAD} oops \${NORMAL}]"
- echo
- eerror "The \"\${1}\" command failed with error:"
- echo
- echo "\${errstr#*: }"
- echo
- eerror "Since this is a critical task, startup cannot continue."
- echo
- /sbin/sulogin \${CONSOLE}
- einfo "Unmounting filesystems"
- if [ -c /dev/null ]; then
- /bin/mount -a -o remount,ro &>/dev/null
- else
- /bin/mount -a -o remount,ro
- fi
- einfo "Rebooting"
- /sbin/reboot -f
- fi
-
- return \${retval}
- }
- # Starting udev (normally handled by /sbin/rc sysinit)
- source "\${svclib}/addons/udev-start.sh"
- mount -t devpts -o mode=0620,gid=5 devpts /dev/pts
- rm -rf /dev/.rcsysinit
- #/bin/bash
- eend \${ret} "\${errstr}"
-EOF
-d_mkrlscript close boot
-for script in boot boot.slx $scripts ; do
- # to get a certain order of scripts the after token of depends () might be
- # used
- rllinker "$script" "$after"
- after=$script
-done
-# avoid the bullshit of "system initialization"
-sed -e "s/# System init.*//;s/si::.*//" -i /mnt/etc/inittab
-# initial script which is executed last
-lastinit="$after"
-}
-
-# initialize boot.slx - 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
-# initialize boot.slx - 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 (fixme!!)
-d_mkrlscript () {
-local switch="$1"
-local name="$2"
-local info="$3"
-case "$switch" in
- init)
- echo -e "#!/sbin/runscript\n# skeleton of /etc/${D_INITDIR}/$name \
-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 "\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 [ -e /mnt/etc/${D_INITDIR}/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" = "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/${D_INITDIR}/vixie-cron ] ; then
- :
- else
- error "$df_errcron" nonfatal
- fi
-fi
-}
-
-# syslog service
-config_syslog () {
-if [ "x$start_syslog" = "xyes" ] ; then
- if [ -f /mnt/etc/${D_INITDIR}/syslog-ng ] ; then
- rllinker syslog-ng
- else
- error "$df_errsysl" nonfatal
- fi
-fi
-}
-
-# secure shell service
-config_sshd () {
-if [ "x$start_sshd" = "xyes" ] ; then
- if [ -f /mnt/etc/${D_INITDIR}/sshd ] ; then
- rllinker "sshd"
- else
- error "$df_errsshd" nonfatal
- fi
-fi
-}
-
-# snmp agent for remote monitoring (unchecked)
-config_snmp () {
-if [ "x$start_snmp" = "xyes" ] ; then
- if [ -f /mnt/etc/${D_INITDIR}/snmpd ] ; then
- rllinker "snmpd"
- testmkd /mnt/var/lib/net-snmp >/dev/null 2>&1
- fi
- # fixme!!
- # write service monitor depending on services started
-fi
-}
-
-# change entries in rc.conf (mostly for convenience only)
-config_rc_entry () {
-local var=$1
-local value=$2
-local file=$3
-[ -z $file ] && file=rc.conf
-sed -e "s,$var=.*,$var=\"$value\"," -i /mnt/etc/${file}
-}
-
-# configure bluetooth services
-config_bt () {
-if [ -f /mnt/etc/init.d/bluetooth ] ; then
- rllinker "bluetooth"
-else
- error "" nonfatal
-fi
-}
-
-# set consolefont
-consolefont () {
-echo -e "\tsetfont ${CONSOLE_FONT} >${LOGFILE} 2>&1\n" \
- >>/mnt/etc/${D_INITDIR}/boot.slx
-config_rc_entry "CONSOLEFONT" "${CONSOLE_FONT}" "conf.d/consolefont"
-}
-
-# acpi and powersave
-config_acpi () {
-rllinker acpid
-}
-
-# configure automounter
-config_automount () {
-if [ -f /mnt/etc/${D_INITDIR}/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 "$df_erratpld" 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 "$df_erramnt" nonfatal
-fi
-}
-
-# start name service caching daemon (recommended in combination with
-# ldap source as user admin base)
-config_nscd () {
-if [ -f /mnt/etc/${D_INITDIR}/nscd ] ; then
- #testmkd /mnt/var/run/nscd
- rllinker "nscd"
-fi
-}
-
-# start portmapper (needed at least for nfs and nis services - unchecked)
-# gentoo: netmount???
-config_portmap () {
-rllinker "portmap"
-}
-
-# start NIS (fixmee: does the start script is really named ypbind?)
-config_nis () {
-rllinker "ypbind"
-}
-
-# Xorg variable settings. Lots of stuff changed for newer Xorg servers
-displayvars () {
-Files='\tModulePath\t"/etc/X11/modules"\n
-\tModulePath\t"/usr/lib/xorg/modules"\n
-\tRgbPath\t\t"/usr/share/X11/rgb"\n
-\tFontPath\t"/usr/share/fonts/TTF/"\n
-\tFontPath\t"/usr/share/fonts/OTF/"\n
-\tFontPath\t"/usr/share/fonts/Type1/"\n
-\tFontPath\t"/usr/share/fonts/CID/"\n
-\tFontPath\t"/usr/share/fonts/misc/"\n
-\tFontPath\t"/usr/share/fonts/75dpi/"\n
-\tFontPath\t"/usr/share/fonts/100dpi/"'
-InputDevice='\tIdentifier\t"Keyboard1"\n
-\tDriver\t\t"kbd"\n
-\tOption\t\t"XkbRules"\t\t"xorg"\n
-\tOption\t\t"XkbLayout"\t\t"XKEYBOARD"\n
-\tOption\t\t"XkbModel"\t\t"pc105"\n
-\tOption\t\t"XkbOptions"\t\t"lv3:ralt_switch"\n
-\tOption\t\t"XkbVariant"\t\t"nodeadkeys"'
-synapticsdrv="/usr/lib/xorg/modules/input/synaptics_drv.o"
-}