Update of /cvsroot/devil-linux/build/config/etc/init.d
In directory sc8-pr-cvs1:/tmp/cvs-serv11330/build/config/etc/init.d
Modified Files:
mountfs
Log Message:
Changed mountfs to use lvmtab and default others to be mounted under /var
Index: mountfs
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/init.d/mountfs,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mountfs 4 Oct 2003 00:51:57 -0000 1.27
+++ mountfs 26 Dec 2003 03:16:20 -0000 1.28
@@ -23,26 +23,22 @@
source /etc/init.d/functions
# supported LVs
-dl_lvs="swap log spool squid tmp data home opt imap mail"
+LVMTAB="/etc/sysconfig/lvmtab"
+LVMSYS="devil-linux"
+LVMPROC="/proc/lvm/VGs/devil-linux/LVs"
lvm_scan ()
{
local do_display=$1
# scan volume groups and display logical volumes
- vg_system=""
- for lv in $dl_lvs; do
- eval lv_$lv=0
- done
VGS=$(vgdisplay -c 2>&1 | grep -v "no volume groups found" | cut -f1 -d:)
if [ -n "$VGS" ]; then
for VG in $VGS; do
[ -n "$do_display" ] && echo " volume group \"${VG}\""
- [ "$VG" = "devil-linux" ] && vg_system=$VG
LVS=$(lvdisplay -c /dev/$VG/* 2>/dev/null | cut -f1 -d:)
for LV in $LVS; do
[ -n "$do_display" ] && echo " logical volume \"${LV}\""
- [ "$VG" = "$vg_system" ] && eval lv_${LV##*/}=1
done
echo
done
@@ -52,6 +48,34 @@
}
+lvm_mount ()
+{
+ [ ! -d $LD ] && mkdir -p $LD &> /dev/null
+ if [ -d $LD ]; then
+ case $LT in
+ swap )
+ echo -n "Activating swap $lv_done"
+ swapon /dev/$LVMSYS/$LV &> /dev/null
+ evaluate_retval
+ ;;
+ * )
+
+ [ "$L2" -gt "0" ] && \
+ /sbin/fsck -a -C -T /dev/$LVMSYS/$LV
+ echo -n "Mounting $LD $lv_done"
+ mount -t"$LT" -o"$LO" /dev/$LVMSYS/$LV $LD
+ evaluate_retval
+ if [ $(echo "$LO" | grep -c quota) -eq 1 ]; then
+ modprobe quota_v2 > /dev/null
+ quotaon $LD
+ fi
+ ;;
+ esac
+ else
+ echo "ERROR: cannot create directory: $LD, $LV not mounted"
+ fi
+}
+
case "$1" in
start)
@@ -77,30 +101,29 @@
lvm_scan print
# if we found the devil-linux vg mount the filesystems
- if [ -n "$vg_system" ]; then
+ if [ -d $LVMPROC ]; then
echo "Devil-Linux Harddisk found, activating..."
- for lv in $dl_lvs; do
- eval lv_active=\$lv_$lv
- if [ $lv_active -eq 1 ]; then
- case $lv in
- swap )
- echo "Activating swap"
- swapon /dev/$vg_system/swap &> /dev/null
- ;;
- opt|home )
- echo "Mounting /$lv"
- mkdir -p /$lv
- mount /dev/$vg_system/$lv /$lv &> /dev/null
- ;;
- * )
- echo "Mounting /var/$lv"
- mkdir -p /var/$lv
- mount /dev/$vg_system/$lv /var/$lv &> /dev/null
- ;;
- esac
- evaluate_retval
+ while read LV LD LT LO L1 L2 LX; do
+ [ $(echo ${LV:-#} | cut -c1) = "#" ] && continue
+ [ ! -e $LVMPROC/$LV ] && continue
+ eval lv_$LV=1
+ lvm_mount
+ done < $LVMTAB
+
+ for lv in $(ls $LVMPROC); do
+ if [ $(expand $LVMTAB | grep -c "^$lv ") -eq 1 ]; then
+ read LV LD LT LO L1 L2 LX <<< $(expand $LVMTAB | grep "^$lv ")
+ else
+ LV=$lv
+ LD=/var/$lv
+ LT="auto"
+ LO="defaults"
+ L1=0
+ L2=2
fi
+ eval lv_done=\$lv_$LV
+ [ "$lv_done" != "1" ] && lvm_mount
done
fi
fi
@@ -145,22 +168,11 @@
echo -n "Unmounting file systems..."
#/bin/umount -n -a -r
- cat /proc/mounts | cut -f -3 -d " " | grep -v "shm$" | grep -v "rootfs$" | grep -v "devfs$" | grep -v " proc" | cut -f 2 -d " " | xargs umount -rn
+ cat /proc/mounts | cut -f -3 -d " " | grep -v -e "shm$" -e "rootfs$" -e "devfs$" -e " proc" | cut -f 2 -d " " | xargs -n 1 umount -rn
evaluate_retval
# shutdown LVM if tools are installed
if [ -e /sbin/vgscan -a -e /sbin/vgchange ]; then
-
- lvm_scan
-
- # check if swap on LVM is active then deactivate it
- if [ $lv_swap -eq 1 ]; then
- echo -n "Deactivating swap on LVM"
- swapoff /dev/$vg_system/swap &> /dev/null
- print_status success
- fi
-
- # finally stop LVM
echo -n "Stopping LVM"
/sbin/vgchange -a n &> /dev/null
evaluate_retval
|