aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2005-11-19 01:47:31 +0000
committerJudd Vinet <judd@archlinux.org>2005-11-19 01:47:31 +0000
commit561ff8a3abbda0a86cc2a479d8e1a9e1b965b0d1 (patch)
treecb260f1ebc456c5ca496d9460dd032b12db97275
parent23f08df5cb31d38347582e4d62f9279385c612ba (diff)
downloadinitscripts-561ff8a3abbda0a86cc2a479d8e1a9e1b965b0d1.tar.xz
added crypttab stuff
-rwxr-xr-xhwdetect82
-rwxr-xr-xrc.sysinit44
2 files changed, 65 insertions, 61 deletions
diff --git a/hwdetect b/hwdetect
index b2f281a..f670198 100755
--- a/hwdetect
+++ b/hwdetect
@@ -52,75 +52,47 @@ for i in `cat /tmp/modprobe`; do
modprobe -i --show-depends $i >> /tmp/modules-plain 2>/dev/null
done
# fix evdev detection
-if [ `grep "serio:ty06pr*[id]*[ex]*" /tmp/modprobe` ]; then
-modprobe -i --show-depends evdev >> /tmp/modules-plain 2>/dev/null
+if [ "`grep 'serio:ty06pr*[id]*[ex]*' /tmp/modprobe`" ]; then
+ modprobe -i --show-depends evdev >> /tmp/modules-plain 2>/dev/null
fi
# fix Intel536ep detection
-if [ `grep "pci:v00008086d00001040sv000016BEsd00001040bc07sc80i00" /tmp/modprobe` ]; then
-modprobe -i --show-depends Intel536 >> /tmp/modules-plain 2>/dev/null
+if [ "`grep 'pci:v00008086d00001040sv000016BEsd00001040bc07sc80i00' /tmp/modprobe`" ]; then
+ modprobe -i --show-depends Intel536 >> /tmp/modules-plain 2>/dev/null
fi
-# find PNP devices, like parports, soundcards etc. workaround for rtc,pcspkr,irtty-sir and analog included
+# find PNP devices like parports, soundcards etc.
+# (workaround for rtc, pcspkr, irtty-sir and analog are included)
for i in `find /sys -name "id*" | grep pnp`; do
devid=`cat $i | grep PNP`
modprobe -i --show-depends pnp:d${devid} >> /tmp/modules-plain 2>/dev/null
- if [ "$devid" == "PNP0800" ]; then
- modprobe -i --show-depends pcspkr >> /tmp/modules-plain 2>/dev/null
- fi
-
- if [ "$devid" == "PNP0b00" ]; then
- modprobe -i --show-depends rtc >> /tmp/modules-plain 2>/dev/null
- fi
-
- if [ "$devid" == "PNP0510" ]; then
- modprobe -i --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
- fi
+ [ "$devid" == "PNP0800" ] && modprobe -i --show-depends pcspkr >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" == "PNP0b00" ] && modprobe -i --show-depends rtc >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" == "PNP0510" ] && modprobe -i --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" == "PNP0511" ] && modprobe -i --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
+ [ "$devid" == "PNPb02f" ] && modprobe -i --show-depends analog >> /tmp/modules-plain 2>/dev/null
- if [ "$devid" == "PNP0511" ]; then
- modprobe -i --show-depends irtty-sir >> /tmp/modules-plain 2>/dev/null
- fi
-
- if [ "$devid" == "PNPb02f" ]; then
- modprobe -i --show-depends analog >> /tmp/modules-plain 2>/dev/null
- fi
# load ppp-generic if serial ports are detected for modems
- if [ "$devid" == "PNP0501" ]; then
- modprobe -i --show-depends ppp-generic >> /tmp/modules-plain 2>/dev/null
- fi
+ [ "$devid" == "PNP0501" ] && modprobe -i --show-depends ppp-generic >> /tmp/modules-plain 2>/dev/null
done
# IDE disks/cdroms/floppy/tape
for i in $(cat `find /proc/ide -name "media"`); do
- if [ "$i" == "cdrom" ]; then
- modprobe -i --show-depends ide-cd >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "floppy" ]; then
- modprobe -i --show-depends ide-floppy >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "disk" ]; then
- modprobe -i --show-depends ide-disk >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "tape" ]; then
- modprobe -i --show-depends ide-tape >> /tmp/modules-plain 2>/dev/null
- fi
+ case $i in
+ cdrom) modprobe -i --show-depends ide-cd >> /tmp/modules-plain 2>/dev/null ;;
+ floppy) modprobe -i --show-depends ide-floppy >> /tmp/modules-plain 2>/dev/null ;;
+ disk) modprobe -i --show-depends ide-disk >> /tmp/modules-plain 2>/dev/null ;;
+ tape) modprobe -i --show-depends ide-tape >> /tmp/modules-plain 2>/dev/null ;;
+ esac
done
# SCSI disks/cdroms/tapes/generic devices
for i in $(cat `find /sys/devices -name "type"`); do
- if [ "$i" == "3" ] || [ "$i" == "4" ] || [ "$i" == "5" ]; then
- modprobe -i --show-depends sr-mod >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "2" ] || [ "$i" == "3" ] || [ "$i" == "5" ] || [ "$i" == "6" ] || [ "$i" == "8" ] || [ "$i" == "9" ]; then
- modprobe -i --show-depends sg >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "0" ] || [ "$i" == "7" ] || [ "$i" == "14" ]; then
- modprobe -i --show-depends sd-mod >> /tmp/modules-plain 2>/dev/null
- fi
- if [ "$i" == "1" ]; then
- modprobe -i --show-depends st >> /tmp/modules-plain 2>/dev/null
- fi
+ case $i in (3|4|5) modprobe -i --show-depends sr-mod >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (2|3|5|6|8|9) modprobe -i --show-depends sg >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (0|7|14) modprobe -i --show-depends sd-mod >> /tmp/modules-plain 2>/dev/null ;; esac
+ case $i in (1) modprobe -i --show-depends st >> /tmp/modules-plain 2>/dev/null ;; esac
done
sort -u /tmp/modules-plain >> /tmp/modules-sorted
@@ -130,6 +102,14 @@ sed -ne "s#^insmod.*/\(.*\)\.ko.*#\1#p" /tmp/modules-sorted >> /tmp/moduleslist
for i in $BLACKLIST; do
[ "$i" ] || continue
sed -i -e "/^$i$/d" /tmp/moduleslist
+ # since '-' and '_' are interchangeable, we have to cover both
+ if [ "`echo $i | grep '-'`" ]; then
+ i="`echo $i | sed 's|-|_|g'`"
+ sed -i -e "/^$i$/d" /tmp/moduleslist
+ elif [ "`echo $i | grep '_'`" ]; then
+ i="`echo $i | sed 's|_|-|g'`"
+ sed -i -e "/^$i$/d" /tmp/moduleslist
+ fi
done
listmods() {
@@ -204,4 +184,4 @@ done
# cleanup
rm /tmp/{modules-plain,modules-sorted,moduleslist,modprobe,modules}
-# vim: set ts=2 sw=2:
+# vim: set ts=2 sw=2 nowrap:
diff --git a/rc.sysinit b/rc.sysinit
index 68e5801..9111a11 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -59,7 +59,29 @@ if [ -f /initrd/linuxrc ]; then
stat_done
fi
-# TODO: set up non-root encrypted partition mappings
+# Set up non-root encrypted partition mappings
+if [ -f /etc/crypttab ]; then
+ CS=/sbin/cryptsetup.static
+ while read line; do
+ [ "$line" = "" ] && continue
+ [ "`echo $line | grep ^#`" ] && continue
+ # remove redundant whitespace
+ line=`echo $line | awk '{print $0}'`
+ cname=`echo $line | cut -d' ' -f1`
+ csrc=`echo $line | cut -d' ' -f2`
+ cpass=`echo $line | cut -d' ' -f3-`
+ [ "$cpass" = "" ] && continue
+
+ action=create
+ $CS isLuks $csrc 2>/dev/null && action=luksOpen
+
+ if [ "`echo $cpass | grep \\\"`" ]; then
+ echo "echo $cpass | $CS $action $cname $csrc"
+ else
+ echo "$CS -d $cpass $action $cname $csrc"
+ fi
+ done </etc/crypttab
+fi
if [ "$USELVM" = "yes" -o "$USELVM" = "YES" ]; then
if [ -f /etc/lvmtab -a -x /sbin/vgchange ]; then
@@ -178,19 +200,21 @@ if [ "$LOCALE" != "" ]; then
stat_busy "Setting Locale: $LOCALE"
echo "export LANG=$LOCALE" >/etc/profile.d/locale.sh
/bin/chmod 755 /etc/profile.d/locale.sh
+ stat_done
# If locale is *.utf set console to Unicode mode
- if [ "`echo $LOCALE | /bin/grep -i utf`" != "" ]; then
+ if [ "`echo $LOCALE | /bin/grep -i utf`" ]; then
+ stat_busy "Setting Consoles to UTF-8"
/usr/bin/kbd_mode -u
/usr/bin/dumpkeys | /bin/loadkeys --unicode
- echo 'for i in `seq 1 12`; do' >>/etc/profile.d/locale.sh
- echo ' echo -ne "\033%G"' >>/etc/profile.d/locale.sh
- echo 'done' >>/etc/profile.d/locale.sh
+ for i in `seq 1 12`; do
+ echo -ne "\033%G" >/dev/vc/${i}
+ done
if [ "$CONSOLEFONT" = "" ]; then
CONSOLEFONT="LatArCyrHeb-16"
fi
+ stat_done
fi
- stat_done
else
rm -f /etc/profile.d/locale.sh
fi
@@ -214,15 +238,15 @@ fi
# Load modules from the MODULES array defined in rc.conf
if [ -f /proc/modules ]; then
stat_busy "Loading Modules"
- if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
- export BLACKLIST="${MOD_BLACKLIST[*]}"
- /sbin/hwdetect -load-modules
- fi
for mod in "${MODULES[@]}"; do
if [ "$mod" = "${mod#!}" ]; then
/sbin/modprobe $mod
fi
done
+ if [ "$MOD_AUTOLOAD" = "yes" -o "$MOD_AUTOLOAD" = "YES" ]; then
+ export BLACKLIST="${MOD_BLACKLIST[*]}"
+ /sbin/hwdetect -load-modules
+ fi
stat_done
fi