Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fw-initramfs.git;a=commitdiff;h=be22e223498bafe2edc22dd59cda92b87b6ad469

commit be22e223498bafe2edc22dd59cda92b87b6ad469
Author: bouleetbil <[email protected]>
Date:   Sat Feb 20 22:20:33 2010 +0100

*enable disable support lvm2/mdam into initramfs

diff --git a/create_functions.sh b/create_functions.sh
index 1ea653d..1691943 100644
--- a/create_functions.sh
+++ b/create_functions.sh
@@ -81,3 +81,14 @@ Fsed() {
done
}

+#####################################################################
+# usage
+#####################################################################
+usage() {
+echo "usage:"
+echo "         create_initramfs.sh {--help}"
+echo "         create_initramfs.sh {--disable-lvm}"
+echo "         create_initramfs.sh {--disable-mdam}"
+exit;
+}
+
diff --git a/create_initramfs.sh b/create_initramfs.sh
index 1c76734..94415f2 100755
--- a/create_initramfs.sh
+++ b/create_initramfs.sh
@@ -16,10 +16,39 @@ HOMESOURCE=/usr/share/fw-initramfs/
. $HOMESOURCE/modules.sh
. $HOMESOURCE/create_static.sh

+
+while [[ $1 = -* ]]; do
+  case "$1" in
+    --disable-lvm)
+       echo "initramfs will be build without lvm"
+       ENABLELVM=0
+       shift
+      ;;
+    --disable-mdam)
+       echo "initramfs will be build without mdam"
+       ENABLEMDAM=0
+       shift
+      ;;
+    -d|--dir)
+       DIRSTATIC="$2"
+       echo "Binary build into $DIRSTATIC"
+       shift
+      ;;
+    -h|--help)
+      usage
+      ;;
+    *)
+      echo "Error: Unknown option: $1" >&2
+      exit 1
+      ;;
+  esac
+done
+
+
#####################################################################
-# check if root user
+# check if root user for mknod
#####################################################################
-#checkUser
+checkUser

#####################################################################
# delete old initramfs
@@ -70,16 +99,22 @@ Fsed "#!/bin/sh" "#!/bin/ash" 
${DIRTEMP}/work/initramfs/etc/modules.sh
#####################################################################

good_msg 'create static binary'
-build_Static

-good_msg "Install lvm to initramfs"
-cp ${DESTBUILD}/lvm/sbin/lvm.static $DIRTEMP/work/initramfs/bin/lvm ||
-       die_msg "couldn't install lvm to initramfs !"
-cp ${DESTBUILD}/lvm/sbin/dmsetup.static $DIRTEMP/work/initramfs/bin/dmsetup ||
-       die_msg "couldn't install device-mapper to initramfs !"
-good_msg "Install mdadm to initramfs"
-cp ${DESTBUILD}/mdadm/sbin/mdadm $DIRTEMP/work/initramfs/sbin/mdadm ||
-       die_msg "couldn't install mdadm to initramfs !"
+build_Static
+if [ $ENABLELVM -eq 1 ]
+then
+       good_msg "Install lvm to initramfs"
+       cp ${DESTBUILD}/lvm/sbin/lvm.static $DIRTEMP/work/initramfs/bin/lvm ||
+               die_msg "couldn't install lvm to initramfs !"
+       cp ${DESTBUILD}/lvm/sbin/dmsetup.static 
$DIRTEMP/work/initramfs/bin/dmsetup ||
+               die_msg "couldn't install device-mapper to initramfs !"
+       good_msg "Install mdadm to initramfs"
+fi
+if [ $ENABLEMDAM -eq 1 ]
+then
+       cp ${DESTBUILD}/mdadm/sbin/mdadm $DIRTEMP/work/initramfs/sbin/mdadm ||
+               die_msg "couldn't install mdadm to initramfs !"
+fi
good_msg "Install busybox to initramfs"
cp -R ${DESTBUILD}/busybox/* $DIRTEMP/work/initramfs/ ||
die_msg "couldn't install busybox to initramfs !"
diff --git a/create_static.sh b/create_static.sh
index 3cfb103..a60c83d 100644
--- a/create_static.sh
+++ b/create_static.sh
@@ -176,16 +176,20 @@ build_Static() {
LOGFILE=${DESTBUILD}/log.txt
good_msg "log can be find into ${LOGFILE}"
good_msg "build static into ${DESTBUILD}"
-       Build_Lvm2
-       Build_Mdadm
+       if [ $ENABLELVM -eq 1 ]
+       then
+               Build_Lvm2
+       fi
+       if [ $ENABLEMDAM -eq 1 ]
+       then
+               Build_Mdadm
+       fi
Build_Busybox
}

-op=$1
-shift

-if [ "$op" != "" ]; then
-       DESTBUILD=$op
+if [ "$DIRSTATIC" != "" ]; then
+       DESTBUILD=$DIRSTATIC
build_Static
fi

diff --git a/default.sh b/default.sh
index 864ad80..dfeaa41 100644
--- a/default.sh
+++ b/default.sh
@@ -12,3 +12,6 @@
DIRTEMP=/tmp/init/
KV=`uname -r`
DESTBUILD=$HOMESOURCE/static
+ENABLELVM=1
+ENABLEMDAM=1
+DIRSTATIC=""
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to