# HG changeset patch # User Christophe Lincoln # Date 1305498736 -7200 # Node ID a0f7424e5486826d3222c60995423034144c0a4e # Parent 1cb12350353b1d1f68418a08540374e7e98d21a6 Improve, fixes, big changes, 2 scripts less, one new system.sh, GUI config in live tha work with latest cookutils packages, well tested on Qemu, frugal, first HD install boot diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/bootopts.sh --- a/etc/init.d/bootopts.sh Sat Apr 30 21:10:06 2011 +0000 +++ b/etc/init.d/bootopts.sh Mon May 16 00:32:16 2011 +0200 @@ -13,6 +13,38 @@ EOT } +# Default user account without password (uid=1000). In live mode the option +# user=name can be used, but user must be added before home= to have home dir. +# This option is not handled by a loop and case like others and has no +# effect on an installed system. +if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then + if grep -q "user=" /proc/cmdline; then + USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'` + # Avoid usage of an existing system user or root. + if grep -q ^$USER /etc/passwd; then + USER=tux + fi + else + USER=tux + fi + echo -n "Configuring user and group: $USER..." + adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER + passwd -d $USER >/dev/null + status + # Audio and cdrom group. + addgroup $USER audio + addgroup $USER cdrom + addgroup $USER video + addgroup $USER tty + # make user be only read/write by user + chmod -R 700 /home/$USER + # Slim default user. + if [ -f /etc/slim.conf ]; then + sed -i s/"default_user .*"/"default_user $USER"/\ + /etc/slim.conf + fi +fi + # Parse /proc/cmdline for boot options. echo "Parsing kernel cmdline for SliTaz live options... " @@ -22,6 +54,86 @@ eject) # Eject cdrom. eject /dev/cdrom ;; + autologin) + # Autologin option to skip first graphic login prompt. + echo "auto_login yes" >> /etc/slim.conf ;; + lang=*) + # Check for a specified locale (lang=*). + LANG=${opt#lang=} + echo -n "Setting system locale to: $LANG... " + echo "LANG=$LANG" > /etc/locale.conf + echo "LC_ALL=$LANG" >> /etc/locale.conf + [ ! -d /usr/lib/locale/$LANG ] && localedef \ + -i $LANG -c -f UTF-8 /usr/lib/locale/$LANG & + tazlocale link-files + status ;; + kmap=*) + # Check for a specified keymap (kmap=*). + KEYMAP=${opt#kmap=} + echo -n "Setting system keymap to: $KEYMAP..." + echo "$KEYMAP" > /etc/keymap.conf + status ;; + home=*) + # Check for a specified home partition (home=*) and check for + # user home dir. Note: home=usb is a shorter and easier way to + # have home=/dev/sda1. + DEVICE=${opt#home=} + [ "$DEVICE" = "usb" ] && DEVICE=sda1 + echo "Home has been specified to $DEVICE..." + DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` + if [ -z "$DEVID" ]; then + USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use` + USBDELAY=$((2+$USBDELAY)) + echo "Sleeping $USBDELAY s to let the kernel detect the device... " + sleep $USBDELAY + fi + USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'` + DEVID=$DEVICE + if [ -x /sbin/blkid ]; then + # Can be a label, uuid, type or devname. DEVID gives us first: /dev/name. + DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` + fi + DEVID=${DEVID##*/} + if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then + echo "Mounting /home on /dev/$DEVID... " + [ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files + mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \ + || mount /dev/$DEVID /home + # Check if swap file must be generated in /home: swap=size (Mb). + # This option is only used within home=device. + if grep -q "swap=[1-9]*" /proc/cmdline; then + SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline` + # DD to gen a virtual disk. + echo "Generating swap file: /home/swap ($SWAP_SIZE)..." + dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE + # Make the Linux swap filesystem. + mkswap /home/swap + add_swap_in_fstab /home/swap + fi + else + echo "Unable to find $DEVICE... " + fi + # Move all user dir if needed. + if [ ! -d "/home/$USER" ] ; then + mv /tmp/$USER-files /home/$USER + chown -R $USER.users /home/$USER + else + rm -rf /tmp/$USER-files + fi + # Install all packages in /home/boot/packages. In live CD and + # USB mode the option home= mounts the device on /home, so we + # already have a boot directory with the Kernel and rootfs. + if [ -d "/home/boot/packages" ]; then + for pkg in /home/boot/packages/*.tazpkg + do + tazpkg install $pkg + done + fi + # We can have custom files in /home/boot/rootfs to overwrite + # the one packed into the Live system. + if [ -d "/home/boot/rootfs" ]; then + cp -a /home/boot/rootfs/* / + fi ;; laptop) # Laptop option to load related Kernel modules. echo "Loading laptop modules: ac, battery, fan, yenta_socket..." @@ -62,11 +174,29 @@ status /packages/install.sh fi ;; + wm=*) + # Check for a Window Manager (for a flavor, default WM can be changed + # with boot options or with an addfile in /etc/X11/wm.default. + WM=${opt#wm=} + mkdir -p /etc/X11 + case $WM in + jwm) + echo "jwm" > /etc/X11/wm.default ;; + ob|openbox|openbox-session) + echo "openbox" > /etc/X11/wm.default ;; + e17|enlightenment|enlightenment_start) + echo "enlightenment" > /etc/X11/wm.default ;; + esac ;; *) continue ;; esac done +# If no default WM fallback to Openbox (we never know). +if [ ! -f /etc/X11/wm.default ]; then + echo "openbox" > /etc/X11/wm.default +fi + # Activate an eventual swap file or partition. if [ "`fdisk -l | grep swap`" ]; then for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/hwconf.sh --- a/etc/init.d/hwconf.sh Sat Apr 30 21:10:06 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -#!/bin/sh -# /etc/init.d/hwconf.sh - SliTaz hardware configuration. -# -# This script configures the sound card and screen. Tazhw is used earlier -# at boot time to autoconfigure PCI and USB devices. -# -. /etc/init.d/rc.functions - -# Parse cmdline args for boot options (See also rcS and bootopts.sh). -XARG="" -for opt in `cat /proc/cmdline` -do - case $opt in - sound=*) - DRIVER=${opt#sound=} ;; - xarg=*) - XARG="$XARG ${opt#xarg=}" ;; - screen=text) - SCREEN=text - # Disable X. - echo -n "Disabling X login manager: slim..." - . /etc/rcS.conf - RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/` - sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf - status ;; - screen=*) - SCREEN=${opt#screen=} ;; - *) - continue ;; - esac -done - -# Sound configuration stuff. First check if sound=no and remove all -# sound Kernel modules. -if [ -n "$DRIVER" ]; then - case "$DRIVER" in - no) - echo -n "Removing all sound kernel modules..." - rm -rf /lib/modules/`uname -r`/kernel/sound - status - echo -n "Removing all sound packages..." - for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do - pkg=${i#/var/lib/tazpkg/installed/} - echo 'y' | tazpkg remove ${pkg%/*} > /dev/null - done - for i in alsa-lib mhwaveedit asunder libcddb ; do - echo 'y' | tazpkg remove $i > /dev/null - done - status ;; - noconf) - echo "Sound configuration was disabled from cmdline..." ;; - *) - if [ -x /usr/sbin/soundconf ]; then - echo "Using sound kernel module $DRIVER..." - /usr/sbin/soundconf -M $DRIVER - fi ;; - esac -# Sound card may already be detected by PCI-detect. -elif [ -d /proc/asound ]; then - # Restore sound config for installed system. - if [ -s /etc/asound.state ]; then - echo -n "Restoring last alsa configuration..." - alsactl restore - status - else - /usr/sbin/setmixer - fi - # Start soundconf to config driver and load module for Live mode - # if not yet detected. - /usr/bin/amixer >/dev/null || /usr/sbin/soundconf -else - echo "Unable to configure sound card." -fi diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/i18n.sh --- a/etc/init.d/i18n.sh Sat Apr 30 21:10:06 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -#!/bin/sh -# /etc/init.d/i18n.sh - Internationalization initialization. -# -# This script configures SliTaz default keymap, locale, timezone. -# -. /etc/init.d/rc.functions - -# Locale config. -if [ -s "/etc/locale.conf" ]; then - . /etc/locale.conf - echo -n "Locale configuration: $LANG" && status -else - tazlocale -fi - -# Keymap config. -if [ -s "/etc/keymap.conf" ]; then - keymap=`cat /etc/keymap.conf` - echo -n "Keymap configuration: $keymap" && status - if [ -x /bin/loadkeys ]; then - loadkeys $keymap - else - loadkmap < /usr/share/kmap/$keymap.kmap - fi -else - tazkeymap -fi - -# Timezone config. Set timezone using the keymap config for fr, be, fr_CH -# and ca with Montreal. -if [ ! -s "/etc/TZ" ]; then - keymap=`cat /etc/keymap.conf` - case "$keymap" in - fr-latin1|be-latin1) - echo -n "Setting timezone to Europe/Paris... " - echo "Europe/Paris" > /etc/TZ && status - ;; - fr_CH-latin1|de_CH-latin1) - echo -n "Setting timezone to Europe/Zurich... " - echo "Europe/Zurich" > /etc/TZ && status - ;; - cf) - echo -n "Setting timezone to America/Montreal... " - echo "America/Montreal" > /etc/TZ && status - ;; - *) - echo -n "Setting default timezone to UTC... " - echo "UTC" > /etc/TZ && status - ;; - esac -fi - diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/rc.functions --- a/etc/init.d/rc.functions Sat Apr 30 21:10:06 2011 +0000 +++ b/etc/init.d/rc.functions Mon May 16 00:32:16 2011 +0200 @@ -1,30 +1,16 @@ +#!/bin/sh # /etc/init.d/rc.functions: SliTaz boot scripts functions. # # Status functions. -status() -{ - local CHECK=$? +status() { echo -en "\\033[70G[ " - if [ $CHECK = 0 ]; then - echo -en "\\033[1;33mOK" + if [ $? = 0 ]; then + echo -en "\\033[1;32mOK" else echo -en "\\033[1;31mFailed" fi echo -e "\\033[0;39m ]" - return $CHECK -} - -# Another way to sleep. -usleep_progress() -{ - CHAR='=' - for i in `seq 1 79` - do - echo -n "$CHAR" - usleep 18000 - done - echo "$CHAR" } # Check daemon with pidfile: usage check_pidfile $PIDFILE $DAEMON @@ -40,6 +26,3 @@ return 2 fi } - -# Set TZ -[ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)" diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/rcS --- a/etc/init.d/rcS Sat Apr 30 21:10:06 2011 +0000 +++ b/etc/init.d/rcS Mon May 16 00:32:16 2011 +0200 @@ -8,7 +8,8 @@ . /etc/init.d/rc.functions . /etc/rcS.conf -# Boot time. +# Set TZ and boot time. +[ -s /etc/TZ ] && export TZ="$(cat /etc/TZ)" bootdate=`date +%s` if [ "$1" != "logged" ]; then # logged @@ -29,50 +30,27 @@ /bin/mount proc status -# Set time zone now to get system events at local time -if [ -s /etc/TZ ]; then - export TZ=$(cat /etc/TZ) -fi - [ "$FBSPLASH" == "yes" ] && echo "10" > /etc/fbsplash/fifo # Parse cmdline args for earlier boot options. All other boot options # are in /etc/init./bootopts.sh. -echo "Checking for early boot options..." +echo -n "Searching for early boot options..." for opt in `cat /proc/cmdline` do case $opt in + fastbootx|fbx) + export FAST_BOOT_X="yes" ;; cdrom=*) export CDROM=${opt#cdrom=} ;; modprobe=*) export MODPROBE="yes" ;; config=*) export CONFIG=${opt#config=} ;; - xarg=*) - export XARG="$XARG ${opt#xarg=}" ;; - screen=*) - export SCREEN=${opt#screen=} ;; - autologin) - # Autologin option to skip first graphic login prompt. - if [ ! $(grep -l '^auto_login yes' /etc/slim.conf) ]; then - echo "auto_login yes" >> /etc/slim.conf - fi ;; - lang=*) - # Check for a specified locale (lang=*). - LANG=${opt#lang=} - echo -n "Setting system locale to: $LANG... " - tazlocale init $LANG - status ;; - kmap=*) - # Check for a specified keymap (kmap=*). - KEYMAP=${opt#kmap=} - echo -n "Setting system keymap to: $KEYMAP..." - tazkeymap init $KEYMAP - status ;; *) continue ;; esac done +status [ "$FBSPLASH" == "yes" ] && echo "20" > /etc/fbsplash/fifo @@ -141,12 +119,23 @@ /bin/chmod 1777 /tmp/.X11-unix /tmp/.ICE-unix status +# Fast boot into X for HD install or custom Live system. We need +# keymap settings since Xvesa dumps the console mapping and a correct +# slim configuration for screen resolution. DBUS and HAL must also start +# before X session (manual login or autologin) to have devices in PCmanFM. +if [ "$FAST_BOOT_X" = "yes" ]; then + /etc/init.d/system.sh + /etc/init.d/dbus start + /etc/init.d/hald start + /etc/init.d/slim start & +fi + # Create /dev/cdrom if needed (symlink does not exist on LiveCD). # Also add /dev/cdrom to fstab if entry does not exist. if [ -n "$CDROM" ]; then DRIVE_NAME=${CDROM#/dev/} else - DRIVE_NAME=$(grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3) + DRIVE_NAME=`grep -s "drive name" /proc/sys/dev/cdrom/info | cut -f 3` fi if [ -n "$DRIVE_NAME" -a ! "`readlink /dev/cdrom`" ]; then echo -n "Creating symlink : /dev/cdrom..." @@ -160,9 +149,6 @@ >> /etc/fstab status fi - -[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo - # Chmod hack on each boot for Asunder and burnbox. Allowing all users # to burn/rip CD/DVD. if [ -n "$DRIVE_NAME" -a "`readlink /dev/cdrom`" ]; then @@ -173,6 +159,8 @@ status fi +[ "$FBSPLASH" == "yes" ] && echo "50" > /etc/fbsplash/fifo + # Handle kernel cmdline parameter modprobe= if [ -n "$MODPROBE" ]; then MODULES=`sed -e 's/.* modprobe=\([^ ]*\).*/\1/' -e 's/,/\n/g' < /proc/cmdline` @@ -183,8 +171,6 @@ done fi -[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo - # Handle kernel cmdline parameter config=, to source a # disk init script if [ -n "$CONFIG" ]; then @@ -217,6 +203,8 @@ status fi +[ "$FBSPLASH" == "yes" ] && echo "60" > /etc/fbsplash/fifo + # Start syslogd and klogd. if [ "$KERNEL_LOG_DAEMONS" = "yes" ]; then echo -n "Starting system log deamon: syslogd..." @@ -227,8 +215,6 @@ echo "Kernel log daemons are disabled in /etc/rc.conf..." fi -[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo - # Load all modules listed in config file. if [ -n "$LOAD_MODULES" ]; then for mod in $LOAD_MODULES @@ -240,60 +226,24 @@ # Be quiet on configuration to avoid messages overwriting ncurses dialog echo "0 0 0 0" > /proc/sys/kernel/printk +[ "$FBSPLASH" == "yes" ] && echo "70" > /etc/fbsplash/fifo + # Detect PCI and USB devices with Tazhw from slitaz-tools. We load # kernel modules only at first boot or in LiveCD mode. if [ ! -s /var/lib/detected-modules ]; then /sbin/tazhw init fi +[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo + +# Call udevadm trigger to ensure /dev is fully populate now that all +# modules are loaded. if [ "$UDEV" = "yes" ]; then - echo -n "Udevadm requesting events from the Kernel..." + echo -n "Requesting events from the Kernel..." udevadm trigger status fi -# Start DBUS and HAL deamon so we can use Xorg and a WM to configure -# system locale and keybord on first boot. -[ -x /etc/init.d/dbus ] && /etc/init.d/dbus start -[ -x /etc/init.d/hald ] && /etc/init.d/hald start - -[ "$FBSPLASH" == "yes" ] && echo "80" > /etc/fbsplash/fifo - -# Set the console keymap and configure i18n in case of screen=text and -# no locale.conf or keymap.conf. Add default user for live mode and -# mount an eventual /home partition. -/etc/init.d/i18n.sh -/etc/init.d/user-home.sh - -# Requested screen is not text mode and keymap.conf is empty so go -# for an i18n configuration in GUI mode. In cas of screen=text we -# configure locale and keymap just after via i18n.sh -#if [ "$SCREEN" != "text" -a ! -s "/etc/keymap.conf" -a -x /usr/bin/Xorg ]; then -# DISPLAY=:1 tazbox boot -#fi - -[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo - -# Now that we have a keymap configuration we can auto configure Xorg. -# We need to set $HOME. -if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then - echo "Configuring Xorg..." - HOME=/root - tazx config-xorg -fi - -# Here we finish bootsplash since we start Xorg session. -[ "$FBSPLASH" == "yes" ] && sleep 1 && echo "exit" > /etc/fbsplash/fifo - -# No text mode requested, we have i18n and Xorg settings as well as a -# user, so start a desktop and let boot process finih in backgroud. -if [ "$SCREEN" != "text" -a -x /etc/init.d/slim ]; then - /etc/init.d/slim start -fi - -# Auto recharge packages list (after network connection of course) -[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge & - # Start all scripts specified with $RUN_SCRIPTS. echo "Executing all initialization scripts..." for script in $RUN_SCRIPTS @@ -303,6 +253,12 @@ fi done +[ "$FBSPLASH" == "yes" ] && echo "90" > /etc/fbsplash/fifo + +# Re-source main config file. In Live mode, daemons list can be modified +# by boot options (screen=text will remove slim). +. /etc/rcS.conf + # Start all daemons specified with $RUN_DAEMONS. echo "Starting all daemons specified in /etc/rcS.conf..." for daemon in $RUN_DAEMONS @@ -312,6 +268,8 @@ fi done +[ "$FBSPLASH" == "yes" ] && echo "100" > /etc/fbsplash/fifo + # Back to a verbose mode. echo "7 4 1 7" > /proc/sys/kernel/printk @@ -325,5 +283,6 @@ time=$((`date +%s` - $bootdate)) echo $time > /var/log/boot-time echo "SliTaz boot time: ${time}s" +[ "$FBSPLASH" == "yes" ] && echo "exit" > /etc/fbsplash/fifo fi # logged diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/system.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/etc/init.d/system.sh Mon May 16 00:32:16 2011 +0200 @@ -0,0 +1,150 @@ +#!/bin/sh +# /etc/init.d/system.sh - SliTaz hardware configuration. +# +# This script configures the sound card and screen. Tazhw is used earlier +# at boot time to autoconfigure PCI and USB devices. It also configure +# system language, keyboarf and TZ in live mode. +# +. /etc/init.d/rc.functions + +# Parse cmdline args for boot options (See also rcS and bootopts.sh). +XARG="" +for opt in $(cat /proc/cmdline) +do + case $opt in + sound=*) + DRIVER=${opt#sound=} ;; + xarg=*) + XARG="$XARG ${opt#xarg=}" ;; + screen=text) + SCREEN=text + # Disable X. + echo -n "Disabling X login manager: slim..." + . /etc/rcS.conf + RUN_DAEMONS=$(echo $RUN_DAEMONS | sed s/' slim'/''/) + sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf + status ;; + screen=*) + SCREEN=${opt#screen=} ;; + *) + continue ;; + esac +done + +# Sound configuration stuff. First check if sound=no and remove all +# sound Kernel modules. +if [ -n "$DRIVER" ]; then + case "$DRIVER" in + no) + echo -n "Removing all sound kernel modules..." + rm -rf /lib/modules/`uname -r`/kernel/sound + status + echo -n "Removing all sound packages..." + for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do + pkg=${i#/var/lib/tazpkg/installed/} + echo 'y' | tazpkg remove ${pkg%/*} > /dev/null + done + for i in alsa-lib mhwaveedit asunder libcddb ; do + echo 'y' | tazpkg remove $i > /dev/null + done + status ;; + noconf) + echo "Sound configuration was disabled from cmdline..." ;; + *) + if [ -x /usr/sbin/soundconf ]; then + echo "Using sound kernel module $DRIVER..." + /usr/sbin/soundconf -M $DRIVER + fi ;; + esac +# Sound card may already be detected by PCI-detect. +elif [ -d /proc/asound ]; then + # Restore sound config for installed system. + if [ -s /etc/asound.state ]; then + echo -n "Restoring last alsa configuration..." + alsactl restore + status + else + /usr/sbin/setmixer + fi + # Start soundconf to config driver and load module for Live mode + # if not yet detected. + /usr/bin/amixer >/dev/null || /usr/sbin/soundconf +else + echo "Unable to configure sound card." +fi + +# Start TazPanel +[ -x /usr/bin/tazpanel ] && tazpanel start + +# Auto recharge packages list (after network connection of course) +[ "$RECHARGE_PACKAGES_LIST" == "yes" ] && tazpkg recharge & + +# Locale config. Do a gui config for both lang/keymap. +echo "Checking if /etc/locale.conf exists... " +if [ ! -s "/etc/locale.conf" ]; then + if [ "$SCREEN" != "text" ] && [ -x /usr/bin/Xorg ]; then + echo "GUI configuration starting..." + DISPLAY=:1 tazbox boot + else + tazlocale + fi +else + echo -n "Locale configuration: $(cat /etc/locale.conf)" && status +fi + +# Keymap config. +if [ -s "/etc/keymap.conf" ]; then + KEYMAP=$(cat /etc/keymap.conf) + echo "Keymap configuration: $KEYMAP" + if [ -x /bin/loadkeys ]; then + loadkeys $KEYMAP + else + loadkmap < /usr/share/kmap/$KEYMAP.kmap + fi +else + tazkeymap +fi + +# Timezone config. Set timezone using the keymap config for fr, be, fr_CH +# and ca with Montreal. +if [ ! -s "/etc/TZ" ]; then + map=$(cat /etc/keymap.conf) + case "$map" in + fr-latin1|be-latin1) + echo "Europe/Paris" > /etc/TZ ;; + fr_CH-latin1|de_CH-latin1) + echo "Europe/Zurich" > /etc/TZ ;; + cf) + echo "America/Montreal" > /etc/TZ ;; + *) + echo "UTC" > /etc/TZ ;; + esac +fi + +# Xorg auto configuration. +if [ "$SCREEN" != "text" -a ! -s /etc/X11/xorg.conf -a -x /usr/bin/Xorg ]; then + echo "Configuring Xorg..." + # $HOME is not yet set. + HOME=/root + sed -i 's|/usr/bin/Xvesa|/usr/bin/Xorg|' /etc/slim.conf + sed -i s/"^xserver_arguments"/'\#xserver_arguments'/ /etc/slim.conf + tazx config-xorg 2>/var/log/xorg.configure.log +fi + +# Start X sesssion as soon as possible in Live/frugal mode. HD install +# can use FAST_BOOT_X wich start X even before. In live mode we need +# keymap config for Xorg configuration and a working Xorg config. +if [ "$SCREEN" != "text" ] && [ -x /usr/bin/slim ]; then + if fgrep -q root=/dev/null /proc/cmdline; then + /etc/init.d/slim start + fi +fi + +# Firefox hack to get the right locale. +if fgrep -q "fr_" /etc/locale.conf; then + # But is the fox installed ? + if [ -f "/var/lib/tazpkg/installed/firefox/receipt" ]; then + . /var/lib/tazpkg/installed/firefox/receipt + sed -i 's/en-US/fr/' /etc/firefox/pref/firefox-l10n.js + fi +fi diff -r 1cb12350353b -r a0f7424e5486 etc/init.d/user-home.sh --- a/etc/init.d/user-home.sh Sat Apr 30 21:10:06 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -#!/bin/sh -# /etc/init.d/user.sh - SliTaz default user for live mode and /home. -# -# This script is called from the main boot script /etc/init/rcS -# to add a user for live mode and mount /home before we start Slim -# since we need a user to autologin and provide a desktop -# -# Default user account without password (uid=1000). In live mode the option -# user=name can be used, but user must be added before home= to have home dir. -# This option is not handled by a loop and case like others and has no -# effect on an installed system. -# -. /etc/init.d/rc.functions - -if ! grep -q "100[0-9]:100[0-9]" /etc/passwd; then - if grep -q "user=" /proc/cmdline; then - USER=`cat /proc/cmdline | sed 's/.*user=\([^ ]*\).*/\1/'` - # Avoid usage of an existing system user or root. - if grep -q ^$USER /etc/passwd; then - USER=tux - fi - else - USER=tux - fi - echo -n "Configuring user and group: $USER..." - adduser -D -s /bin/sh -g "SliTaz User" -G users -h /home/$USER $USER - passwd -d $USER >/dev/null - status - # Audio and cdrom group. - addgroup $USER audio - addgroup $USER cdrom - addgroup $USER video - addgroup $USER tty - # Slim default user. - if [ -f /etc/slim.conf ]; then - sed -i s/"default_user .*"/"default_user $USER"/\ - /etc/slim.conf - fi -fi - -# Check for a specified home partition (home=*) and check for -# user home dir. Note: home=usb is a shorter and easier way to -# have home=/dev/sda1. -# -if grep -q "home=" /proc/cmdline; then - DEVICE=${opt#home=} - [ "$DEVICE" = "usb" ] && DEVICE=sda1 - echo "Home has been specified to $DEVICE..." - DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` - if [ -z "$DEVID" ]; then - USBDELAY=`cat /sys/module/usb_storage/parameters/delay_use` - USBDELAY=$((2+$USBDELAY)) - echo "Sleeping $USBDELAY s to let the kernel detect the device... " - sleep $USBDELAY - fi - USER=`cat /etc/passwd | sed '/:1000:/!d;s/:.*//;q'` - DEVID=$DEVICE - if [ -x /sbin/blkid ]; then - # Can be a label, uuid, type or devname. DEVID gives us first: /dev/name. - DEVID=`/sbin/blkid | sed 'p;s/"//g' | grep "$DEVICE" | sed 's/:.*//;q'` - fi - DEVID=${DEVID##*/} - if [ -n "$DEVID" ] && grep -q "$DEVID" /proc/partitions ; then - echo "Mounting /home on /dev/$DEVID... " - [ -d /home/$USER ] && mv /home/$USER /tmp/$USER-files - mount /dev/$DEVID /home -o uid=1000,gid=1000 2>/dev/null \ - || mount /dev/$DEVID /home - # Check if swap file must be generated in /home: swap=size (Mb). - # This option is only used within home=device. - if grep -q "swap=[1-9]*" /proc/cmdline; then - SWAP_SIZE=`sed 's/.*swap=\([^ ]*\).*/\1/' < /proc/cmdline` - # DD to gen a virtual disk. - echo "Generating swap file: /home/swap ($SWAP_SIZE)..." - dd if=/dev/zero of=/home/swap bs=1M count=$SWAP_SIZE - # Make the Linux swap filesystem. - mkswap /home/swap - add_swap_in_fstab /home/swap - fi - else - echo "Unable to find $DEVICE... " - fi - # Move all user dir if needed. - if [ ! -d "/home/$USER" ] ; then - mv /tmp/$USER-files /home/$USER - chown -R $USER.users /home/$USER - else - rm -rf /tmp/$USER-files - fi - # Install all packages in /home/boot/packages. In live CD and - # USB mode the option home= mounts the device on /home, so we - # already have a boot directory with the Kernel and rootfs. - if [ -d "/home/boot/packages" ]; then - for pkg in /home/boot/packages/*.tazpkg - do - tazpkg install $pkg - done - fi - # We can have custom files in /home/boot/rootfs to overwrite - # the one packed into the Live system. - if [ -d "/home/boot/rootfs" ]; then - cp -a /home/boot/rootfs/* / - fi -fi diff -r 1cb12350353b -r a0f7424e5486 etc/rcS.conf --- a/etc/rcS.conf Sat Apr 30 21:10:06 2011 +0000 +++ b/etc/rcS.conf Mon May 16 00:32:16 2011 +0200 @@ -18,7 +18,7 @@ # then dbus, hald and slim can be removed from RUN_DAEMONS. FAST_BOOT_X="no" -# Graphical boot with fbsplash (To easily configure use: tazfbsplash). +# Graphical boot with fbsplash (To easily configure use: tazfbsplash) FBSPLASH="no" FBSPLASH_THEME="slitaz" @@ -29,7 +29,7 @@ # Kernel modules to automatically load at boot time if not automatically # detected. You can use 'modprobe -l' to get a list of all kernel modules # available. -LOAD_MODULES=" " +LOAD_MODULES="" # Automatically recharge packages list on each boot and in background. # If new packages or upgrades are available they will be notified with @@ -38,16 +38,16 @@ RECHARGE_PACKAGES_LIST="no" # Initialization scripts to run at boot time. Boot order is important: -# bootopts.sh (boot options) must start first, hwconf.sh after network.sh (tazx -# needs an active connection to install Xorg), then you are free to choose. -# Note that the local.sh script exists to let you quickly add some local startup -# commands. -RUN_SCRIPTS="bootopts.sh network.sh hwconf.sh local.sh" +# bootopts.sh (boot options) must start first, system.sh after network.sh +# (tazx needs an active connection to install Xorg), then you are free +# to choose. Note that the local.sh script exists to let you quickly add +# some local startup commands. +RUN_SCRIPTS="bootopts.sh network.sh system.sh local.sh" # Daemons to start at boot time. SliTaz only provides a few daemons: firewall, # Web server (lighttpd), SSH server (dropbear) and rsyncd, so boot order is # not really important, but dbus/hald should be started before slim. -RUN_DAEMONS="firewall tazpanel" +RUN_DAEMONS="dbus hald slim firewall httpd" # Pre login bold message. MESSAGE="Welcome to your box."