Quote (winux @ Jan. 08 2006,15:58) |
Your point 1: I presume this is only for DSL because I've nothing in Ubuntu under opt, even w/ hidden files display |
Quote (mikshaw @ Jan. 08 2006,17:22) |
It is only for DSL. /opt/bootlocal.sh in DSL is equivalent to the local boot script found in /etc/init.d or /etc/rc.d in other systems. It might be named boot.local or rc.local, or maybe something else. |
Code Sample |
#!/bin/sh # # This is the boot script for the `console-tools' package. # # It loads parameters from /etc/console-tools/config, maybe loads # default screen-font, screen font-map, and application charset-map, # and maybe start "vcstime" # # (c) 1997 Yann Dirson # check if usplash is runing and skip this, we'll get run again later if pidof usplash > /dev/null; then exit 0 fi if [ -r /etc/console-tools/config ]; then . /etc/console-tools/config fi if [ -d /etc/console-tools/config.d ]; then for i in /etc/console-tools/config.d/*; do . $i done fi . /lib/lsb/init-functions PATH=/sbin:/bin:/usr/sbin:/usr/bin SETFONT="/usr/bin/consolechars" SETFONT_OPT="" CHARSET="/usr/bin/charset" VCSTIME="/usr/sbin/vcstime" # Different device name for 2.6 kernels and devfs if [ `uname -r | cut -f 2 -d .` = 6 ] && [ -e /dev/.devfsd ]; then VCSTIME_OPT="-2 /dev/vcsa0" else VCSTIME_OPT="" fi # be sure the main program is installed [ -x "${SETFONT}" ] || exit 0 # set DEVICE_PREFIX depending on devfs/udev if [ -d /dev/vc ]; then DEVICE_PREFIX="/dev/vc/" else DEVICE_PREFIX="/dev/tty" fi reset_vga_palette () { if [ -f /proc/fb ]; then # They have a framebuffer device. # That means we have work to do... echo -n "]R" fi } setup () { VT="no" # If we can't access the console, quit CONSOLE_TYPE=`fgconsole 2>/dev/null` || exit 0 if [ ! $CONSOLE_TYPE = "serial" ] ; then readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console if [ $? -eq 0 ]; then VT="yes" reset_vga_palette fi fi [ $VT = "no" ] && exit 0 # start vcstime if [ "${DO_VCSTIME}" = "yes" -a -x ${VCSTIME} ]; then log_begin_msg "Starting clock on text console: `basename ${VCSTIME}`" ${VCSTIME} ${VCSTIME_OPT} & log_end_msg $? fi # Global default font+sfm if [ "${SCREEN_FONT}" ] then log_begin_msg "Setting up general console font..." SCREEN_FONT="-f ${SCREEN_FONT}" # maybe use an external SFM [ "${SCREEN_FONT_MAP}" ] && SCREEN_FONT_MAP="-u ${SCREEN_FONT_MAP}" # Set for the first 6 VCs (as they are allocated in /etc/inittab) if [ -n "$previous" ] && [ -n "$runlevel" ] || [ "$runlevel" = "S" ]; then # We're being run from within init, so our VCs may not exist yet NUM_CONSOLES=`grep '^[1-9]' /etc/inittab | cut -d ':' -f 1 | sort -n | tail -n 1` else NUM_CONSOLES=`fgconsole --next-available` NUM_CONSOLES=`expr ${NUM_CONSOLES} - 1` fi for vc in `seq 0 ${NUM_CONSOLES}` do ${SETFONT} --tty=${DEVICE_PREFIX}$vc ${SETFONT_OPT} ${SCREEN_FONT} ${SCREEN_FONT_MAP} || { log_end_msg 1; break; } if [ "$vc" -eq 6 ]; then log_end_msg 0; fi done fi # Per-VC font+sfm PERVC_FONTS="`set | grep "^SCREEN_FONT_vc[0-9]*=" | tr -d \' `" if [ "${PERVC_FONTS}" ] then log_begin_msg "Setting up per-VC fonts..." for font in ${PERVC_FONTS} do # extract VC and FONTNAME info from variable setting vc=`echo $font | cut -b15- | cut -d= -f1` eval font=\$SCREEN_FONT_vc$vc if [ X"$QUIET_PERVC" != X1 ]; then log_success_msg "${DEVICE_PREFIX}${vc}" fi # eventually find an associated SFM eval sfm=\${SCREEN_FONT_MAP_vc${vc}} [ "$sfm" ] && sfm="-u $sfm" ${SETFONT} --tty=${DEVICE_PREFIX}$vc ${SETFONT_OPT} -f $font $sfm done log_end_msg $? fi # Global ACM [ "${APP_CHARSET_MAP}" ] && ${CHARSET} G0 ${APP_CHARSET_MAP} # Per-VC ACMs PERVC_ACMS="`set | grep "^APP_CHARSET_MAP_vc[0-9]*=" | tr -d \' `" if [ "${PERVC_ACMS}" ] then log_begin_msg "Setting up per-VC ACM's..." for acm in ${PERVC_ACMS} do # extract VC and FONTNAME info from variable setting vc=`echo $acm | cut -b19- | cut -d= -f1` eval acm=\$APP_CHARSET_MAP_vc$vc if [ X"$QUIET_PERVC" != X1 ]; then log_success_msg "${DEVICE_PREFIX}${vc} ($acm)" fi eval "${CHARSET} --tty='${DEVICE_PREFIX}$vc' G0 '$acm'" done log_end_msg $? fi # Go to UTF-8 mode as necessary # if [ -f /etc/environment ] then for var in LANG LC_ALL LC_CTYPE; do value=$(egrep "^[^#]*${var}=" /etc/environment | tail -n1 | cut -d= -f2) eval $var=$value done fi CHARMAP=`LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap` if test "$CHARMAP" = "UTF-8" then /usr/bin/unicode_start 2> /dev/null || true else /usr/bin/unicode_stop 2> /dev/null|| true fi # screensaver stuff setterm_args="" if [ "$BLANK_TIME" ]; then setterm_args="$setterm_args -blank $BLANK_TIME" fi if [ "$BLANK_DPMS" ]; then setterm_args="$setterm_args -powersave $BLANK_DPMS" fi if [ "$POWERDOWN_TIME" ]; then setterm_args="$setterm_args -powerdown $POWERDOWN_TIME" fi if [ "$setterm_args" ]; then setterm $setterm_args fi # Keyboard rate and delay KBDRATE_ARGS="" if [ -n "$KEYBOARD_RATE" ]; then KBDRATE_ARGS="-r $KEYBOARD_RATE" fi if [ -n "$KEYBOARD_DELAY" ]; then KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY" fi if [ -n "$KBDRATE_ARGS" ]; then log_begin_msg "Setting keyboard rate and delay: " kbdrate -s $KBDRATE_ARGS log_end_msg $? fi # Inform gpm if present, of potential changes. if [ -f /var/run/gpm.pid ]; then kill -WINCH `cat /var/run/gpm.pid` 2> /dev/null fi # Allow user to remap keys on the console if [ -r /etc/console-tools/remap ] then dumpkeys < ${DEVICE_PREFIX}1 |sed -f /etc/console-tools/remap |loadkeys --quiet fi # Set LEDS here if [ "$LEDS" != "" ] then for i in `seq 1 12` do setleds -D $LEDS < $DEVICE_PREFIX$i done fi } case "$1" in start|reload|restart|force-reload) setup ;; stop) ;; *) setup ;; esac |
Code Sample |
#!/bin/sh . /lib/lsb/init-functions # # Load the keymaps *as soon as possible* # # Don't fail on error CONSOLE_TYPE=`fgconsole 2>/dev/null` || CONSOLE_TYPE="unknown" # Don't fail on serial consoles # fail silently if loadkeys not present (yet). command -v loadkeys >/dev/null 2>&1 || exit 0 CONFDIR=/etc/console CONFFILEROOT=boottime EXT=kmap CONFFILE=${CONFDIR}/${CONFFILEROOT}.${EXT}.gz reset_kernel() { # On Mac PPC machines, we may need to set kernel vars first # We need to mount /proc to do that; not optimal, as its going to # be mounted in S10checkroot, but we need it set up before sulogin # may be run in checkroot, which will need the keyboard to log in... [ -x /sbin/sysctl ] || return [ -r /etc/sysctl.conf ] || return grep -v '^\#' /etc/sysctl.conf | grep -q keycodes if [ "$?" = "0" ]; then grep keycodes /etc/sysctl.conf | grep -v "^#" | while read d; do /sbin/sysctl -w $d 2> /dev/null || true done fi } unicode_start_stop() { # Switch unicode mode by checking the locale. # This will be needed before loading the keymap. [ -x /usr/bin/unicode_start ] || return [ -x /usr/bin/unicode_stop ] || return [ -r /etc/environment ] || return for var in LANG LC_ALL LC_CTYPE; do value=$(egrep "^[^#]*${var}=" /etc/environment | tail -n1 | cut -d= -f2) eval $var=$value done CHARMAP=`LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap` if [ "$CHARMAP" = "UTF-8" ]; then /usr/bin/unicode_start 2> /dev/null || true else /usr/bin/unicode_stop 2> /dev/null || true fi } case "$1" in start | restart | force-reload | reload) # First mount /proc if necessary. unmount_proc="no" if [ ! -x /proc/1 ]; then unmount_proc="yes" mount -n /proc fi # Set kernel variables if required reset_kernel if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then linux_keycodes=`cat /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes` else linux_keycodes=1; fi # load new map if [ $linux_keycodes -gt 0 ]; then if [ -r ${CONFFILE} ]; then # Switch console mode to UTF-8 or ASCII as necessary unicode_start_stop if [ $CONSOLE_TYPE = "serial" ]; then loadkeys -q ${CONFFILE} 2>&1 > /dev/null else loadkeys -q ${CONFFILE} fi if [ $? -gt 0 ] then # if we've a serial console, we may not have a keyboard, so don't # complain if we fail. [ $CONSOLE_TYPE = "serial" ] && exit 0 log_warning_msg "Problem when loading ${CONFDIR}/${CONFFILEROOT}.${EXT}.gz, use install-keymap" sleep 10 fi fi fi # unmount /proc if we mounted it [ "$unmount_proc" = "no" ] || umount -n /proc ;; stop) # # ensure the saved kernel keymap is removed before halt/reboot # rm -f ${KERNEL_KEYMAP} ;; *) log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload}" exit 1 ;; esac |
Quote (spock @ Jan. 09 2006,12:20) |
Hello winux, I'm also discovering DSL, and it appears that ... I hope this helps, Thierry |