if [ -r /etc/default/locale ] ; then
if grep -q "LANG=.*UTF" /etc/default/locale ; then
einfo "Setting up unicode environment."
- unicode_start 2>>$DEBUG ; eend $?
+ unicode_start >>$DEBUG 2>&1 ; eend $?
fi
fi
fi
# we have to set up all consoles, therefore loop it over all ttys:
- NUM_CONSOLES=$(fgconsole --next-available)
- NUM_CONSOLES=$(expr ${NUM_CONSOLES} - 1)
- [ ${NUM_CONSOLES} -eq 1 ] && NUM_CONSOLES=6
- CUR_CONSOLE=$(fgconsole)
-
+ NUM_CONSOLES=$(fgconsole --next-available 2>/dev/null)
+ if [ -n "$NUM_CONSOLES" ] ; then
+ NUM_CONSOLES=$(expr ${NUM_CONSOLES} - 1)
+ [ ${NUM_CONSOLES} -eq 1 ] && NUM_CONSOLES=6
+ fi
+ CUR_CONSOLE=$(fgconsole 2>/dev/null)
if [ -n "$CHARMAP" ] ; then
einfo "Running consolechars for ${CHARMAP}"
- for vc in `seq 0 ${NUM_CONSOLES}` ; do
+ RC=0
+ for vc in $(seq 0 ${NUM_CONSOLES}) ; do
consolechars --tty=/dev/tty${vc} -m ${CHARMAP} ; RC=$?
done
- [ -n "$CUR_CONSOLE" ] && chvt $CUR_CONSOLE
+ if [ -n "$CUR_CONSOLE" ] ; then
+ [ "$CUR_CONSOLE" != "serial" ] && chvt $CUR_CONSOLE
+ fi
eend $RC
fi
else
if [ -n "$CONSOLEFONT" ] ; then
einfo "Running consolechars using ${CONSOLEFONT}"
- for vc in `seq 0 ${NUM_CONSOLES}` ; do
+ RC=0
+ for vc in $(seq 0 ${NUM_CONSOLES}) ; do
consolechars --tty=/dev/tty${vc} -f $CONSOLEFONT ; RC=$?
done
- [ -n "$CUR_CONSOLE" ] && chvt $CUR_CONSOLE
- eend $?
+ if [ -n "$CUR_CONSOLE" ] ; then
+ [ "$CUR_CONSOLE" != "serial" ] && chvt $CUR_CONSOLE
+ fi
+ eend $RC
fi
fi
# activate serial console {{{
config_console(){
if checkbootparam 'console'; then
- einfo "Bootoption (for serial) console detected."
+ einfo "Bootoption for serial console detected:"
+
+ local serial="$(getbootparam console=ttyS)"
+ option="${serial##*,}"
+
+ # default to:
+ local speed="115200,57600,38400,19200,9600,4800,2400,1200";
+ # ... unless overriden by command line:
+ case "$option" in
+ 115200*) speed=115200 ;;
+ 57600*) speed=57600 ;;
+ 38400*) speed=38400 ;;
+ 19200*) speed=19200 ;;
+ 9600*) speed=9600 ;;
+ 4800*) speed=4800 ;;
+ 2400*) speed=2400 ;;
+ 1200*) speed=1200 ;;
+ esac
+
eindent
- if [ -r /etc/mgetty/mgetty.config ] ; then
- MODE=$(getbootparam 'console' | awk -F, '{print $2}')
- MODE=${MODE%%n*}
- [ -n "$MODE" ] || MODE=9600 # default mode
- einfo "Setting speed in /etc/mgetty/mgetty.config to $MODE bps"
- sed -i "s/speed [0-9]*/speed $MODE/" /etc/mgetty/mgetty.config ; eend $?
- fi
+ einfo "Setting baud rate to ${speed}."
+ sed -i "s/%serialspeed%/$speed/" /etc/inittab ; eend $?
- einfo "Activating mgetty."
- sed -i 's/^#T0/T0/' /etc/inittab
- sed -i 's/^#T1/T1/' /etc/inittab
- /sbin/telinit q ; eend $?
+ einfo "Activating console login."
+ sed -i 's/^#grmlserial#//' /etc/inittab ; eend $?
eoutdent
+
+ /sbin/telinit q
+ eend $?
fi
}
# }}}
einfo "Loading modules ${MODULE}"
modprobe "$MODULE" >>$DEBUG || modprobe "$MODULE_FALLBACK" >>$DEBUG
RC=$?
- if [[ $RC == 0 ]]; then
+ if [[ "$RC" == 0 ]]; then
eend 0
else
SKIP_CPU_GOVERNOR=1
if [ -z "$SKIP_CPU_GOVERNOR" ] ; then
einfo "Loading cpufreq_ondemand, setting ondemand governor"
+ RC=0
if modprobe cpufreq_ondemand ; RC=$? ; then
for file in $(find /sys/devices/system/cpu/ -name scaling_governor 2>/dev/null) ; do
echo ondemand > $file
else
einfo "Window manager ${WHITE}${WINDOWMANAGER}${NORMAL} found as bootoption." && eend 0
fi
- einfo "Changing to runlevel 5 for starting grml-x ${WINDOWMANAGER}. Just exit X windows system to get full featured consoles."
+ einfo "Setting up and invoking grml-x ${WINDOWMANAGER}. Just exit X windows system to get full featured consoles."
config_userfstab || fstabuser='grml'
cat>|/etc/init.d/xstartup<<EOF
#!/bin/sh
-# su - $fstabuser -c 'grml-x "$WINDOWMANAGER"'
-sudo -u $fstabuser -i /usr/bin/grml-x $WINDOWMANAGER >>$DEBUG
+su $fstabuser -c "/usr/bin/grml-x $WINDOWMANAGER"
EOF
chmod 755 /etc/init.d/xstartup
# adjust inittab for xstartup
if grep -q '^6:' /etc/inittab ; then
- sed -i 's|^6:.*|6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /bin/zsh"|' /etc/inittab
+ sed -i 's|^6:.*|6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /usr/bin/zsh-login" >/dev/tty6 2>\&1 </dev/tty6|' /etc/inittab
else # just append tty6 to inittab if no definition is present:
- echo '6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /bin/zsh"' >> /etc/inittab
+ echo '6:2345:respawn:/bin/zsh --login -c "/etc/init.d/xstartup ; /usr/bin/zsh-login" >/dev/tty6 2>&1 < /dev/tty6' >> /etc/inittab
fi
/sbin/telinit q ; eend $?