88a664e148
git-svn-id: http://svn.sabayonlinux.org/overlay@1949 d7aec97c-591d-0410-af39-a8856400b30a
120 lines
3.4 KiB
Diff
120 lines
3.4 KiB
Diff
diff -Nurp genkernel-3.4.9.orig/generic/initrd.scripts genkernel-3.4.9/generic/initrd.scripts
|
|
--- genkernel-3.4.9.orig/generic/initrd.scripts 2008-02-03 13:14:20.000000000 +0000
|
|
+++ genkernel-3.4.9/generic/initrd.scripts 2008-02-03 13:15:16.000000000 +0000
|
|
@@ -207,6 +207,13 @@ union_setup_dir() {
|
|
fi
|
|
}
|
|
|
|
+aufs_setup_dir() {
|
|
+ mount -t aufs -o br=$OVERLAY:$2 none $1
|
|
+ if [ "$?" -eq '0' ]; then
|
|
+ good_msg "Addition of $2 to $OVERLAY merged into $1"
|
|
+ fi
|
|
+}
|
|
+
|
|
findnfsmount() {
|
|
|
|
if [ "${IP}" != '' ] || busybox udhcpc -R rootpath -n -s /bin/udhcpc.scripts
|
|
@@ -928,6 +935,20 @@ rundebugshell() {
|
|
fi
|
|
}
|
|
|
|
+setup_aufs() {
|
|
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
+ then
|
|
+ # Directory used for rw changes in union mount filesystem
|
|
+ UNION=/aufs
|
|
+ OVERLAY=/overlay
|
|
+ mkdir -p ${UNION}
|
|
+ mkdir -p ${OVERLAY}
|
|
+ mount -t tmpfs none ${OVERLAY}
|
|
+ good_msg "Loading aufs module (if module)"
|
|
+ modprobe aufs > /dev/null 2>&1
|
|
+ fi
|
|
+}
|
|
+
|
|
setup_unionfs() {
|
|
if [ "${USE_UNIONFS_NORMAL}" = '1' ]
|
|
then
|
|
diff -Nurp genkernel-3.4.9.orig/generic/linuxrc genkernel-3.4.9/generic/linuxrc
|
|
--- genkernel-3.4.9.orig/generic/linuxrc 2008-02-03 13:14:20.000000000 +0000
|
|
+++ genkernel-3.4.9/generic/linuxrc 2008-02-03 13:18:28.000000000 +0000
|
|
@@ -84,6 +84,9 @@ do
|
|
unionfs)
|
|
USE_UNIONFS_NORMAL=1
|
|
;;
|
|
+ aufs)
|
|
+ USE_AUFS_NORMAL=1
|
|
+ ;;
|
|
unionfs\=*)
|
|
USE_UNIONFS_NORMAL=1
|
|
CMD_UNIONFS=`parse_opt "${x}"`
|
|
@@ -252,11 +255,12 @@ then
|
|
startLUKS
|
|
fi
|
|
|
|
-# Set up unionfs
|
|
+# Set up unionfs or aufs
|
|
mkdir -p ${NEW_ROOT}
|
|
setup_unionfs
|
|
+setup_aufs
|
|
|
|
-if [ "${USE_UNIONFS_NORMAL}" = '1' ]
|
|
+if [ "${USE_UNIONFS_NORMAL}" -eq '1' ] || [ "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
then
|
|
CHROOT=${UNION}
|
|
else
|
|
@@ -276,7 +280,7 @@ fi
|
|
|
|
if [ "${CDROOT}" = '1' ]
|
|
then
|
|
- if [ ! "${USE_UNIONFS_NORMAL}" = '1' ]
|
|
+ if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ] && [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
then
|
|
good_msg "Making tmpfs for ${NEW_ROOT}"
|
|
mount -t tmpfs tmpfs ${NEW_ROOT}
|
|
@@ -610,6 +614,22 @@ then
|
|
mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
|
|
fi
|
|
|
|
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
+ then
|
|
+ aufs_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
|
|
+
|
|
+ mkdir -p ${UNION}/mnt/livecd
|
|
+ if [ ! -e "${UNION}/mnt/cdrom" ]; then
|
|
+ mkdir ${UNION}/mnt/cdrom -p
|
|
+ fi
|
|
+ mount --bind ${NEW_ROOT}/${FS_LOCATION} ${UNION}/mnt/livecd
|
|
+ mount --bind ${NEW_ROOT}/mnt/cdrom ${UNION}/mnt/cdrom
|
|
+
|
|
+ # Make sure fstab notes livecd is mounted ro. Makes system skip remount which fails on aufs dirs.
|
|
+ sed -e 's|\(.*\s/\s*tmpfs\s*\)defaults\(.*\)|\1defaults,ro\2|' /${UNION}/etc/fstab > /${UNION}/etc/fstab.new
|
|
+ mv /${UNION}/etc/fstab.new /${UNION}/etc/fstab
|
|
+ fi
|
|
+
|
|
# Unpacking additional packages from NFS mount
|
|
# This is useful for adding kernel modules to /lib
|
|
# We do this now, so that additional packages can add whereever they want.
|
|
@@ -627,7 +647,7 @@ then
|
|
fi
|
|
|
|
|
|
- if [ "${USE_UNIONFS_NORMAL}" != '1' ]
|
|
+ if [ ! "${USE_UNIONFS_NORMAL}" -eq '1' ] && [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
then
|
|
good_msg "Copying read-write image contents to tmpfs"
|
|
# Copy over stuff that should be writable
|
|
@@ -710,6 +730,11 @@ else
|
|
union_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
|
|
mkdir -p ${UNION}/tmp/.initrd
|
|
fi
|
|
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
|
|
+ then
|
|
+ aufs_setup_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
|
|
+ mkdir -p ${UNION}/tmp/.initrd
|
|
+ fi
|
|
fi
|
|
|
|
# Execute script on the cdrom just before boot to update things if necessary
|