summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.d/autoconfig43
-rw-r--r--init.d/fixinittab37
-rw-r--r--init.d/gpm-pre33
-rw-r--r--init.d/hwsetup11
-rw-r--r--init.d/unmute2
-rw-r--r--livecd-functions.sh214
6 files changed, 35 insertions, 305 deletions
diff --git a/init.d/autoconfig b/init.d/autoconfig
index fd68011..1ea3335 100644
--- a/init.d/autoconfig
+++ b/init.d/autoconfig
@@ -86,6 +86,9 @@ get_config() {
nox)
X11="no"
;;
+ nogui)
+ X11="no"
+ ;;
acpi\=on|acpi\=force)
ACPI="yes"
APM="no"
@@ -228,12 +231,10 @@ list_services() {
svcs="${svcs} $(check_svc ${APM} apmd)"
svcs="${svcs} $(check_svc ${BRLTTY} brltty)"
svcs="${svcs} $(check_svc ${COLDPLUG} coldplug hotplug)"
- if yesno "$COLDPLUG" && ! rc-service -e coldplug && ! rc-service -e hotplug
+ if [ -c /dev/input/mice ]
then
- echo hwsetup
+ svcs="${svcs} $(check_svc ${GPM} gpm)"
fi
- svcs="${svcs} $(check_svc ${GPM} gpm-pre)"
- svcs="${svcs} $(check_svc ${GPM} gpm)"
svcs="${svcs} $(check_svc ${IDEDMA} hdparm)"
svcs="${svcs} $(check_svc ${NFS} nfsclient)"
svcs="${svcs} $(check_svc ${PASSWD} pwgen)"
@@ -393,7 +394,7 @@ start() {
echo "0" > /proc/sys/kernel/printk
get_config
- local numcpu="$(grep -c '^processor[[:space:]]\+:' /proc/cpuinfo)"
+ local numcpu="$(nproc)"
eindent
ebegin "Setting sane defaults in /etc/portage/make.conf"
if [ -f "/etc/portage/make.conf" ] && checkpath -W /etc/portage/make.conf; then
@@ -519,17 +520,6 @@ start() {
ewarn "Skipping DHCP broadcast ..."
fi
- # Read in what hwsetup has found
- [ -f /etc/sysconfig/gentoo ] && source /etc/sysconfig/gentoo
-
- # Mouse
- # FIXME: If MOUSE_DEVICE is empty, we actually do not want to do anything, not even start gpm.
- if [ -n "${MOUSE_DEVICE}" ]
- then
- :
- # Migrated to autoconfig-gpm-pre
- fi
-
if yesno "${DETECT}"
then
NETDEVICES="$(detect_netdevices)"
@@ -542,9 +532,9 @@ start() {
if yesno "${DHCP}"
then
einfo "DHCP broadcasting for IP on all detected interfaces ..."
- if [ -f /var/run/dhcpcd.pid ]
+ if [ -f /run/dhcpcd.pid ]
then
- kill $(cat /var/run/dhcpcd.pid)
+ kill $(cat /run/dhcpcd.pid)
sleep 2
fi
dhcpcd -n -h $(hostname)
@@ -568,24 +558,11 @@ start() {
ewarn "No Network device auto detected ..."
fi
- if yesno "${ALSA}"
+ if ! yesno "${ALSA}"
then
- if [ -n "${SOUND_FULLNAME}" -o -n "${SOUND_DRIVER}" ]
- then
- einfo "Soundcard: "
-
- [ -n "${SOUND_FULLNAME}" ] \
- && einfo " ${WARN}${SOUND_FULLNAME} "
- [ -n "${SOUND_DRIVER}" ] \
- && einfo " driver = ${SOUND_DRIVER}"
- fi
- else
- ewarn "Skipping ALSA detection as requested on command line ..."
+ ewarn "Skipping ALSA services as requested on command line ..."
fi
- [ -n "${XDESC}" ] && einfo "VideoCard: ${HILITE}${XDESC}${NORMAL}"
-
- killall hwsetup 2>/dev/null
echo "6" > /proc/sys/kernel/printk
if ! yesno "${X11}"
diff --git a/init.d/fixinittab b/init.d/fixinittab
index de3a12f..2b43021 100644
--- a/init.d/fixinittab
+++ b/init.d/fixinittab
@@ -12,12 +12,6 @@ start()
return 1
fi
- for x in ${CMDLINE} ; do
- case "${x}" in
- secureconsole) SECURECONSOLE="yes";;
- esac
- done
-
ebegin "Adjusting inittab"
# Create a backup
if [ ! -e /etc/inittab.old ]
@@ -29,9 +23,29 @@ start()
sed -i -e '/^c[0-9]/ s/^/#/' /etc/inittab
sed -i -e '/^s[01]/ s/^/#/' /etc/inittab
sed -i -e '/^b0/ s/^/#/' /etc/inittab
+ sed -i -e '/^f0/ s/^/#/' /etc/inittab
+
+ if [ -z "${LIVECD_CONSOLE}" ]
+ then
+ for c in hvc0 ttyHV0 ttyAMA0
+ do
+ if [ -c "/dev/${c}" ]
+ then
+ LIVECD_CONSOLE_BAUD=$(stty -F "/dev/${c}" speed)
+
+ eindent
+ ebegin "Adding ${c} console to inittab ..."
+ echo "s0:12345:respawn:/sbin/agetty -a root ${LIVECD_CONSOLE_BAUD} ${c}" >> /etc/inittab
+ eend $?
+ eoutdent
+
+ break
+ fi
+ done
+ fi
# SPARC & HPPA console magic
- if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" -o "${HOSTTYPE}" = "ppc64" ]
+ if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" ]
then
# Mount openprom tree for user debugging purposes
if [ "${HOSTTYPE}" = "sparc" ]
@@ -69,15 +83,6 @@ start()
done
fi
fi
- if [ -c "/dev/hvc0" ]
- then
- eindent
- ebegin "Adding hvc console to inittab ..."
- echo "s0:12345:respawn:/sbin/agetty -a root 9600 hvc0 vt320" >> /etc/inittab
- eend $?
- eoutdent
- fi
-
# The rest...
else
if [ "${LIVECD_CONSOLE}" = "tty0" -o "${LIVECD_CONSOLE}" = "" ]
diff --git a/init.d/gpm-pre b/init.d/gpm-pre
deleted file mode 100644
index a03e881..0000000
--- a/init.d/gpm-pre
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-depend() {
- before gpm
- need hwsetup
-}
-
-start() {
- [ -f /etc/sysconfig/gentoo ] && source /etc/sysconfig/gentoo
- [ -f /etc/sysconfig/mouse ] && source /etc/sysconfig/mouse
- if [ -z "${MOUSE_DEVICE}" ]; then
- ewarn "No mouse detected. GPM will not be started."
- return 0
- fi
- einfo "Mouse is ${HILITE}${MOUSE_FULLNAME}${NORMAL} at ${HILITE}${MOUSE_DEVICE}${NORMAL} ..."
-
- if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]; then
- sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
- else
- echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
- fi
-
- if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]; then
- sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
- else
- echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
- fi
-}
-
-# vim: ft=gentoo-init-d:
diff --git a/init.d/hwsetup b/init.d/hwsetup
deleted file mode 100644
index 16ee967..0000000
--- a/init.d/hwsetup
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-start() {
- ebegin "Starting hwsetup"
- [ -e /etc/sysconfig ] || mkdir -p /etc/sysconfig
- [ -x /usr/sbin/hwsetup ] && hwsetup
- eend $?
-}
diff --git a/init.d/unmute b/init.d/unmute
index e4892a8..6c588ff 100644
--- a/init.d/unmute
+++ b/init.d/unmute
@@ -9,7 +9,7 @@ start()
{
if [ -e /proc/asound/cards ]
then
- for i in $(cat /proc/asound/cards | awk '{print $1}' | grep ^[[:digit:]])
+ for i in $(grep -o '^\s\?[0-9]\+' /proc/asound/cards)
do
ebegin "Unmuting sound card $i"
if [ -d /proc/asound/card$i ] && [ -x /usr/bin/amixer ]
diff --git a/livecd-functions.sh b/livecd-functions.sh
index 1204835..899e8ab 100644
--- a/livecd-functions.sh
+++ b/livecd-functions.sh
@@ -18,223 +18,12 @@ livecd_parse_opt() {
esac
}
-livecd_check_root() {
- if [ "$(whoami)" != "root" ]
- then
- echo "ERROR: must be root to continue"
- return 1
- fi
-}
-
livecd_get_cmdline() {
echo "0" > /proc/sys/kernel/printk
CMDLINE=$(cat /proc/cmdline)
export CMDLINE
}
-no_gl() {
-# einfo "If you have a card that you know is supported by either the ATI or"
-# einfo "NVIDIA binary drivers, please file a bug with the output of lspci"
-# einfo "on http://bugs.gentoo.org so we can resolve this."
- GLTYPE=xorg-x11
-}
-
-ati_gl() {
- einfo "ATI card detected."
- if [ -e /usr/lib/xorg/modules/drivers/fglrx_drv.so ] \
- || [ -e /usr/lib/modules/drivers/fglrx_drv.so ]
- then
-# sed -i \
-# -e 's/ati/fglrx/' \
-# -e 's/radeon/fglrx/' \
-# -e 's/r300/fglrx/' \
-# /etc/X11/xorg.conf
- GLTYPE=ati
- else
- GLTYPE=xorg-x11
- fi
-}
-
-nv_gl() {
- einfo "NVIDIA card detected."
- if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
- || [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
- then
- GLTYPE=nvidia
- else
- GLTYPE=xorg-x11
- fi
-}
-
-nv_no_gl() {
- einfo "NVIDIA card detected."
- echo
- if [ -e /usr/lib/xorg/modules/drivers/nvidia_drv.so ] \
- || [ -e /usr/lib/modules/drivers/nvidia_drv.so ]
- then
- einfo "This card is not supported by the latest version of the NVIDIA"
- einfo "binary drivers. Switching to the X server's driver instead."
- fi
- GLTYPE=xorg-x11
- sed -i 's/nvidia/nv/' /etc/X11/xorg.conf
-}
-
-get_video_cards() {
- VIDEO_CARDS=$(lspci | grep ' VGA ')
- NUM_CARDS=$(echo ${VIDEO_CARDS} | wc -l)
- if [ ${NUM_CARDS} -eq 1 ]
- then
- NVIDIA=$(echo ${VIDEO_CARDS} | grep "nVidia Corporation")
- ATI=$(echo ${VIDEO_CARDS} | grep "ATI Technologies")
- if [ -n "${NVIDIA}" ]
- then
- NVIDIA_CARD=$(echo ${NVIDIA} | awk 'BEGIN {RS=" "} /(NV|nv|G|C)[0-9]+/ {print $1}' | cut -d. -f1 | sed 's/ //' | sed 's:[^0-9]::g')
- # NVIDIA Model reference:
- # http://en.wikipedia.org/wiki/Comparison_of_NVIDIA_Graphics_Processing_Units
- if [ -n "${NVIDIA_CARD}" ]
- then
- if [ $(echo ${NVIDIA_CARD} | cut -dV -f2) -ge 17 ]
- then
- nv_gl
- elif [ $(echo ${NVIDIA_CARD} | cut -dG -f2) -ge 70 ]
- then
- nv_gl
- elif [ $(echo ${NVIDIA_CARD} | cut -dV -f2) -eq 11 ]
- then
- nv_gl
- elif [ $(echo ${NVIDIA_CARD} | cut -dC -f2) -ge 50 ]
- then
- nv_gl
- else
- nv_no_gl
- fi
- else
- no_gl
- fi
- elif [ -n "${ATI}" ]
- then
- ATI_CARD=$(echo ${ATI} | awk 'BEGIN {RS=" "} /(R|RV|RS)[0-9]+/ {print $1}' | sed -e 's/[^0-9]//g')
- if [ $(echo ${ATI_CARD} | grep S) ]
- then
- ATI_CARD_S=$(echo ${ATI_CARD} | cut -dS -f2)
- elif [ $(echo ${ATI_CARD} | grep V) ]
- then
- ATI_CARD_V=$(echo ${ATI_CARD} | cut -dV -f2)
- else
- ATI_CARD=$(echo ${ATI_CARD} | cut -dR -f2)
- fi
- if [ -n "${ATI_CARD_S}" ] && [ ${ATI_CARD_S} -ge 350 ]
- then
- ati_gl
- elif [ -n "${ATI_CARD_V}" ] && [ ${ATI_CARD_V} -ge 250 ]
- then
- ati_gl
- elif [ -n "${ATI_CARD}" ] && [ ${ATI_CARD} -ge 200 ]
- then
- ati_gl
- else
- no_gl
- fi
- else
- no_gl
- fi
- fi
-}
-
-get_ifmac() {
- local iface=$1
-
- # Example: 00:01:6f:e1:7a:06
- cat /sys/class/net/${iface}/address
-}
-
-
-get_ifdriver() {
- local iface=$1
-
- # Example: ../../../bus/pci/drivers/forcedeth (wanted: forcedeth)
- local if_driver=$(readlink /sys/class/net/${iface}/device/driver)
- basename ${if_driver}
-}
-
-get_ifbus() {
- local iface=$1
-
- # Example: ../../../bus/pci (wanted: pci)
- # Example: ../../../../bus/pci (wanted: pci)
- # Example: ../../../../../../bus/usb (wanted: usb)
- local if_bus=$(readlink /sys/class/net/${iface}/device/bus)
- basename ${if_bus}
-}
-
-get_ifproduct() {
- local iface=$1
- local bus=$(get_ifbus ${iface})
- local if_pciaddr
- local if_devname
- local if_usbpath
- local if_usbmanufacturer
- local if_usbproduct
-
- if [[ ${bus} == "pci" ]]
- then
- # Example: ../../../devices/pci0000:00/0000:00:0a.0 (wanted: 0000:00:0a.0)
- # Example: ../../../devices/pci0000:00/0000:00:09.0/0000:01:07.0 (wanted: 0000:01:07.0)
- if_pciaddr=$(readlink /sys/class/net/${iface}/device)
- if_pciaddr=$(basename ${if_pciaddr})
-
- # Example: 00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)
- # (wanted: nVidia Corporation CK804 Ethernet Controller)
- if_devname=$(lspci -s ${if_pciaddr})
- if_devname=${if_devname#*: }
- if_devname=${if_devname%(rev *)}
- fi
-
- if [[ ${bus} == "usb" ]]
- then
- if_usbpath=$(readlink /sys/class/net/${iface}/device)
- if_usbpath=/sys/class/net/${iface}/$(dirname ${if_usbpath})
- if_usbmanufacturer=$(< ${if_usbpath}/manufacturer)
- if_usbproduct=$(< ${if_usbpath}/product)
-
- [[ -n ${if_usbmanufacturer} ]] && if_devname="${if_usbmanufacturer} "
- [[ -n ${if_usbproduct} ]] && if_devname="${if_devname}${if_usbproduct}"
- fi
-
- if [[ ${bus} == "ieee1394" ]]
- then
- if_devname="IEEE1394 (FireWire) Network Adapter";
- fi
-
- echo ${if_devname}
-}
-
-get_ifdesc() {
- local iface=$1
- desc=$(get_ifproduct ${iface})
- if [[ -n ${desc} ]]
- then
- echo $desc
- return;
- fi
-
- desc=$(get_ifdriver ${iface})
- if [[ -n ${desc} ]]
- then
- echo $desc
- return;
- fi
-
- desc=$(get_ifmac ${iface})
- if [[ -n ${desc} ]]
- then
- echo $desc
- return;
- fi
-
- echo "Unknown"
-}
-
livecd_console_settings() {
# scan for a valid baud rate
case "$1" in
@@ -346,6 +135,9 @@ livecd_read_commandline() {
fi
export LIVECD_CONSOLE
;;
+ secureconsole)
+ export SECURECONSOLE="yes"
+ ;;
esac
done
return 0