slitaz-boot-scripts view etc/init.d/bootopts.sh @ rev 8

Add network init script and config file
author Christophe Lincoln <pankso@slitaz.org>
date Fri Nov 30 12:34:07 2007 +0100 (2007-11-30)
parents
children 337a083dc89f
line source
1 #!/bin/sh
2 # /etc/init.d/bootopts.sh - SliTaz boot options from the cmdline.
3 #
4 . /etc/init.d/rc.functions
6 # Mount /home and check for user hacker home dir.
7 #
8 mount_home()
9 {
10 echo "Home has been specified to $DEVICE..."
11 echo -n "Sleeping 10 s to let the kernel detect the device... "
12 sleep 10
13 status
14 if grep -q "$DEVICE" /proc/partitions ; then
15 echo "Mounting /home on /dev/$DEVICE... "
16 mv /home/hacker /tmp/hacker-home
17 mount -t ext3 /dev/$DEVICE /home
18 else
19 echo "Unable to find $DEVICE in /proc/partitions... "
20 fi
21 # Move all hacker dir if needed.
22 if [ ! -d "/home/hacker" ] ; then
23 mv /tmp/hacker-home /home/hacker
24 chown -R hacker.hacker /home/hacker
25 else
26 rm -rf /tmp/hacker-home
27 fi
28 }
30 # Parse /proc/cmdline with grep.
31 #
33 echo "Parsing kernel cmdline for SliTaz live options... "
35 # Check for a specified home directory on cmdline (home=*).
36 #
37 if grep -q "home=usb" /proc/cmdline; then
38 DEVICE=sda1
39 mount_home
40 elif grep -q "home=" /proc/cmdline; then
41 DEVICE=`cat /proc/cmdline | sed 's/.*home=\([^ ]*\).*/\1/'`
42 mount_home
43 fi
45 # Active an eventual swap file in /home and on local hd.
46 #
47 if [ -f "/home/swap" ]; then
48 echo "Activing swap (/home/swap) memory..."
49 swapon /home/swap
50 fi
51 if [ "`fdisk -l | grep swap`" ]; then
52 for SWAP_DEV in `fdisk -l | grep swap | awk '{ print $1 }'`; do
53 echo "Swap memory detected on : $SWAP_DEV"
54 swapon $SWAP_DEV
55 done
56 fi
58 # Check for a specified locale (lang=*).
59 #
60 if grep -q "lang=*" /proc/cmdline; then
61 LANG=`cat /proc/cmdline | sed 's/.*lang=\([^ ]*\).*/\1/'`
62 echo -n "Setting system locale to: $LANG... "
63 echo "LANG=$LANG" > /etc/locale.conf
64 echo "LC_ALL=$LANG" >> /etc/locale.conf
65 status
66 fi
68 # Check for a specified keymap (kmap=*).
69 #
70 if grep -q "kmap=*" /proc/cmdline; then
71 KMAP=`cat /proc/cmdline | sed 's/.*kmap=\([^ ]*\).*/\1/'`
72 echo -n "Setting system keymap to: $KMAP..."
73 echo "KMAP=$KMAP.kmap" > /etc/kmap.conf
74 status
75 fi