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

bootopts.sh: remove user confug it's now in user-home.sh
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 21:06:53 2011 +0200 (2011-04-29)
parents a14abff6be90
children a0f7424e5486
line source
1 #!/bin/sh
2 # /etc/init.d/bootopts.sh - SliTaz boot options from the cmdline.
3 #
4 # Earlier boot options are in rcS, ex: config= and modprobe=
5 #
6 . /etc/init.d/rc.functions
8 # Update fstab for swapon/swapoff
9 add_swap_in_fstab()
10 {
11 grep -q "$1 " /etc/fstab || cat >> /etc/fstab <<EOT
12 $1 swap swap default 0 0
13 EOT
14 }
16 # Parse /proc/cmdline for boot options.
17 echo "Parsing kernel cmdline for SliTaz live options... "
19 for opt in `cat /proc/cmdline`
20 do
21 case $opt in
22 eject)
23 # Eject cdrom.
24 eject /dev/cdrom ;;
25 laptop)
26 # Laptop option to load related Kernel modules.
27 echo "Loading laptop modules: ac, battery, fan, yenta_socket..."
28 for mod in ac battery fan yenta_socket
29 do
30 modprobe $mod
31 done
32 grep -qs batt /etc/lxpanel/default/panels/panel ||
33 sed -i 's/= cpu/= batt\n}\n\nPlugin {\n type = cpu/' \
34 /etc/lxpanel/default/panels/panel 2> /dev/null
35 # Enable Kernel Laptop mode.
36 echo "5" > /proc/sys/vm/laptop_mode ;;
37 mount)
38 # Mount all ext3 partitions found (opt: mount).
39 # Get the list of partitions.
40 DEVICES_LIST=`fdisk -l | sed '/83 Linux/!d;s/ .*//'`
41 # Mount filesystems rw.
42 for device in $DEVICES_LIST
43 do
44 name=${device#/dev/}
45 # Device can be already used by home=usb.
46 if ! mount | grep ^$device >/dev/null; then
47 echo "Mounting partition: $name on /mnt/$name"
48 mkdir /mnt/$name
49 mount $device /mnt/$name
50 fi
51 done ;;
52 mount-packages)
53 # Mount and install packages-XXX.iso (useful without Internet
54 # connection).
55 PKGSIGN="LABEL=\"packages-$(cat /etc/slitaz-release)\" TYPE=\"iso9660\""
56 PKGDEV=$(blkid | grep "$PKGSIGN" | cut -d: -f1)
57 [ -z "$PKGDEV" -a -L /dev/cdrom ] && \
58 PKGDEV=$(blkid /dev/cdrom | grep "$PKGSIGN" | cut -d: -f1)
59 if [ -n "$PKGDEV" ]; then
60 echo -n "Mounting packages archive from $PKGDEV..."
61 mkdir /packages && mount -t iso9660 -o ro $PKGDEV /packages
62 status
63 /packages/install.sh
64 fi ;;
65 *)
66 continue ;;
67 esac
68 done
70 # Activate an eventual swap file or partition.
71 if [ "`fdisk -l | grep swap`" ]; then
72 for SWAP_DEV in `fdisk -l | sed '/swap/!d;s/ .*//'`; do
73 echo "Swap memory detected on: $SWAP_DEV"
74 add_swap_in_fstab $SWAP_DEV
75 done
76 fi
77 if grep -q swap /etc/fstab; then
78 echo "Activating swap memory..."
79 swapon -a
80 fi