diff options
Diffstat (limited to 'init.d.Linux')
-rwxr-xr-x | init.d.Linux/clock | 55 | ||||
-rwxr-xr-x | init.d.Linux/consolefont | 51 | ||||
-rwxr-xr-x | init.d.Linux/keymaps | 18 | ||||
-rwxr-xr-x | init.d.Linux/numlock | 1 | ||||
-rw-r--r-- | init.d.Linux/procfs | 1 | ||||
-rw-r--r-- | init.d.Linux/sysctl | 1 |
6 files changed, 49 insertions, 78 deletions
diff --git a/init.d.Linux/clock b/init.d.Linux/clock index b8b17a97..4e9df321 100755 --- a/init.d.Linux/clock +++ b/init.d.Linux/clock @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved @@ -34,6 +33,15 @@ clock_adjfile=${clock_adjfile:-${CLOCK_ADJFILE}} clock_args=${clock_args:-${CLOCK_OPTS}} clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}} +clock=${clock:-${CLOCK:-UTC}} +if [ "${clock}" = "UTC" ]; then + utc="UTC" + utc_cmd="--utc" +else + utc="Local Time" + utc_cmd="--localtime" +fi + depend() { if yesno ${clock_adjfile}; then use checkroot @@ -46,49 +54,46 @@ setupopts() { utc= case "${RC_SYS}" in UML|VPS|XEN) - TBLURB="${RC_SYS}" + utc="${RC_SYS}" ;; *) case "$(uname -m)" in s390*) - TBLURB="s390" + utc="s390" ;; *) if [ -e /proc/devices ] && grep -q " cobd$" /proc/devices; then - TBLURB="coLinux" - elif [ "${CLOCK}" = "UTC" ]; then - utc="--utc" - TBLURB="UTC" - else - utc="--localtime" - TBLURB="Local Time" + utc="coLinux" fi ;; esac ;; esac - [ -n "${utc}" ] || return 0 + + case "${utc}" in + UTC|Local" "Time);; + *) unset utc_cmd;; + esac } start() { - local utc= TBLURB= errstr="" retval=0 - + local retval=0 errstr="" setupopts - ebegin "Setting system clock using the hardware clock [${TBLURB}]" - if [ -n "${utc}" ]; then + ebegin "Setting system clock using the hardware clock [${utc}]" + if [ -n "${utc_cmd}" ]; then if [ -e /proc/modules -a ! -e /dev/rtc ]; then modprobe -q rtc || modprobe -q genrtc fi # Since hwclock always exit's with a 0, need to check its output. if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then - errstr="$(hwclock --adjust ${utc} 2>&1 >/dev/null)" + errstr="$(hwclock --adjust ${utc_cmd} 2>&1 >/dev/null)" fi # If setting UTC, don't bother to run hwclock when first booting # as that's the default - if [ "${PREVLEVEL}" != "N" -o "${utc}" != "--utc" -o -n "${clock_args}" ]; then - errstr="${errstr}$(hwclock --hctosys ${utc} ${clock_args} 2>&1 >/dev/null)" + if [ "${PREVLEVEL}" != "N" -o "${utc_cmd}" != "--utc" -o -n "${clock_args}" ]; then + errstr="${errstr}$(hwclock --hctosys ${utc_cmd} ${clock_args} 2>&1 >/dev/null)" fi fi if [ -n "${errstr}" ]; then @@ -106,19 +111,18 @@ stop() { [ -n "${CDBOOT}" ] && return 0 yesno ${clock_systohc} || return 0 - local utc= TBLURB= errstr="" retval=0 - + local retval=0 errstr="" setupopts - ebegin "Setting hardware clock using the system clock" "[${TBLURB}]" - if [ -n "${utc}" ]; then + ebegin "Setting hardware clock using the system clock" "[${utc}]" + if [ -n "${utc_cmd}" ]; then if ! yesno "${clock_adjfile}"; then # Some implementations don't handle adjustments if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then - utc="${utc} --noadjfile" + utc_cmd="${utc_cmd} --noadjfile" fi fi - errstr="$(LC_ALL=C hwclock --systohc ${utc} ${clock_args} 2>&1 >/dev/null)" + errstr="$(LC_ALL=C hwclock --systohc ${utc_cmd} ${clock_args} 2>&1 >/dev/null)" fi if [ -n "${errstr}" ]; then ewarn "${errstr}" @@ -134,9 +138,8 @@ save() { } show() { - local utc= TBLURB= setupopts - /sbin/hwclock --show "${utc}" ${clock_args} + hwclock --show "${utc_cmd}" ${clock_args} } # vim: set ts=4 : diff --git a/init.d.Linux/consolefont b/init.d.Linux/consolefont index 1176584b..c1a4755a 100755 --- a/init.d.Linux/consolefont +++ b/init.d.Linux/consolefont @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved @@ -52,12 +51,12 @@ start() { fi if [ "${ttyn}" = 0 ]; then - ebegin "Skipping font setup (rc_tty_number == 0); you should disable this init.d" + ebegin "Skipping font setup (rc_tty_number == 0)" eend 0 return 0 fi - local x= param= sf_param= retval=1 + local x= param= sf_param= retval=1 ttydev= # Get additional parameters if [ -n "${consoletranslation}" ]; then @@ -68,40 +67,18 @@ start() { fi # Set the console font - local errmsg= ebegin "Setting user font" - if [ -x /bin/setfont ]; then - # We patched setfont to have --tty support ... - if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \ - [ -n "$(setfont --help 2>&1 | grep -e '-C')" ] - then - if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ]; then - sf_param="--tty=" - else - sf_param="-C " - fi - local ttydev= - [ -d /dev/vc ] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - - x=1 - while [ ${x} -le ${ttyn} ]; do - /bin/setfont ${consolefont} ${param} \ - ${sf_param}/${ttydev}${x} > /dev/null - retval=$? - x=$((${x} + 1)) - done - else - /bin/setfont ${consolefont} ${param} > /dev/null - retval=$? - fi - errmsg="Failed to set user font" - else - retval=1 - errmsg="/bin/setfont not found" - fi - eend ${retval} "${errmsg}" + [ -d /dev/vc ] \ + && ttydev=/dev/vc/ \ + || ttydev=/dev/tty + + x=1 + while [ ${x} -le ${ttyn} ]; do + setfont ${consolefont} ${param}-C ${ttydev}${x} >/dev/null + retval=$((${retval} + $?)) + x=$((${x} + 1)) + done + eend ${retval} # Store the last font so we can use it ASAP on boot if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then @@ -111,7 +88,7 @@ start() { cp "${font}" "${RC_LIBDIR}"/console echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font if yesno ${unicode:-${UNICODE}}; then - printf "" > "${RC_LIBDIR}"/console/unicode + cp /dev/null "${RC_LIBDIR}"/console/unicode else rm -f "${RC_LIBDIR}"/console/unicode fi diff --git a/init.d.Linux/keymaps b/init.d.Linux/keymaps index 2960fee7..014024b5 100755 --- a/init.d.Linux/keymaps +++ b/init.d.Linux/keymaps @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved @@ -74,18 +73,13 @@ start() { fi ebegin "Loading key mappings" - if [ -x /bin/loadkeys ]; then - yesno ${windowskeys} && wkeys="windowkeys" - loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} - eend $? "Error loading key mappings" + yesno ${windowskeys} && wkeys="windowkeys" + loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} + eend $? "Error loading key mappings" || return $? - if yesno ${fix_euro}; then - # Fix some fonts displaying the Euro, #173528. - echo "altgr keycode 18 = U+20AC" | loadkeys -q - fi - else - eend 1 "/bin/loadkeys not found" - return 1 + if yesno ${fix_euro}; then + # Fix some fonts displaying the Euro, #173528. + echo "altgr keycode 18 = U+20AC" | loadkeys -q fi # Set terminal encoding to either ASCII or UNICODE. diff --git a/init.d.Linux/numlock b/init.d.Linux/numlock index 672839b1..329153bd 100755 --- a/init.d.Linux/numlock +++ b/init.d.Linux/numlock @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved diff --git a/init.d.Linux/procfs b/init.d.Linux/procfs index 4a3778a3..85de863b 100644 --- a/init.d.Linux/procfs +++ b/init.d.Linux/procfs @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved diff --git a/init.d.Linux/sysctl b/init.d.Linux/sysctl index 9ee59ef7..2cac1019 100644 --- a/init.d.Linux/sysctl +++ b/init.d.Linux/sysctl @@ -1,5 +1,4 @@ #!/sbin/runscript -# Copyright 1999-2007 Gentoo Foundation # Copyright 2007 Roy Marples # All rights reserved |