genkernel: here are a few of my attempts to forward port our aufs support to a recent genkernel, all fail

This commit is contained in:
Zero_Chaos 2012-05-07 05:47:27 +00:00
parent a086aa6638
commit a7633712dc
8 changed files with 2125 additions and 0 deletions

View file

@ -1,13 +1,29 @@
AUX aufs-correct.diff 16362 RMD160 e5b32c95ffcac55e1a3b2803bd78b7431cf20e9a SHA1 6cccf26e62e6cf4b9829297fc0e128fa30c3935c SHA256 2755c721bb91107d986df78050137383fe0f1fd04277acb3865184093cf7c08b
AUX aufs-new.diff 16771 RMD160 503ab2da8bb8c05543734650a4c85e1eeb4fc8dc SHA1 fd73a10f6181d6e2edc8e6a970a52788062316f3 SHA256 9ec8610c5f5085add6f5fef27c50d3b5b50a7d57232f9f8079cb37cd3632f556
AUX aufs.diff 18177 RMD160 1ec49753853ec6f656c2a484a32223cd0ae58ba8 SHA1 3bdb6e5d652742c3e735be88c560e786a32aa1ed SHA256 39288c4d53614f4b4ca451de4c4ad376f1e8377ea8909424a1d82f04dbe999d1
AUX genkernel.bash 2438 RMD160 b3d8e4436d8768c07d18c5aaff9c14fc16641729 SHA1 e15a9c6ef506aa6872a6a97d26751246dedded04 SHA256 e7de9771ba79ef878e2c9a21a1c1720f092c6047d3cc7d4a49ff6b90e7e2c248
AUX initramfs.mounts 816 RMD160 a627d7f31ee919dc30057a1768c493229ada877f SHA1 3781d2eeb72ef0eb6b1e545d51545047e990faa1 SHA256 57ba8450e3f09edc9a4e5a1be15d49c77e4e014e27c626e9e3771167cbb54e49
DIST LVM2.2.02.74.tgz 943084 RMD160 e5cb2a9e304c4075f05aecd03d67aa53eda9e43e SHA1 fc6cd04e4a908906c6f596ad99948140728be99c SHA256 a40c80c5b9a2547b8bd63e9321d7037c8bf041a35f734a5766ad2848d80bb697
DIST LVM2.2.02.88.tgz 1029151 RMD160 a5918c6dfef8300b8ad9ab53e913ab487a051436 SHA1 05a4fb09cb5e3d680ad1b268c941968853fb1979 SHA256 a129d1d3949524da7d6d2a67218254baea02df06a6744faa5808a4182b2fb432
DIST busybox-1.18.1.tar.bz2 2129404 RMD160 fb40d19103945eb1cd785a6041e5545f4055b8f6 SHA1 83b86858599870e46236da8d370d335d48cee77e SHA256 33eb25ea7b20c727c3af769256b21408a1ac1f927ff9f89a1f1e3767c18c9967
DIST busybox-1.19.3.tar.bz2 2167188 RMD160 f8df020b47a363b1b308e852d2034758e42d16a9 SHA1 692754db46b129c70921ffb84eaef679061c0952 SHA256 a1a9a35732c719ef384f02b6e357c324d8be25bc154af91a48c4264b1e6038f0
DIST device-mapper.1.02.22.tgz 189726 RMD160 8bf9986536c49f53c398d6a2180e21e1235bea18 SHA1 a4533872c32951a1b549bb9207a13b7e4dae0701 SHA256 ff833a6cd6246686f5b3f5692fd6597f1ffbc60f08929e5fe68304cdafb61595
DIST dmraid-1.0.0.rc14.tar.bz2 164234 RMD160 9cd238a981cfef9c5c1f2f1d6466b70c95ec9c7c SHA1 2b3284db46a995967d88993ae5ae36b57c513bc4 SHA256 a777354d6d69a9b58d84966cc7b37bc3f5c89539f885ad25fd874ed1c388fbec
DIST dmraid-1.0.0.rc16-3.tar.bz2 232743 RMD160 b661f5c465a11a4dcbb17db6b6632b32bcb7b723 SHA1 162b6173b91a0121a52402d2ed939b43d74ff605 SHA256 93421bd169d71ff5e7d2db95b62b030bfa205a12010b6468dcdef80337d6fbd8
DIST e2fsprogs-1.41.14.tar.gz 4512157 RMD160 bdd22a93f57de1145007bffd6fc45323098e27e8 SHA1 24f9364fa3d4c0d7d00cb627b819d0e51055d6c5 SHA256 3f8ac1fedd7c4bec480afcbe4acabdd4ac59ec0446a0fd50c8975cd0aad7b176
DIST e2fsprogs-1.42.tar.gz 5709827 RMD160 91136a82c35f86f54f6573f9788d32da66b972cb SHA1 e69bc63bc319e4d1e4242cc278bfd442a60646e6 SHA256 55b46db0cec3e2eb0e5de14494a88b01ff6c0500edf8ca8927cad6da7b5e4a46
DIST fuse-2.7.4.tar.gz 506658 RMD160 fe1808cfd58ad6651259245b424301e99881faa2 SHA1 7a86f5cf39f38e64ccbae093599d64a895b950ba SHA256 c8b070ece5d4e09bd06eea6c28818c718f803d93a4b85bacb9982deb8ded49e6
DIST fuse-2.8.6.tar.gz 505334 RMD160 df66df0256a677c50f2fc94fef6f34b2d598386c SHA1 c2c0f9fff8bfee217da200888123e5abb5b498f2 SHA256 1ec1913e38f09b2a9ec1579e1800805b5e2c747d1dce515e316dbb665ca139d6
DIST genkernel-3.4.24.tar.bz2 211436 RMD160 3d29afb7c7bfac64e9cd09f1213fa5913de36643 SHA1 61629d89379b20b6b788c4c88153d6fe294ed657 SHA256 55611c867f1dc96c8711faabb8c17f62b1c5f8be27eb423e39fd53846552476c
DIST genkernel-3.4.30.tar.bz2 210819 RMD160 c510bc13543ef2a96a151031d95caae41155afb2 SHA1 1d6429f2d1f2f031cdd09445c049bfda930993de SHA256 9c3d2ffac09c3e6043452daf325fc059f8f7eb774e4ea7af4d6d1d749bb7f74a
DIST gnupg-1.4.11.tar.bz2 3407075 RMD160 9daf2dedfd4c6211fc13b8cdee8f08b8f5925378 SHA1 78e22f5cca88514ee71034aafff539c33f3c6676 SHA256 d18ceeac16e554a501170b9bfde611625252d0fe9448685a69c93bf149ee6ef6
DIST mdadm-3.1.4.tar.bz2 288578 RMD160 f41a2be4158efac08dbe2e95f1c6812609475fad SHA1 4ee43922d38b15a930daaaa026ef1b4efacdbc8a SHA256 849ad0ad4ad3c1d2d8806a16b30e1f59ab2daf313cb103807207f7cba889ea63
DIST mdadm-3.1.5.tar.bz2 292709 RMD160 e0542c4556988cae551b3399f0f0d27e42b68bda SHA1 e71859f16e1184df2c033a9e24a6f3f262bbf9a5 SHA256 1d547d0b36a88968e9fc9fb08b0e64de54a53f3d1cfa3656a9f319180f0727d3
DIST open-iscsi-2.0-872.tar.gz 900081 RMD160 4eacb8a94cf7712f936b52a961fa7f11774dde67 SHA1 96880185791177ba7b8970742572b46ebfe901cd SHA256 37753697a170223ac02a292b3a23a315a3c747b490c42480e4057b676c9f8d4f
DIST unionfs-fuse-0.22.tar.bz2 27355 RMD160 f29cbf41af0ba8f2181ac565a6663871676f6488 SHA1 e95799923ee3938e1fb44c6fd9aa7154d720063e SHA256 fa0c494a8ce63f235601fcc35e3a96527831169d6d5921ee49faccf3b25feb78
DIST unionfs-fuse-0.24.tar.bz2 30381 RMD160 27934c23472f6e9d71e622f13aa9fd51a1f8018e SHA1 26f281e4e5f1e82194b430956b94cd7745d5bd97 SHA256 d8abc855eb618ac356b1e716599c82f8f0f74dbaee36d4062edc707567121937
EBUILD genkernel-3.4.24.ebuild 5299 RMD160 ccea52b69caca68a079946fe44ab3b3197dab81c SHA1 1f65713df4373024ecc95ee3a2508fa8d86b08d8 SHA256 2b2b5905cfdfdc61bf741b57c44fd721e29b64ca079455c689561fa44d4e354c
EBUILD genkernel-3.4.30.ebuild 5656 RMD160 b6b39f6a463a0c8a6f434e3a9d33f6cf73477a1e SHA1 0e7e196cc04fbc5fee33c47051f6e8bc829b214b SHA256 f0a74173521d7ff018ca7789f2112eeb8ae0c65a852339548cb0543d6b6c869a
EBUILD genkernel-9999.2540.ebuild 5009 RMD160 bf510823f1aa9118d38d2672bcf4075d06260d23 SHA1 4b08734c9208734b9abdf0b34218bebfeb9cdc46 SHA256 54e051c18952c325edb2432a0eceaa5472e2209afd442f198eec47109e1d50f6
EBUILD genkernel-9999.2998.ebuild 5009 RMD160 c9fc630b0ebe76dda415463bd0bab0f51a9b5efd SHA1 500bf742be83286cb0c56676e6219d72ff2eaa24 SHA256 9d33c03cd3d32f34620e2a36c3d0e11416fe40da9b3e081e15ffcc3429289bfd
EBUILD genkernel-9999.ebuild 5009 RMD160 bf510823f1aa9118d38d2672bcf4075d06260d23 SHA1 4b08734c9208734b9abdf0b34218bebfeb9cdc46 SHA256 54e051c18952c325edb2432a0eceaa5472e2209afd442f198eec47109e1d50f6

View file

@ -0,0 +1,520 @@
diff -Naur genkernel-3.4.30/defaults/initrd.defaults genkernel/defaults/initrd.defaults
--- genkernel-3.4.30/defaults/initrd.defaults 2012-05-06 22:28:21.592425271 -0400
+++ genkernel/defaults/initrd.defaults 2012-05-06 22:29:10.618426583 -0400
@@ -73,6 +73,7 @@
NEW_ROOT='/newroot'
CDROOT_PATH='/mnt/cdrom'
CONSOLE='/dev/console'
+MODULESD="${CDROOT_PATH}"
LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
diff -Naur genkernel-3.4.30/defaults/initrd.scripts genkernel/defaults/initrd.scripts
--- genkernel-3.4.30/defaults/initrd.scripts 2012-05-06 22:28:21.594425271 -0400
+++ genkernel/defaults/initrd.scripts 2012-05-06 22:29:10.619426583 -0400
@@ -207,6 +207,192 @@
[ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
}
+# Insert a directory tree $2 to an union specified by $1
+# Top-level read-write branch is specified by it's index 0
+# $1 = union absolute path (starting with /)
+# $2 = path to data directory
+#
+union_insert_dir() {
+ # Always mount it over the precedent (add:1:)
+ mount -n -o remount,add:1:$2=rr aufs $1
+ if [ $? = '0' ]
+ then
+ good_msg "Addition of $2 to $1 successful"
+ fi
+}
+
+# Insert all modules found in $1, usually mnt/cdrom
+# added to allow users to add their own apps.
+union_insert_modules() {
+ for module in `ls ${NEW_ROOT}/$1/modules/*.mo 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
+ done
+ for module in `ls ${NEW_ROOT}/$1/modules/*.lzm 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .lzm`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .lzm`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .lzm`
+ done
+}
+
+# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
+create_changefs() {
+ local size
+ while [ 1 ]
+ do
+ read -p '<< Size of file (Enter for default 256 Mb): ' size
+ if [ -z "$size" ]; then
+ let size=256
+ fi
+ let size="$size"
+ if [ $size -lt 16 ]
+ then
+ bad_msg "Please give a size of at least 16 Mb"
+ else
+ dd if=/dev/zero of=$CHANGESMNT/livecd.aufs bs=1M count=$size
+ if [ $? = '0' ]
+ then
+ good_msg "Creation of livecd.aufs, $size Mb on $CHANGESDEV successful, formatting it ext2"
+ mke2fs -F $CHANGESMNT/livecd.aufs
+ break
+ else
+ rm -f $CHANGESMNT/livecd.aufs
+ bad_msg "Unable to create livecd.aufs on $CHANGESDEV of $size Mb"
+ bad_msg "Please give a size of at least 16 Mb"
+ bad_msg "Also check if your disk is full or read-only ?"
+ read -p '<< Type "a" to abort, anything else to continue : ' doabort
+ if [ "$doabort" = "a" ]; then
+ return 1
+ fi
+ fi
+ fi
+ done
+ return 0
+}
+
+setup_aufs() {
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ # Directory used for rw changes in union mount filesystem
+ UNION=/union
+ MEMORY=/memory
+ # Mountpoint for the changesdev
+ CHANGESMNT=$NEW_ROOT/mnt/changesdev
+ if [ -z "$UID" ]
+ then
+ CHANGES=$MEMORY/aufs_changes/default
+ else
+ CHANGES=$MEMORY/aufs_changes/$UID
+ fi
+
+ mkdir -p ${MEMORY}
+ mkdir -p ${UNION}
+ mkdir -p ${CHANGESMNT}
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+
+ bootstrapCD
+ if [ -n "${AUFS}" ]
+ then
+ if [ "${AUFS}" = "detect" ]
+ then
+ CHANGESMNT="${NEW_ROOT}/mnt/cdrom"
+ CHANGESDEV=${REAL_ROOT}
+ else
+ CHANGESDEV=${AUFS}
+ good_msg "mounting $CHANGESDEV to $MEMORY for aufs support"
+ # mount -t auto $CHANGESDEV $MEMORY
+ mount -t auto $CHANGESDEV $CHANGESMNT
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ unset AUFS
+ fi
+ fi
+ # Check and attempt to create the changesfile
+ if [ ! -e $CHANGESMNT/livecd.aufs ] && [ -n "${AUFS}" ]
+ then
+ create_changefs
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ elif [ -n "${AUFS}" ]
+ then
+ local nbpass=0
+ while [ 1 ]
+ do
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ if [ $nbpass -eq 0 ]
+ then
+ bad_msg "mounting of changes file failed, Running e2fsck"
+ e2fsck $CHANGESMNT/livecd.aufs
+ nbpass=$(($nbpass + 1))
+ else
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ bad_msg "your livecd.aufs might be messed up, and I couldn't fix it"
+ bad_msg "moving livecd.aufs to livecd.aufs.bad"
+ mv $CHANGESMNT/livecd.aufs $CHANGESMNT/livecd.aufs.bad
+ bad_msg "try to fix it yourself with e2fsck later on, sorry for disturbing"
+ break
+ fi
+ else
+ if [ $nbpass -eq 1 ]
+ then
+ good_msg "e2fsck seemed successful. Please check your files after bootup"
+ fi
+ break
+ fi
+ done
+ if [ -f ${MEMORY}/.doclean.sh ]
+ then
+ good_msg "finishing the permanent changes cleanup"
+ . ${MEMORY}/.doclean.sh
+ rm ${MEMORY}/.doclean.sh
+ fi
+ fi
+ # mount tmpfs only in the case when changes= boot parameter was
+ # empty or we were not able to mount the storage device
+ if [ "${CDROOT}" -eq '1' -a ! -f ${CHANGESMNT}/livecd.aufs ]
+ then
+ umount $MEMORY
+ bad_msg "failed to find livecd.aufs file on $CHANGESDEV"
+ bad_msg "create an ext2 livecd.aufs file on this device if you wish to use it for aufs"
+ bad_msg "falling back to ramdisk based aufs for safety"
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ else
+ XINO=$MEMORY/xino
+ mkdir -p $XINO
+ mount -t tmpfs tmpfs $XINO
+ fi
+ else
+ good_msg "Mounting ramdisk to $MEMORY for aufs support..."
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ fi
+
+ mkdir -p $CHANGES
+ mount -t aufs -n -o nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs ${UNION}
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "Can't setup union ${UNION} in directory!"
+ USE_AUFS_NORMAL=0
+ fi
+ else
+ USE_AUFS_NORMAL=0
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
then
diff -Naur genkernel-3.4.30/defaults/linuxrc genkernel/defaults/linuxrc
--- genkernel-3.4.30/defaults/linuxrc 2012-05-06 22:28:21.592425271 -0400
+++ genkernel/defaults/linuxrc 2012-05-06 22:52:33.523464151 -0400
@@ -228,6 +228,38 @@
aufs)
USE_AUFS_NORMAL=1
;;
+ aufs\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ changes\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ persistent)
+ USE_AUFS_NORMAL=1
+ AUFS="detect"
+ ;;
+ # Allow user to specify the modules location
+ modules\=*)
+ MODULESD=`parse_opt "${x}"`
+ ;;
unionfs)
if [ ! -x /sbin/unionfs ]
then
@@ -382,17 +414,28 @@
if [ "${CDROOT}" = '1' ]
then
- good_msg "Making tmpfs for ${NEW_ROOT}"
- mount -n -t tmpfs tmpfs "${NEW_ROOT}"
+ setup_aufs
+ setup_keymap
- for i in dev mnt mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
- do
- mkdir -p "${NEW_ROOT}/${i}"
- chmod 755 "${NEW_ROOT}/${i}"
- done
- [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
- [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
- [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ # Run debug shell if requested
+ rundebugshell
+
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ CHROOT=${UNION}
+ else
+ CHROOT=${NEW_ROOT}
+ good_msg "Making tmpfs for ${NEW_ROOT}"
+ mount -t tmpfs tmpfs ${NEW_ROOT}
+
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ fi
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]
@@ -408,7 +451,7 @@
[ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
+ if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${USE_AUFS_NORMAL}" != '1' ]
then
bootstrapCD
fi
@@ -709,7 +752,23 @@
fi
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+ # 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
+ warn_msg "Adding all modules in $MODULESD/modules/"
+ if [ "${MODULESD}" = "mnt/cdrom" ]
+ then
+ union_insert_modules mnt/cdrom
+ else
+ mkdir ${NEW_ROOT}/mnt/modulesd
+ mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
+ union_insert_modules ${NEW_ROOT}/mnt/modulesd
+ fi
+ fi
# Unpacking additional packages from NFS mount
# This is useful for adding kernel modules to /lib
@@ -732,57 +791,56 @@
then
setup_unionfs ${NEW_ROOT} /${FS_LOCATION}
CHROOT=/union
- elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
-
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}") || {
- bad_msg "Copying failed, dropping into a shell."
- do_rundebugshell
- }
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
+ else
+ #XXX this hunk confuses me more than a little and needs to be rewritten sanely
+ if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
- ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
- # Strip the prefix of the FS_LOCATION
- directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+ good_msg "Copying read-write image contents to tmpfs"
+ # Copy over stuff that should be writable
+ (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
- # Skip this directory if we already linked a parent directory
- if [ "${current_parent}" != '' ]; then
- var=$(echo "${directory}" | grep "^${current_parent}")
- if [ "${var}" != '' ]; then
- continue
- fi
- fi
- # Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
+ # Now we do the links.
+ for x in ${ROOT_LINKS}
+ do
+ if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
then
- # It does exist, link all the individual files
- for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory})
+ ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
+ else
+ # List all subdirectories of x
+ find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
do
- if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
- ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ # Strip the prefix of the FS_LOCATION
+ directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+
+ # Skip this directory if we already linked a parent directory
+ if [ "${current_parent}" != '' ]; then
+ var=`echo "${directory}" | grep "^${current_parent}"`
+ if [ "${var}" != '' ]; then
+ continue
+ fi
+ fi
+ # Test if the directory exists already
+ if [ -e "/${NEW_ROOT}/${directory}" ]
+ then
+ # It does exist, link all the individual files
+ for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
+ do
+ if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
+ ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ fi
+ done
+ else
+ # It does not exist, make a link to the livecd
+ ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
+ current_parent="${directory}"
fi
done
- else
- # It does not exist, make a link to the livecd
- ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
- current_parent="${directory}"
fi
done
+ mkdir initramfs proc tmp sys 2>/dev/null
+ chmod 1777 tmp
fi
- done
-
- mkdir initramfs proc tmp sys 2>/dev/null
- chmod 1777 tmp
-
+ #XXX: end extremely confusing hunk
fi
#UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||')
@@ -803,13 +861,18 @@
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Mount the additional things as required by udev & systemd
if [ -f ${NEW_ROOT}/etc/initramfs.mounts ]; then
fslist=$(get_mounts_list)
else
- fslist="/usr"
+ fslist="/usr"
fi
for fs in $fslist; do
@@ -842,6 +905,35 @@
verbose_kmsg
+if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+then
+ mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
+ mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!'
+ for i in tmp var/tmp mnt/gentoo mnt/livecd
+ do
+ mkdir -p ${CHROOT}/$i
+ chmod 755 ${CHROOT}/$i
+ done
+ # This will prevent from putting junk on the CHANGESDEV
+ mkdir -p ${CHROOT}/usr/portage/distfiles
+ mount -t tmpfs tmpfs ${CHROOT}/var/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles
+ warn_msg "/tmp /var/tmp /usr/portage/distfiles are mounted in ram"
+ warn_msg "consider saving important files elsewhere..."
+ read -t 3 UNUSEDVAL
+ mount -o bind ${NEW_ROOT}/mnt/cdrom ${CHROOT}/mnt/cdrom
+ mount -o bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd
+ if [ -e $MEMORY/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ cp $MEMORY/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ mkdir -p ${NEW_ROOT}/etc/sysconfig/
+ cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ fi
+fi
+
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
cd "${CHROOT}"
diff -Naur genkernel-3.4.30/gen_initramfs.sh genkernel/gen_initramfs.sh
--- genkernel-3.4.30/gen_initramfs.sh 2012-05-06 22:28:21.596425271 -0400
+++ genkernel/gen_initramfs.sh 2012-05-06 22:29:10.619426583 -0400
@@ -99,6 +99,24 @@
rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
}
+# Used to add e2fs file making inside initramfs for aufs changes saving
+append_e2fstools(){
+ if [ -d "${TEMP}/initramfs-e2fsprogs-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-e2fsprogs-temp/"
+ fi
+ print_info 1 'E2FSTOOLS: Adding support (compiling binaries)...'
+ # Using different name for blkid compatibility
+ compile_e2fstools
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-e2fsprogs-temp/"
+ /bin/tar -jxpf "${E2FSPROGS_BINCACHE}" -C "${TEMP}/initramfs-e2fsprogs-temp/" ||
+ gen_die "Could not extract e2fsprogs binary cache!"
+ cd "${TEMP}/initramfs-e2fsprogs-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+ rm -rf "${TEMP}/initramfs-e2fsprogs-temp" > /dev/null
+}
+
append_blkid(){
if [ -d "${TEMP}/initramfs-blkid-temp" ]
then
@@ -544,6 +562,7 @@
rm -r "${TEMP}/initramfs-aux-temp/"
fi
mkdir -p "${TEMP}/initramfs-aux-temp/etc"
+ mkdir -p "${TEMP}/initramfs-aux-temp/bin"
mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
if [ -f "${CMD_LINUXRC}" ]
then
@@ -660,6 +679,7 @@
append_data 'base_layout'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
+ append_data 'e2fstools'
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
append_data 'iscsi' "${ISCSI}"

View file

@ -0,0 +1,520 @@
diff -Naur genkernel-orig/defaults/initrd.defaults genkernel/defaults/initrd.defaults
--- genkernel-orig/defaults/initrd.defaults 2012-05-05 22:03:33.670071698 -0400
+++ genkernel/defaults/initrd.defaults 2012-05-05 23:32:20.558214466 -0400
@@ -73,6 +73,7 @@
NEW_ROOT='/newroot'
CDROOT_PATH='/mnt/cdrom'
CONSOLE='/dev/console'
+MODULESD="${CDROOT_PATH}"
LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
diff -Naur genkernel-orig/defaults/initrd.scripts genkernel/defaults/initrd.scripts
--- genkernel-orig/defaults/initrd.scripts 2012-05-05 22:03:33.670071698 -0400
+++ genkernel/defaults/initrd.scripts 2012-05-05 22:58:33.661160192 -0400
@@ -201,6 +201,192 @@
[ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
}
+# Insert a directory tree $2 to an union specified by $1
+# Top-level read-write branch is specified by it's index 0
+# $1 = union absolute path (starting with /)
+# $2 = path to data directory
+#
+union_insert_dir() {
+ # Always mount it over the precedent (add:1:)
+ mount -n -o remount,add:1:$2=rr aufs $1
+ if [ $? = '0' ]
+ then
+ good_msg "Addition of $2 to $1 successful"
+ fi
+}
+
+# Insert all modules found in $1, usually mnt/cdrom
+# added to allow users to add their own apps.
+union_insert_modules() {
+ for module in `ls ${NEW_ROOT}/$1/modules/*.mo 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
+ done
+ for module in `ls ${NEW_ROOT}/$1/modules/*.lzm 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .lzm`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .lzm`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .lzm`
+ done
+}
+
+# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
+create_changefs() {
+ local size
+ while [ 1 ]
+ do
+ read -p '<< Size of file (Enter for default 256 Mb): ' size
+ if [ -z "$size" ]; then
+ let size=256
+ fi
+ let size="$size"
+ if [ $size -lt 16 ]
+ then
+ bad_msg "Please give a size of at least 16 Mb"
+ else
+ dd if=/dev/zero of=$CHANGESMNT/livecd.aufs bs=1M count=$size
+ if [ $? = '0' ]
+ then
+ good_msg "Creation of livecd.aufs, $size Mb on $CHANGESDEV successful, formatting it ext2"
+ mke2fs -F $CHANGESMNT/livecd.aufs
+ break
+ else
+ rm -f $CHANGESMNT/livecd.aufs
+ bad_msg "Unable to create livecd.aufs on $CHANGESDEV of $size Mb"
+ bad_msg "Please give a size of at least 16 Mb"
+ bad_msg "Also check if your disk is full or read-only ?"
+ read -p '<< Type "a" to abort, anything else to continue : ' doabort
+ if [ "$doabort" = "a" ]; then
+ return 1
+ fi
+ fi
+ fi
+ done
+ return 0
+}
+
+setup_aufs() {
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ # Directory used for rw changes in union mount filesystem
+ UNION=/union
+ MEMORY=/memory
+ # Mountpoint for the changesdev
+ CHANGESMNT=$NEW_ROOT/mnt/changesdev
+ if [ -z "$UID" ]
+ then
+ CHANGES=$MEMORY/aufs_changes/default
+ else
+ CHANGES=$MEMORY/aufs_changes/$UID
+ fi
+
+ mkdir -p ${MEMORY}
+ mkdir -p ${UNION}
+ mkdir -p ${CHANGESMNT}
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+
+ bootstrapCD
+ if [ -n "${AUFS}" ]
+ then
+ if [ "${AUFS}" = "detect" ]
+ then
+ CHANGESMNT="${NEW_ROOT}/mnt/cdrom"
+ CHANGESDEV=${REAL_ROOT}
+ else
+ CHANGESDEV=${AUFS}
+ good_msg "mounting $CHANGESDEV to $MEMORY for aufs support"
+ # mount -t auto $CHANGESDEV $MEMORY
+ mount -t auto $CHANGESDEV $CHANGESMNT
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ unset AUFS
+ fi
+ fi
+ # Check and attempt to create the changesfile
+ if [ ! -e $CHANGESMNT/livecd.aufs ] && [ -n "${AUFS}" ]
+ then
+ create_changefs
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ elif [ -n "${AUFS}" ]
+ then
+ local nbpass=0
+ while [ 1 ]
+ do
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ if [ $nbpass -eq 0 ]
+ then
+ bad_msg "mounting of changes file failed, Running e2fsck"
+ e2fsck $CHANGESMNT/livecd.aufs
+ nbpass=$(($nbpass + 1))
+ else
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ bad_msg "your livecd.aufs might be messed up, and I couldn't fix it"
+ bad_msg "moving livecd.aufs to livecd.aufs.bad"
+ mv $CHANGESMNT/livecd.aufs $CHANGESMNT/livecd.aufs.bad
+ bad_msg "try to fix it yourself with e2fsck later on, sorry for disturbing"
+ break
+ fi
+ else
+ if [ $nbpass -eq 1 ]
+ then
+ good_msg "e2fsck seemed successful. Please check your files after bootup"
+ fi
+ break
+ fi
+ done
+ if [ -f ${MEMORY}/.doclean.sh ]
+ then
+ good_msg "finishing the permanent changes cleanup"
+ . ${MEMORY}/.doclean.sh
+ rm ${MEMORY}/.doclean.sh
+ fi
+ fi
+ # mount tmpfs only in the case when changes= boot parameter was
+ # empty or we were not able to mount the storage device
+ if [ "${CDROOT}" -eq '1' -a ! -f ${CHANGESMNT}/livecd.aufs ]
+ then
+ umount $MEMORY
+ bad_msg "failed to find livecd.aufs file on $CHANGESDEV"
+ bad_msg "create an ext2 livecd.aufs file on this device if you wish to use it for aufs"
+ bad_msg "falling back to ramdisk based aufs for safety"
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ else
+ XINO=$MEMORY/xino
+ mkdir -p $XINO
+ mount -t tmpfs tmpfs $XINO
+ fi
+ else
+ good_msg "Mounting ramdisk to $MEMORY for aufs support..."
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ fi
+
+ mkdir -p $CHANGES
+ mount -t aufs -n -o nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs ${UNION}
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "Can't setup union ${UNION} in directory!"
+ USE_AUFS_NORMAL=0
+ fi
+ else
+ USE_AUFS_NORMAL=0
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
then
diff -Naur genkernel-orig/defaults/linuxrc genkernel/defaults/linuxrc
--- genkernel-orig/defaults/linuxrc 2012-05-05 22:03:33.670071698 -0400
+++ genkernel/defaults/linuxrc 2012-05-06 00:55:04.606347647 -0400
@@ -220,6 +220,38 @@
aufs)
USE_AUFS_NORMAL=1
;;
+ aufs\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ changes\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ persistent)
+ USE_AUFS_NORMAL=1
+ AUFS="detect"
+ ;;
+ # Allow user to specify the modules location
+ modules\=*)
+ MODULESD=`parse_opt "${x}"`
+ ;;
unionfs)
if [ ! -x /sbin/unionfs ]
then
@@ -346,17 +378,28 @@
if [ "${CDROOT}" = '1' ]
then
- good_msg "Making tmpfs for ${NEW_ROOT}"
- mount -n -t tmpfs tmpfs "${NEW_ROOT}"
+ setup_aufs
+ setup_keymap
- for i in dev mnt mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
- do
- mkdir -p "${NEW_ROOT}/${i}"
- chmod 755 "${NEW_ROOT}/${i}"
- done
- [ ! -d "${CDROOT_PATH}" ] && mkdir -p "${CDROOT_PATH}"
- [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
- [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ # Run debug shell if requested
+ rundebugshell
+
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ CHROOT=${UNION}
+ else
+ CHROOT=${NEW_ROOT}
+ good_msg "Making tmpfs for ${NEW_ROOT}"
+ mount -t tmpfs tmpfs ${NEW_ROOT}
+
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ fi
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]
@@ -372,7 +415,7 @@
[ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
+ if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${USE_AUFS_NORMAL}" != '1' ]
then
bootstrapCD
fi
@@ -608,7 +651,23 @@
fi
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+ # 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
+ warn_msg "Adding all modules in $MODULESD/modules/"
+ if [ "${MODULESD}" = "mnt/cdrom" ]
+ then
+ union_insert_modules mnt/cdrom
+ else
+ mkdir ${NEW_ROOT}/mnt/modulesd
+ mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
+ union_insert_modules ${NEW_ROOT}/mnt/modulesd
+ fi
+ fi
# Unpacking additional packages from NFS mount
# This is useful for adding kernel modules to /lib
@@ -632,53 +691,57 @@
setup_unionfs ${NEW_ROOT} /${FS_LOCATION}
CHROOT=/union
elif [ "${USE_AUFS_NORMAL}" != '1' ]; then
+ #XXX the above line was added after my fork and confuses the hell out of me as it seems to have no fi
+ #XXX this hunk confuses me more than a little and needs to be rewritten sanely
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
+ if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
- ln -s "$(readlink ${NEW_ROOT}/${FS_LOCATION}/${x})" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
- # Strip the prefix of the FS_LOCATION
- directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+ good_msg "Copying read-write image contents to tmpfs"
+ # Copy over stuff that should be writable
+ (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
- # Skip this directory if we already linked a parent directory
- if [ "${current_parent}" != '' ]; then
- var=$(echo "${directory}" | grep "^${current_parent}")
- if [ "${var}" != '' ]; then
- continue
- fi
- fi
- # Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
+ # Now we do the links.
+ for x in ${ROOT_LINKS}
+ do
+ if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
then
- # It does exist, link all the individual files
- for file in $(ls /${NEW_ROOT}/${FS_LOCATION}/${directory})
+ ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
+ else
+ # List all subdirectories of x
+ find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
do
- if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
- ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ # Strip the prefix of the FS_LOCATION
+ directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+
+ # Skip this directory if we already linked a parent directory
+ if [ "${current_parent}" != '' ]; then
+ var=`echo "${directory}" | grep "^${current_parent}"`
+ if [ "${var}" != '' ]; then
+ continue
+ fi
+ fi
+ # Test if the directory exists already
+ if [ -e "/${NEW_ROOT}/${directory}" ]
+ then
+ # It does exist, link all the individual files
+ for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
+ do
+ if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
+ ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ fi
+ done
+ else
+ # It does not exist, make a link to the livecd
+ ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
+ current_parent="${directory}"
fi
done
- else
- # It does not exist, make a link to the livecd
- ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
- current_parent="${directory}"
fi
done
+ mkdir initramfs proc tmp sys 2>/dev/null
+ chmod 1777 tmp
+#XXX: end extremely confusing hunk
fi
- done
-
- mkdir initramfs proc tmp sys 2>/dev/null
- chmod 1777 tmp
-
fi
#UML=$(cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||')
@@ -699,6 +762,11 @@
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
fi
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Mount the additional things as required by udev & systemd
@@ -734,6 +802,35 @@
verbose_kmsg
+if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+then
+ mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
+ mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!'
+ for i in tmp var/tmp mnt/gentoo mnt/livecd
+ do
+ mkdir -p ${CHROOT}/$i
+ chmod 755 ${CHROOT}/$i
+ done
+ # This will prevent from putting junk on the CHANGESDEV
+ mkdir -p ${CHROOT}/usr/portage/distfiles
+ mount -t tmpfs tmpfs ${CHROOT}/var/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles
+ warn_msg "/tmp /var/tmp /usr/portage/distfiles are mounted in ram"
+ warn_msg "consider saving important files elsewhere..."
+ read -t 3 UNUSEDVAL
+ mount -o bind ${NEW_ROOT}/mnt/cdrom ${CHROOT}/mnt/cdrom
+ mount -o bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd
+ if [ -e $MEMORY/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ cp $MEMORY/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ mkdir -p ${NEW_ROOT}/etc/sysconfig/
+ cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ fi
+fi
+
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
cd "${CHROOT}"
diff -Naur genkernel-orig/gen_initramfs.sh genkernel/gen_initramfs.sh
--- genkernel-orig/gen_initramfs.sh 2012-05-05 22:03:33.674071708 -0400
+++ genkernel/gen_initramfs.sh 2012-05-05 23:53:17.352248333 -0400
@@ -77,6 +77,24 @@
rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
}
+# Used to add e2fs file making inside initramfs for aufs changes saving
+append_e2fstools(){
+ if [ -d "${TEMP}/initramfs-e2fsprogs-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-e2fsprogs-temp/"
+ fi
+ print_info 1 'E2FSTOOLS: Adding support (compiling binaries)...'
+ # Using different name for blkid compatibility
+ compile_e2fstools
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-e2fsprogs-temp/"
+ /bin/tar -jxpf "${E2FSPROGS_BINCACHE}" -C "${TEMP}/initramfs-e2fsprogs-temp/" ||
+ gen_die "Could not extract e2fsprogs binary cache!"
+ cd "${TEMP}/initramfs-e2fsprogs-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+ rm -rf "${TEMP}/initramfs-e2fsprogs-temp" > /dev/null
+}
+
append_blkid(){
if [ -d "${TEMP}/initramfs-blkid-temp" ]
then
@@ -528,6 +546,7 @@
rm -r "${TEMP}/initramfs-aux-temp/"
fi
mkdir -p "${TEMP}/initramfs-aux-temp/etc"
+ mkdir -p "${TEMP}/initramfs-aux-temp/bin"
mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
if [ -f "${CMD_LINUXRC}" ]
then
@@ -641,6 +660,7 @@
append_data 'base_layout'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
+ append_data 'e2fstools'
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
append_data 'iscsi' "${ISCSI}"
diff -Naur genkernel-3.4.18/genkernel.conf trunk/genkernel.conf
--- genkernel-3.4.18/genkernel.conf 2012-03-24 23:23:39.479742473 -0400
+++ trunk/genkernel.conf 2011-10-16 21:32:05.000000000 -0400
@@ -229,6 +229,7 @@ XXX: seperate patch for this
E2FSPROGS_VER="VERSION_E2FSPROGS"
E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"
E2FSPROGS_SRCTAR="${DISTDIR}/e2fsprogs-${E2FSPROGS_VER}.tar.gz"
+E2FSPROGS_BINCACHE="%%CACHE%%/e2fsprogs-${E2FSPROGS_VER}-%%ARCH%%.bz2"
BLKID_BINCACHE="%%CACHE%%/blkid-${E2FSPROGS_VER}-%%ARCH%%.bz2"
FUSE_VER="VERSION_FUSE"

View file

@ -0,0 +1,572 @@
diff -Naur '--exclude=.svn' '--exclude=.git' genkernel-3.4.18/defaults/initrd.defaults pentoo/genkernel/trunk/defaults/initrd.defaults
--- genkernel-3.4.18/defaults/initrd.defaults 2012-03-24 23:23:39.476742487 -0400
+++ pentoo/genkernel/trunk/defaults/initrd.defaults 2011-10-16 21:32:06.000000000 -0400
@@ -72,6 +72,7 @@
CDROOT_TYPE='auto'
NEW_ROOT='/newroot'
CONSOLE='/dev/console'
+MODULESD="mnt/cdrom" #XXX sub CDROOT_PATH instead
LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop'
diff -Naur '--exclude=.svn' '--exclude=.git' genkernel-3.4.18/defaults/initrd.scripts pentoo/genkernel/trunk/defaults/initrd.scripts
--- genkernel-3.4.18/defaults/initrd.scripts 2012-03-24 23:23:39.476742487 -0400
+++ pentoo/genkernel/trunk/defaults/initrd.scripts 2012-02-03 00:03:57.395026177 -0500
@@ -215,6 +217,193 @@
[ ${ret} -eq 0 ] || bad_msg "Failed to mount /sys!"
}
+# Insert a directory tree $2 to an union specified by $1
+# Top-level read-write branch is specified by it's index 0
+# $1 = union absolute path (starting with /)
+# $2 = path to data directory
+#
+union_insert_dir() {
+ # Always mount it over the precedent (add:1:)
+ mount -n -o remount,add:1:$2=rr aufs $1
+ if [ $? = '0' ]
+ then
+ good_msg "Addition of $2 to $1 successful"
+ fi
+}
+
+# Insert all modules found in $1, usually mnt/cdrom
+# added to allow users to add their own apps.
+union_insert_modules() {
+ for module in `ls ${NEW_ROOT}/$1/modules/*.mo 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .mo`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .mo`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .mo`
+ done
+ for module in `ls ${NEW_ROOT}/$1/modules/*.lzm 2>/dev/null| sort`
+ do
+ mkdir -p ${MEMORY}/modules/`basename ${module} .lzm`
+ mount -o loop,ro ${module} ${MEMORY}/modules/`basename ${module} .lzm`
+ union_insert_dir $UNION ${MEMORY}/modules/`basename ${module} .lzm`
+ done
+}
+
+# Function to create an ext2 fs on $CHANGESDEV, $CHANGESMNT mountpoint
+create_changefs() {
+ local size
+ while [ 1 ]
+ do
+ read -p '<< Size of file (Enter for default 256 Mb): ' size
+ if [ -z "$size" ]; then
+ let size=256
+ fi
+ let size="$size"
+ if [ $size -lt 16 ]
+ then
+ bad_msg "Please give a size of at least 16 Mb"
+ else
+ dd if=/dev/zero of=$CHANGESMNT/livecd.aufs bs=1M count=$size
+ if [ $? = '0' ]
+ then
+ good_msg "Creation of livecd.aufs, $size Mb on $CHANGESDEV successful, formatting it ext2"
+ mke2fs -F $CHANGESMNT/livecd.aufs
+ break
+ else
+ rm -f $CHANGESMNT/livecd.aufs
+ bad_msg "Unable to create livecd.aufs on $CHANGESDEV of $size Mb"
+ bad_msg "Please give a size of at least 16 Mb"
+ bad_msg "Also check if your disk is full or read-only ?"
+ read -p '<< Type "a" to abort, anything else to continue : ' doabort
+ if [ "$doabort" = "a" ]; then
+ return 1
+ fi
+ fi
+ fi
+ done
+ return 0
+}
+
+setup_aufs() {
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ # Directory used for rw changes in union mount filesystem
+ UNION=/union
+ MEMORY=/memory
+ # Mountpoint for the changesdev
+ CHANGESMNT=$NEW_ROOT/mnt/changesdev
+ if [ -z "$UID" ]
+ then
+ CHANGES=$MEMORY/aufs_changes/default
+ else
+ CHANGES=$MEMORY/aufs_changes/$UID
+ fi
+
+ mkdir -p ${MEMORY}
+ mkdir -p ${UNION}
+ mkdir -p ${CHANGESMNT}
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+
+ bootstrapCD
+ if [ -n "${AUFS}" ]
+ then
+ if [ "${AUFS}" = "detect" ]
+ then
+ CHANGESMNT="${NEW_ROOT}/mnt/cdrom"
+ CHANGESDEV=${REAL_ROOT}
+ else
+ CHANGESDEV=${AUFS}
+ good_msg "mounting $CHANGESDEV to $MEMORY for aufs support"
+ # mount -t auto $CHANGESDEV $MEMORY
+ mount -t auto $CHANGESDEV $CHANGESMNT
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ unset AUFS
+ fi
+ fi
+ # Check and attempt to create the changesfile
+ if [ ! -e $CHANGESMNT/livecd.aufs ] && [ -n "${AUFS}" ]
+ then
+ create_changefs
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ elif [ -n "${AUFS}" ]
+ then
+ local nbpass=0
+ while [ 1 ]
+ do
+ mount -t auto $CHANGESMNT/livecd.aufs $MEMORY
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ if [ $nbpass -eq 0 ]
+ then
+ bad_msg "mounting of changes file failed, Running e2fsck"
+ e2fsck $CHANGESMNT/livecd.aufs
+ nbpass=$(($nbpass + 1))
+ else
+ bad_msg "mount of $CHANGESDEV failed falling back to ramdisk based aufs"
+ bad_msg "your livecd.aufs might be messed up, and I couldn't fix it"
+ bad_msg "moving livecd.aufs to livecd.aufs.bad"
+ mv $CHANGESMNT/livecd.aufs $CHANGESMNT/livecd.aufs.bad
+ bad_msg "try to fix it yourself with e2fsck later on, sorry for disturbing"
+ break
+ fi
+ else
+ if [ $nbpass -eq 1 ]
+ then
+ good_msg "e2fsck seemed successful. Please check your files after bootup"
+ fi
+ break
+ fi
+ done
+ if [ -f ${MEMORY}/.doclean.sh ]
+ then
+ good_msg "finishing the permanent changes cleanup"
+ . ${MEMORY}/.doclean.sh
+ rm ${MEMORY}/.doclean.sh
+ fi
+ fi
+ # mount tmpfs only in the case when changes= boot parameter was
+ # empty or we were not able to mount the storage device
+ if [ "${CDROOT}" -eq '1' -a ! -f ${CHANGESMNT}/livecd.aufs ]
+ then
+ umount $MEMORY
+ bad_msg "failed to find livecd.aufs file on $CHANGESDEV"
+ bad_msg "create an ext2 livecd.aufs file on this device if you wish to use it for aufs"
+ bad_msg "falling back to ramdisk based aufs for safety"
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ else
+ XINO=$MEMORY/xino
+ mkdir -p $XINO
+ mount -t tmpfs tmpfs $XINO
+ fi
+ else
+ good_msg "Mounting ramdisk to $MEMORY for aufs support..."
+ mount -t tmpfs tmpfs $MEMORY
+ XINO=$MEMORY
+ fi
+
+ mkdir -p $CHANGES
+ mount -t aufs -n -o nowarn_perm,udba=none,xino=$XINO/.aufs.xino,br:$CHANGES=rw aufs ${UNION}
+ ret=$?
+ if [ "${ret}" -ne 0 ]
+ then
+ bad_msg "Can't setup union ${UNION} in directory!"
+ USE_AUFS_NORMAL=0
+ fi
+ else
+ USE_AUFS_NORMAL=0
+ fi
+}
+
findnfsmount() {
if [ "${IP}" != '' ] || busybox udhcpc -n -T 15 -q
then
@@ -510,7 +701,11 @@
}
setup_keymap() {
XXX: needed?
- if [ "${DO_keymap}" ]
+ if [ -e $MEMORY/keyboard ]
+ then
+ . $MEMORY/keyboard
+ loadkmap < /lib/keymaps/${XKEYBOARD}.map
+ elif [ "${DO_keymap}" ]
XXX: ask grimmlin
then
if [ ! -e /dev/vc/0 -a ! -e /dev/tty0 ]
then
@@ -523,7 +718,10 @@
[ "${DEVBIND}" = '1' ] && umount /dev
XXX: needed?
- if [ -e /etc/sysconfig/keyboard -a "${CDROOT}" = '1' ]
+ if [ -e /etc/sysconfig/keyboard -a "${USE_AUFS_NORMAL}" = '1' ]
+ then
+ cp /etc/sysconfig/keyboard $MEMORY
+ elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" = '1' ]
XXX: ask grimmlin
then
mkdir -p ${NEW_ROOT}/etc/sysconfig/
cp /etc/sysconfig/keyboard ${NEW_ROOT}/etc/sysconfig/keyboard
@@ -595,13 +794,15 @@
then
echo
good_msg "Keeping default keymap"
splash set_msg "Keeping default keymap"
XXX: needed?
+ mkdir -p /etc/sysconfig
+ echo "XKEYBOARD=us" > /etc/sysconfig/keyboard
XXX: ask grimmlin
else
bad_msg "Sorry, but keymap ''${keymap}'' is invalid!"
unset keymap
diff -Naur '--exclude=.svn' '--exclude=.git' genkernel-3.4.18/defaults/linuxrc pentoo/genkernel/trunk/defaults/linuxrc
--- genkernel-3.4.18/defaults/linuxrc 2012-03-24 23:23:39.476742487 -0400
+++ pentoo/genkernel/trunk/defaults/linuxrc 2011-10-16 21:32:06.000000000 -0400
@@ -78,6 +78,41 @@
isoboot\=*)
ISOBOOT=`parse_opt "${x}"`
;;
+ aufs)
+ USE_AUFS_NORMAL=1
+ ;;
+ aufs\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ changes\=*)
+ USE_AUFS_NORMAL=1
+ CMD_AUFS=`parse_opt "${x}"`
+ echo ${CMD_AUFS}|grep , >/dev/null 2>&1
+ if [ "$?" -eq '0' ]
+ then
+ UID=`echo ${CMD_AUFS#*,}`
+ AUFS=`echo ${CMD_AUFS%,*}`
+ else
+ AUFS=${CMD_AUFS}
+ fi
+ ;;
+ persistent)
+ USE_AUFS_NORMAL=1
+ AUFS="detect"
+ ;;
+ # Allow user to specify the modules location
+ modules\=*)
+ MODULESD=`parse_opt "${x}"`
+ ;;
# Start Volume manager options
dolvm)
USE_LVM_NORMAL=1
@@ -350,23 +384,32 @@
fi
mkdir -p "${NEW_ROOT}"
XXX: but why?
-CHROOT="${NEW_ROOT}"
-
-# Run debug shell if requested
-rundebugshell
+CHROOT=${NEW_ROOT}
XXX: no reason at all
if [ "${CDROOT}" = '1' ]
then
- good_msg "Making tmpfs for ${NEW_ROOT}"
- mount -n -t tmpfs tmpfs "${NEW_ROOT}"
-
- for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
- do
- mkdir -p "${NEW_ROOT}/${i}"
- chmod 755 "${NEW_ROOT}/${i}"
- done
- [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
- [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ setup_aufs
+ setup_keymap
+
+ # Run debug shell if requested
+ rundebugshell
+
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ CHROOT=${UNION}
+ else
+ CHROOT=${NEW_ROOT}
+ good_msg "Making tmpfs for ${NEW_ROOT}"
+ mount -t tmpfs tmpfs ${NEW_ROOT}
+
+ for i in dev mnt mnt/cdrom mnt/livecd mnt/key tmp tmp/.initrd mnt/gentoo sys
+ do
+ mkdir -p "${NEW_ROOT}/${i}"
+ chmod 755 "${NEW_ROOT}/${i}"
+ done
+ [ ! -e "${NEW_ROOT}/dev/null" ] && mknod "${NEW_ROOT}"/dev/null c 1 3
+ [ ! -e "${NEW_ROOT}/dev/console" ] && mknod "${NEW_ROOT}"/dev/console c 5 1
+ fi
# For SGI LiveCDs ...
if [ "${LOOPTYPE}" = "sgimips" ]
@@ -382,7 +425,7 @@
[ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
fi
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
+ if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ] && [ "${USE_AUFS_NORMAL}" != '1' ]
then
bootstrapCD
fi
@@ -613,7 +656,23 @@
fi
fi
-
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}/${FS_LOCATION}
+
+ # 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
+ warn_msg "Adding all modules in $MODULESD/modules/"
+ if [ "${MODULESD}" = "mnt/cdrom" ]
+ then
+ union_insert_modules mnt/cdrom
+ else
+ mkdir ${NEW_ROOT}/mnt/modulesd
+ mount "${MODULESD}" ${NEW_ROOT}/mnt/modulesd
+ union_insert_modules ${NEW_ROOT}/mnt/modulesd
+ fi
+ fi
# Unpacking additional packages from NFS mount
# This is useful for adding kernel modules to /lib
@@ -637,53 +696,54 @@
setup_unionfs ${NEW_ROOT} ${NEW_ROOT}/${FS_LOCATION}
CHROOT=/union
else
-
- good_msg "Copying read-write image contents to tmpfs"
- # Copy over stuff that should be writable
- (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
-
- # Now we do the links.
- for x in ${ROOT_LINKS}
- do
- if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
+ if [ ! "${USE_AUFS_NORMAL}" -eq '1' ]
then
- ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
- else
- # List all subdirectories of x
- find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
- do
- # Strip the prefix of the FS_LOCATION
- directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+ good_msg "Copying read-write image contents to tmpfs"
+ # Copy over stuff that should be writable
+ (cd "${NEW_ROOT}/${FS_LOCATION}"; cp -a ${ROOT_TREES} "${NEW_ROOT}")
- # Skip this directory if we already linked a parent directory
- if [ "${current_parent}" != '' ]; then
- var=`echo "${directory}" | grep "^${current_parent}"`
- if [ "${var}" != '' ]; then
- continue
- fi
- fi
- # Test if the directory exists already
- if [ -e "/${NEW_ROOT}/${directory}" ]
+ # Now we do the links.
+ for x in ${ROOT_LINKS}
+ do
+ if [ -L "${NEW_ROOT}/${FS_LOCATION}/${x}" ]
then
- # It does exist, link all the individual files
- for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
+ ln -s "`readlink ${NEW_ROOT}/${FS_LOCATION}/${x}`" "${x}" 2>/dev/null
+ else
+ # List all subdirectories of x
+ find "${NEW_ROOT}/${FS_LOCATION}/${x}" -type d 2>/dev/null | while read directory
do
- if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
- ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ # Strip the prefix of the FS_LOCATION
+ directory="${directory#${NEW_ROOT}/${FS_LOCATION}/}"
+
+ # Skip this directory if we already linked a parent directory
+ if [ "${current_parent}" != '' ]; then
+ var=`echo "${directory}" | grep "^${current_parent}"`
+ if [ "${var}" != '' ]; then
+ continue
+ fi
+ fi
+ # Test if the directory exists already
+ if [ -e "/${NEW_ROOT}/${directory}" ]
+ then
+ # It does exist, link all the individual files
+ for file in `ls /${NEW_ROOT}/${FS_LOCATION}/${directory}`
+ do
+ if [ ! -d "/${NEW_ROOT}/${FS_LOCATION}/${directory}/${file}" ] && [ ! -e "${NEW_ROOT}/${directory}/${file}" ]; then
+ ln -s "/${FS_LOCATION}/${directory}/${file}" "${directory}/${file}" 2> /dev/null
+ fi
+ done
+ else
+ # It does not exist, make a link to the livecd
+ ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
+ current_parent="${directory}"
fi
done
- else
- # It does not exist, make a link to the livecd
- ln -s "/${FS_LOCATION}/${directory}" "${directory}" 2>/dev/null
- current_parent="${directory}"
fi
done
- fi
- done
-
- mkdir initramfs proc tmp sys 2>/dev/null
- chmod 1777 tmp
+ mkdir initramfs proc tmp sys 2>/dev/null
+ chmod 1777 tmp
+ fi
fi
#UML=`cat /proc/cpuinfo|grep UML|sed -e 's|model name.*: ||'`
@@ -704,6 +764,12 @@
setup_unionfs /union_changes ${NEW_ROOT}
mkdir -p ${UNION}/tmp/.initrd
fi
+
+ if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+ then
+ union_insert_dir ${UNION} ${NEW_ROOT}
+ mkdir -p ${UNION}/tmp/.initrd
+ fi
fi
# Execute script on the cdrom just before boot to update things if necessary
@@ -717,6 +783,35 @@
verbose_kmsg
+if [ "${USE_AUFS_NORMAL}" -eq '1' ]
+then
+ mkdir -p /${CHROOT}/.unions/memory 2>/dev/null
+ mount -o move /memory /${CHROOT}/.unions/memory || echo '*: Failed to move aufs /memory into the system root!'
+ for i in tmp var/tmp mnt/gentoo mnt/livecd
+ do
+ mkdir -p ${CHROOT}/$i
+ chmod 755 ${CHROOT}/$i
+ done
+ # This will prevent from putting junk on the CHANGESDEV
+ mkdir -p ${CHROOT}/usr/portage/distfiles
+ mount -t tmpfs tmpfs ${CHROOT}/var/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/tmp
+ mount -t tmpfs tmpfs ${CHROOT}/usr/portage/distfiles
+ warn_msg "/tmp /var/tmp /usr/portage/distfiles are mounted in ram"
+ warn_msg "consider saving important files elsewhere..."
+ read -t 3 UNUSEDVAL
+ mount -o bind ${NEW_ROOT}/mnt/cdrom ${CHROOT}/mnt/cdrom
+ mount -o bind ${NEW_ROOT}/mnt/livecd ${CHROOT}/mnt/livecd
+ if [ -e $MEMORY/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ cp $MEMORY/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ elif [ -e /etc/sysconfig/keyboard -a "${CDROOT}" -eq '1' ]
+ then
+ mkdir -p ${NEW_ROOT}/etc/sysconfig/
+ cp /etc/sysconfig/keyboard ${CHROOT}/etc/sysconfig/keyboard
+ fi
+fi
+
echo -ne "${GOOD}>>${NORMAL}${BOLD} Booting (initramfs)${NORMAL}"
cd "${CHROOT}"
diff -Naur '--exclude=.svn' '--exclude=.git' genkernel-3.4.18/gen_initramfs.sh pentoo/genkernel/trunk/gen_initramfs.sh
--- genkernel-3.4.18/gen_initramfs.sh 2012-03-24 23:23:39.478742478 -0400
+++ pentoo/genkernel/trunk/gen_initramfs.sh 2011-10-16 21:32:05.000000000 -0400
@@ -69,6 +69,24 @@
rm -rf "${TEMP}/initramfs-busybox-temp" > /dev/null
}
+# Used to add e2fs file making inside initramfs for aufs changes saving
+append_e2fstools(){
+ if [ -d "${TEMP}/initramfs-e2fsprogs-temp" ]
+ then
+ rm -r "${TEMP}/initramfs-e2fsprogs-temp/"
+ fi
+ print_info 1 'E2FSTOOLS: Adding support (compiling binaries)...'
+ # Using different name for blkid compatibility
+ compile_e2fstools
+ cd ${TEMP}
+ mkdir -p "${TEMP}/initramfs-e2fsprogs-temp/"
+ /bin/tar -jxpf "${E2FSPROGS_BINCACHE}" -C "${TEMP}/initramfs-e2fsprogs-temp/" ||
+ gen_die "Could not extract e2fsprogs binary cache!"
+ cd "${TEMP}/initramfs-e2fsprogs-temp/"
+ find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+ rm -rf "${TEMP}/initramfs-e2fsprogs-temp" > /dev/null
+}
+
append_blkid(){
if [ -d "${TEMP}/initramfs-blkid-temp" ]
then
@@ -507,6 +525,7 @@
rm -r "${TEMP}/initramfs-aux-temp/"
fi
mkdir -p "${TEMP}/initramfs-aux-temp/etc"
+ mkdir -p "${TEMP}/initramfs-aux-temp/bin"
mkdir -p "${TEMP}/initramfs-aux-temp/sbin"
if [ -f "${CMD_LINUXRC}" ]
then
@@ -620,6 +639,7 @@
append_data 'base_layout'
append_data 'auxilary' "${BUSYBOX}"
append_data 'busybox' "${BUSYBOX}"
+ append_data 'e2fstools'
append_data 'lvm' "${LVM}"
append_data 'dmraid' "${DMRAID}"
append_data 'iscsi' "${ISCSI}"
diff -Naur '--exclude=.svn' '--exclude=.git' genkernel-3.4.18/genkernel.conf pentoo/genkernel/trunk/genkernel.conf
--- genkernel-3.4.18/genkernel.conf 2012-03-24 23:23:39.479742473 -0400
+++ pentoo/genkernel/trunk/genkernel.conf 2011-10-16 21:32:05.000000000 -0400
@@ -229,6 +229,7 @@ XXX: seperate patch for this
E2FSPROGS_VER="VERSION_E2FSPROGS"
E2FSPROGS_DIR="e2fsprogs-${E2FSPROGS_VER}"
E2FSPROGS_SRCTAR="${DISTDIR}/e2fsprogs-${E2FSPROGS_VER}.tar.gz"
+E2FSPROGS_BINCACHE="%%CACHE%%/e2fsprogs-${E2FSPROGS_VER}-%%ARCH%%.bz2"
BLKID_BINCACHE="%%CACHE%%/blkid-${E2FSPROGS_VER}-%%ARCH%%.bz2"
FUSE_VER="VERSION_FUSE"

View file

@ -0,0 +1,23 @@
# This specifies which mounts from your fstab should be mounted before
# switching to the real root. If this file is missing, genkernel's code will
# default to just "/usr", which will suffice on most systems with a seperate
# /usr mount.
#
# If you have a complex configuration with a bindmount or symlink at /usr, or
# need some other mountpoints at boot, you should update this file such that
# /usr and anything else needed will be available after the switch into the
# real root.
#
# The lines without comments in this file are used as exact matches against the
# second column of your /etc/fstab and the device, fstype and mount options are
# taken from that line in fstab. If no line matches, the line from this file
# will be ignored.
#
/usr
# If you had some need of these:
#/usr/local
#/opt
#/var
#/home

View file

@ -0,0 +1,156 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/genkernel/genkernel-3.4.24.ebuild,v 1.1 2012/01/24 23:30:18 sping Exp $
# genkernel-9999 -> latest Git branch "master"
# genkernel-VERSION -> normal genkernel release
VERSION_BUSYBOX='1.19.3'
VERSION_DMAP='1.02.22'
VERSION_DMRAID='1.0.0.rc14'
VERSION_MDADM='3.1.5'
VERSION_E2FSPROGS='1.42'
VERSION_FUSE='2.8.6'
VERSION_ISCSI='2.0-872'
VERSION_LVM='2.02.88'
VERSION_UNIONFS_FUSE='0.24'
VERSION_GPG='1.4.11'
MY_HOME="http://wolf31o2.org"
RH_HOME="ftp://sources.redhat.com/pub"
DM_HOME="http://people.redhat.com/~heinzm/sw/dmraid/src"
BB_HOME="http://www.busybox.net/downloads"
COMMON_URI="${DM_HOME}/dmraid-${VERSION_DMRAID}.tar.bz2
${DM_HOME}/old/dmraid-${VERSION_DMRAID}.tar.bz2
mirror://kernel/linux/utils/raid/mdadm/mdadm-${VERSION_MDADM}.tar.bz2
${RH_HOME}/lvm2/LVM2.${VERSION_LVM}.tgz
${RH_HOME}/lvm2/old/LVM2.${VERSION_LVM}.tgz
${RH_HOME}/dm/device-mapper.${VERSION_DMAP}.tgz
${RH_HOME}/dm/old/device-mapper.${VERSION_DMAP}.tgz
${BB_HOME}/busybox-${VERSION_BUSYBOX}.tar.bz2
mirror://kernel/linux/kernel/people/mnc/open-iscsi/releases/open-iscsi-${VERSION_ISCSI}.tar.gz
mirror://sourceforge/e2fsprogs/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz
mirror://sourceforge/fuse/fuse-${VERSION_FUSE}.tar.gz
http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2
mirror://gnupg/gnupg/gnupg-${VERSION_GPG}.tar.bz2"
if [[ ${PV} == 9999* ]]
then
EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git
http://git.overlays.gentoo.org/gitroot/proj/${PN}.git"
inherit git-2 bash-completion eutils
S="${WORKDIR}/${PN}"
SRC_URI="${COMMON_URI}"
KEYWORDS=""
else
inherit bash-completion eutils
SRC_URI="mirror://gentoo/${P}.tar.bz2
${MY_HOME}/sources/genkernel/${P}.tar.bz2
${COMMON_URI}"
# Please don't touch individual KEYWORDS. Since this is maintained/tested by
# Release Engineering, it's easier for us to deal with all arches at once.
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
fi
DESCRIPTION="Gentoo automatic kernel building scripts"
HOMEPAGE="http://www.gentoo.org"
LICENSE="GPL-2"
SLOT="0"
RESTRICT=""
IUSE="ibm pentoo selinux"
DEPEND="sys-fs/e2fsprogs
selinux? ( sys-libs/libselinux )"
RDEPEND="${DEPEND} app-arch/cpio"
if [[ ${PV} == 9999* ]]; then
DEPEND="${DEPEND} app-text/asciidoc"
fi
src_unpack() {
if [[ ${PV} == 9999* ]] ; then
git-2_src_unpack
else
unpack ${P}.tar.bz2
fi
use selinux && sed -i 's/###//g' "${S}"/gen_compile.sh
use pentoo && cd "${S}"
use pentoo && epatch "${FILESDIR}"/aufs-new.diff
}
src_compile() {
if [[ ${PV} == 9999* ]]; then
emake || die
fi
}
src_install() {
# This block updates genkernel.conf
sed \
-e "s:VERSION_BUSYBOX:$VERSION_BUSYBOX:" \
-e "s:VERSION_DMAP:$VERSION_DMAP:" \
-e "s:VERSION_MDADM:$VERSION_MDADM:" \
-e "s:VERSION_DMRAID:$VERSION_DMRAID:" \
-e "s:VERSION_E2FSPROGS:$VERSION_E2FSPROGS:" \
-e "s:VERSION_FUSE:$VERSION_FUSE:" \
-e "s:VERSION_ISCSI:$VERSION_ISCSI:" \
-e "s:VERSION_LVM:$VERSION_LVM:" \
-e "s:VERSION_UNIONFS_FUSE:$VERSION_UNIONFS_FUSE:" \
-e "s:VERSION_GPG:$VERSION_GPG:" \
"${S}"/genkernel.conf > "${T}"/genkernel.conf \
|| die "Could not adjust versions"
insinto /etc
doins "${T}"/genkernel.conf || die "doins genkernel.conf"
doman genkernel.8 || die "doman"
dodoc AUTHORS ChangeLog README TODO || die "dodoc"
dobin genkernel || die "dobin genkernel"
rm -f genkernel genkernel.8 AUTHORS ChangeLog README TODO genkernel.conf
insinto /usr/share/genkernel
doins -r "${S}"/* || die "doins"
use ibm && cp "${S}"/ppc64/kernel-2.6-pSeries "${S}"/ppc64/kernel-2.6 || \
cp "${S}"/arch/ppc64/kernel-2.6.g5 "${S}"/arch/ppc64/kernel-2.6
# Copy files to /var/cache/genkernel/src
elog "Copying files to /var/cache/genkernel/src..."
mkdir -p "${D}"/var/cache/genkernel/src
cp -f \
"${DISTDIR}"/mdadm-${VERSION_MDADM}.tar.bz2 \
"${DISTDIR}"/dmraid-${VERSION_DMRAID}.tar.bz2 \
"${DISTDIR}"/LVM2.${VERSION_LVM}.tgz \
"${DISTDIR}"/device-mapper.${VERSION_DMAP}.tgz \
"${DISTDIR}"/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz \
"${DISTDIR}"/busybox-${VERSION_BUSYBOX}.tar.bz2 \
"${DISTDIR}"/fuse-${VERSION_FUSE}.tar.gz \
"${DISTDIR}"/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2 \
"${DISTDIR}"/gnupg-${VERSION_GPG}.tar.bz2 \
"${DISTDIR}"/open-iscsi-${VERSION_ISCSI}.tar.gz \
"${D}"/var/cache/genkernel/src || die "Copying distfiles..."
dobashcompletion "${FILESDIR}"/genkernel.bash
}
pkg_postinst() {
echo
elog 'Documentation is available in the genkernel manual page'
elog 'as well as the following URL:'
echo
elog 'http://www.gentoo.org/doc/en/genkernel.xml'
echo
ewarn "This package is known to not work with reiser4. If you are running"
ewarn "reiser4 and have a problem, do not file a bug. We know it does not"
ewarn "work and we don't plan on fixing it since reiser4 is the one that is"
ewarn "broken in this regard. Try using a sane filesystem like ext3 or"
ewarn "even reiser3."
echo
ewarn "The LUKS support has changed from versions prior to 3.4.4. Now,"
ewarn "you use crypt_root=/dev/blah instead of real_root=luks:/dev/blah."
echo
bash-completion_pkg_postinst
}

View file

@ -0,0 +1,167 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/genkernel/genkernel-3.4.30.ebuild,v 1.2 2012/05/03 22:26:18 sping Exp $
# genkernel-9999 -> latest Git branch "master"
# genkernel-VERSION -> normal genkernel release
EAPI="3"
VERSION_BUSYBOX='1.19.3'
VERSION_DMRAID='1.0.0.rc16-3'
VERSION_MDADM='3.1.5'
VERSION_E2FSPROGS='1.42'
VERSION_FUSE='2.8.6'
VERSION_ISCSI='2.0-872'
VERSION_LVM='2.02.88'
VERSION_UNIONFS_FUSE='0.24'
VERSION_GPG='1.4.11'
MY_HOME="http://wolf31o2.org"
RH_HOME="ftp://sources.redhat.com/pub"
DM_HOME="http://people.redhat.com/~heinzm/sw/dmraid/src"
BB_HOME="http://www.busybox.net/downloads"
COMMON_URI="${DM_HOME}/dmraid-${VERSION_DMRAID}.tar.bz2
${DM_HOME}/old/dmraid-${VERSION_DMRAID}.tar.bz2
mirror://kernel/linux/utils/raid/mdadm/mdadm-${VERSION_MDADM}.tar.bz2
${RH_HOME}/lvm2/LVM2.${VERSION_LVM}.tgz
${RH_HOME}/lvm2/old/LVM2.${VERSION_LVM}.tgz
${BB_HOME}/busybox-${VERSION_BUSYBOX}.tar.bz2
mirror://kernel/linux/kernel/people/mnc/open-iscsi/releases/open-iscsi-${VERSION_ISCSI}.tar.gz
mirror://sourceforge/e2fsprogs/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz
mirror://sourceforge/fuse/fuse-${VERSION_FUSE}.tar.gz
http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2
mirror://gnupg/gnupg/gnupg-${VERSION_GPG}.tar.bz2"
if [[ ${PV} == 9999* ]]
then
EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git
http://git.overlays.gentoo.org/gitroot/proj/${PN}.git"
inherit git-2 bash-completion eutils
S="${WORKDIR}/${PN}"
SRC_URI="${COMMON_URI}"
KEYWORDS=""
else
inherit bash-completion eutils
SRC_URI="mirror://gentoo/${P}.tar.bz2
${MY_HOME}/sources/genkernel/${P}.tar.bz2
${COMMON_URI}"
# Please don't touch individual KEYWORDS. Since this is maintained/tested by
# Release Engineering, it's easier for us to deal with all arches at once.
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86"
fi
DESCRIPTION="Gentoo automatic kernel building scripts"
HOMEPAGE="http://www.gentoo.org"
LICENSE="GPL-2"
SLOT="0"
RESTRICT=""
IUSE="crypt cryptsetup ibm pentoo selinux" # Keep 'crypt' in to keep 'use crypt' below working!
DEPEND="sys-fs/e2fsprogs
selinux? ( sys-libs/libselinux )"
RDEPEND="${DEPEND}
cryptsetup? ( sys-fs/cryptsetup )
app-arch/cpio
app-misc/pax-utils
!<sys-apps/openrc-0.9.9"
# pax-utils is used for lddtree
if [[ ${PV} == 9999* ]]; then
DEPEND="${DEPEND} app-text/asciidoc"
fi
src_unpack() {
if [[ ${PV} == 9999* ]] ; then
git-2_src_unpack
else
unpack ${P}.tar.bz2
fi
use selinux && sed -i 's/###//g' "${S}"/gen_compile.sh
use pentoo && cd "${S}"
use pentoo && epatch "${FILESDIR}"/aufs-correct.diff
}
src_compile() {
if [[ ${PV} == 9999* ]]; then
emake || die
fi
}
src_install() {
# This block updates genkernel.conf
sed \
-e "s:VERSION_BUSYBOX:$VERSION_BUSYBOX:" \
-e "s:VERSION_MDADM:$VERSION_MDADM:" \
-e "s:VERSION_DMRAID:$VERSION_DMRAID:" \
-e "s:VERSION_E2FSPROGS:$VERSION_E2FSPROGS:" \
-e "s:VERSION_FUSE:$VERSION_FUSE:" \
-e "s:VERSION_ISCSI:$VERSION_ISCSI:" \
-e "s:VERSION_LVM:$VERSION_LVM:" \
-e "s:VERSION_UNIONFS_FUSE:$VERSION_UNIONFS_FUSE:" \
-e "s:VERSION_GPG:$VERSION_GPG:" \
"${S}"/genkernel.conf > "${T}"/genkernel.conf \
|| die "Could not adjust versions"
insinto /etc
doins "${T}"/genkernel.conf || die "doins genkernel.conf"
doman genkernel.8 || die "doman"
dodoc AUTHORS ChangeLog README TODO || die "dodoc"
dobin genkernel || die "dobin genkernel"
rm -f genkernel genkernel.8 AUTHORS ChangeLog README TODO genkernel.conf
insinto /usr/share/genkernel
doins -r "${S}"/* || die "doins"
use ibm && cp "${S}"/ppc64/kernel-2.6-pSeries "${S}"/ppc64/kernel-2.6 || \
cp "${S}"/arch/ppc64/kernel-2.6.g5 "${S}"/arch/ppc64/kernel-2.6
# Copy files to /var/cache/genkernel/src
elog "Copying files to /var/cache/genkernel/src..."
mkdir -p "${D}"/var/cache/genkernel/src
cp -f \
"${DISTDIR}"/mdadm-${VERSION_MDADM}.tar.bz2 \
"${DISTDIR}"/dmraid-${VERSION_DMRAID}.tar.bz2 \
"${DISTDIR}"/LVM2.${VERSION_LVM}.tgz \
"${DISTDIR}"/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz \
"${DISTDIR}"/busybox-${VERSION_BUSYBOX}.tar.bz2 \
"${DISTDIR}"/fuse-${VERSION_FUSE}.tar.gz \
"${DISTDIR}"/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2 \
"${DISTDIR}"/gnupg-${VERSION_GPG}.tar.bz2 \
"${DISTDIR}"/open-iscsi-${VERSION_ISCSI}.tar.gz \
"${D}"/var/cache/genkernel/src || die "Copying distfiles..."
dobashcompletion "${FILESDIR}"/genkernel.bash
insinto /etc
doins "${FILESDIR}"/initramfs.mounts
}
pkg_postinst() {
echo
elog 'Documentation is available in the genkernel manual page'
elog 'as well as the following URL:'
echo
elog 'http://www.gentoo.org/doc/en/genkernel.xml'
echo
ewarn "This package is known to not work with reiser4. If you are running"
ewarn "reiser4 and have a problem, do not file a bug. We know it does not"
ewarn "work and we don't plan on fixing it since reiser4 is the one that is"
ewarn "broken in this regard. Try using a sane filesystem like ext3 or"
ewarn "even reiser3."
echo
ewarn "The LUKS support has changed from versions prior to 3.4.4. Now,"
ewarn "you use crypt_root=/dev/blah instead of real_root=luks:/dev/blah."
echo
if use crypt && ! use cryptsetup ; then
ewarn "Local use flag 'crypt' has been renamed to 'cryptsetup' (bug #414523)."
ewarn "Please set flag 'cryptsetup' for this very package if you would like"
ewarn "to have genkernel create an initramfs with LUKS support."
ewarn "Sorry for the inconvenience."
echo
fi
bash-completion_pkg_postinst
}

View file

@ -0,0 +1,151 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-kernel/genkernel/genkernel-3.4.16.ebuild,v 1.7 2011/10/03 19:47:58 josejx Exp $
# genkernel-9999 -> latest Git branch "master"
# genkernel-VERSION -> normal genkernel release
VERSION_BUSYBOX='1.19.3'
VERSION_DMAP='1.02.22'
VERSION_DMRAID='1.0.0.rc14'
VERSION_MDADM='3.1.4'
VERSION_E2FSPROGS='1.41.14'
VERSION_FUSE='2.7.4'
VERSION_ISCSI='2.0-872'
VERSION_LVM='2.02.74'
VERSION_UNIONFS_FUSE='0.22'
VERSION_GPG='1.4.11'
MY_HOME="http://wolf31o2.org"
RH_HOME="ftp://sources.redhat.com/pub"
DM_HOME="http://people.redhat.com/~heinzm/sw/dmraid/src"
BB_HOME="http://www.busybox.net/downloads"
COMMON_URI="${DM_HOME}/dmraid-${VERSION_DMRAID}.tar.bz2
${DM_HOME}/old/dmraid-${VERSION_DMRAID}.tar.bz2
mirror://kernel/linux/utils/raid/mdadm/mdadm-${VERSION_MDADM}.tar.bz2
${RH_HOME}/lvm2/LVM2.${VERSION_LVM}.tgz
${RH_HOME}/lvm2/old/LVM2.${VERSION_LVM}.tgz
${RH_HOME}/dm/device-mapper.${VERSION_DMAP}.tgz
${RH_HOME}/dm/old/device-mapper.${VERSION_DMAP}.tgz
${BB_HOME}/busybox-${VERSION_BUSYBOX}.tar.bz2
mirror://kernel/linux/kernel/people/mnc/open-iscsi/releases/open-iscsi-${VERSION_ISCSI}.tar.gz
mirror://sourceforge/e2fsprogs/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz
mirror://sourceforge/fuse/fuse-${VERSION_FUSE}.tar.gz
http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2
mirror://gnupg/gnupg/gnupg-${VERSION_GPG}.tar.bz2"
if [[ ${PV} == 9999* ]]
then
[[ ${PV} == 9999.* ]] && ESVN_UPDATE_CMD="svn up -r ${PV/9999./}"
ESVN_REPO_URI="https://pentoo.googlecode.com/svn/genkernel/trunk"
inherit subversion bash-completion eutils
S=${WORKDIR}/trunk
SRC_URI="${COMMON_URI}"
else
inherit bash-completion eutils
SRC_URI="${MY_HOME}/genkernel/${P}.tar.bz2
${COMMON_URI}"
fi
DESCRIPTION="Gentoo automatic kernel building scripts with pentoo patches"
HOMEPAGE="http://trac.pentoo.ch/wiki/Genkernel"
LICENSE="GPL-2"
SLOT="0"
RESTRICT=""
IUSE="ibm selinux"
KEYWORDS="-*"
DEPEND="sys-fs/e2fsprogs
selinux? ( sys-libs/libselinux )"
RDEPEND="${DEPEND} app-arch/cpio"
if [[ ${PV} == 9999* ]]; then
DEPEND="${DEPEND} app-text/asciidoc"
fi
src_unpack() {
if [[ ${PV} == 9999* ]] ; then
subversion_src_unpack
else
unpack ${P}.tar.bz2
fi
use selinux && sed -i 's/###//g' "${S}"/gen_compile.sh
}
src_compile() {
if [[ ${PV} == 9999* ]]; then
emake || die
fi
}
src_install() {
# This block updates genkernel.conf
sed \
-e "s:VERSION_BUSYBOX:$VERSION_BUSYBOX:" \
-e "s:VERSION_DMAP:$VERSION_DMAP:" \
-e "s:VERSION_MDADM:$VERSION_MDADM:" \
-e "s:VERSION_DMRAID:$VERSION_DMRAID:" \
-e "s:VERSION_E2FSPROGS:$VERSION_E2FSPROGS:" \
-e "s:VERSION_FUSE:$VERSION_FUSE:" \
-e "s:VERSION_ISCSI:$VERSION_ISCSI:" \
-e "s:VERSION_LVM:$VERSION_LVM:" \
-e "s:VERSION_UNIONFS_FUSE:$VERSION_UNIONFS_FUSE:" \
-e "s:VERSION_GPG:$VERSION_GPG:" \
"${S}"/genkernel.conf > "${T}"/genkernel.conf \
|| die "Could not adjust versions"
insinto /etc
doins "${T}"/genkernel.conf || die "doins genkernel.conf"
doman genkernel.8 || die "doman"
dodoc AUTHORS ChangeLog README TODO || die "dodoc"
dobin genkernel || die "dobin genkernel"
rm -f genkernel genkernel.8 AUTHORS ChangeLog README TODO genkernel.conf
insinto /usr/share/genkernel
doins -r "${S}"/* || die "doins"
use ibm && cp "${S}"/ppc64/kernel-2.6-pSeries "${S}"/ppc64/kernel-2.6 || \
cp "${S}"/arch/ppc64/kernel-2.6.g5 "${S}"/arch/ppc64/kernel-2.6
# Copy files to /var/cache/genkernel/src
elog "Copying files to /var/cache/genkernel/src..."
mkdir -p "${D}"/var/cache/genkernel/src
cp -f \
"${DISTDIR}"/mdadm-${VERSION_MDADM}.tar.bz2 \
"${DISTDIR}"/dmraid-${VERSION_DMRAID}.tar.bz2 \
"${DISTDIR}"/LVM2.${VERSION_LVM}.tgz \
"${DISTDIR}"/device-mapper.${VERSION_DMAP}.tgz \
"${DISTDIR}"/e2fsprogs-${VERSION_E2FSPROGS}.tar.gz \
"${DISTDIR}"/busybox-${VERSION_BUSYBOX}.tar.bz2 \
"${DISTDIR}"/fuse-${VERSION_FUSE}.tar.gz \
"${DISTDIR}"/unionfs-fuse-${VERSION_UNIONFS_FUSE}.tar.bz2 \
"${DISTDIR}"/gnupg-${VERSION_GPG}.tar.bz2 \
"${DISTDIR}"/open-iscsi-${VERSION_ISCSI}.tar.gz \
"${D}"/var/cache/genkernel/src || die "Copying distfiles..."
dobashcompletion "${FILESDIR}"/genkernel.bash
}
pkg_postinst() {
echo
elog 'Documentation is available in the genkernel manual page'
elog 'as well as the following URL:'
echo
elog 'http://www.gentoo.org/doc/en/genkernel.xml'
echo
ewarn "This package is known to not work with reiser4. If you are running"
ewarn "reiser4 and have a problem, do not file a bug. We know it does not"
ewarn "work and we don't plan on fixing it since reiser4 is the one that is"
ewarn "broken in this regard. Try using a sane filesystem like ext3 or"
ewarn "even reiser3."
echo
ewarn "The LUKS support has changed from versions prior to 3.4.4. Now,"
ewarn "you use crypt_root=/dev/blah instead of real_root=luks:/dev/blah."
echo
bash-completion_pkg_postinst
}