aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Farina (Zero_Chaos) <zerochaos@gentoo.org>2014-09-22 20:07:28 -0400
committerRick Farina (Zero_Chaos) <zerochaos@gentoo.org>2015-04-29 13:33:04 -0400
commit4e55218f080fab85514112a38e6fe6aee6a922ba (patch)
treed7b2b6ef6b9ff5799817ba2c0dd65874359aa427
parentchange default aufs branch naming (diff)
downloadgenkernel-4e55218f080fab85514112a38e6fe6aee6a922ba.tar.gz
genkernel-4e55218f080fab85514112a38e6fe6aee6a922ba.tar.bz2
genkernel-4e55218f080fab85514112a38e6fe6aee6a922ba.zip
aufs changes saving automation
The aufs code has the ability to save changes in a file, however, it requires the user to manually tell us where the file is. This code will automatically check for the file on $CDROOT, as well as automatically pick up the casper-rw file created by unetbooting for persistence. Additionally we add the option for aufs=search which will search all drives for livecd.aufs. Possible later enhancements include searching other partitions on the CDROOT_DEV for livecd.aufs automatically instead of needing aufs=search. Then again, possible later enhancements also include just always searching, it's shockingly fast to do the search...
-rw-r--r--defaults/initrd.scripts24
1 files changed, 22 insertions, 2 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index d8142a29..e05809c9 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -123,7 +123,7 @@ findmediamount() {
fi
good_msg "Attempting to mount media: ${x}" ${CRYPT_SILENT}
- mount -r -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
+ mount -t ${CDROOT_TYPE} ${x} ${mntcddir} >/dev/null 2>&1
if [ "$?" = '0' ]
then
if [ -n "${ISOBOOT}" ]; then
@@ -408,12 +408,29 @@ create_changefs() {
setup_aufs() {
bootstrapCD
+ if [ "$aufs_dev" = "search" ]; then
+ findmediamount "aufs-dev" "$aufs_union_file" \
+ "aufs_dev" "$aufs_dev_mnt" $(devicelist)
+ aufs_mounted="1"
+ elif [ -z $aufs_dev ] && [ -w "$CDROOT_PATH/$aufs_union_file" ]; then
+ aufs_dev="$REAL_ROOT"
+ aufs_dev_mnt="$CDROOT_PATH"
+ aufs_mounted="1"
+ fi
+ if [ -z $aufs_dev ] && [ -w "$CDROOT_PATH/casper-rw" ]; then
+ aufs_dev="$REAL_ROOT"
+ aufs_dev_mnt="$CDROOT_PATH"
+ aufs_union_file="/casper-rw"
+ aufs_mounted="1"
+ fi
+
if [ -n "$aufs_dev" ]; then
if [ ! -b $aufs_dev ]; then
bad_msg "$aufs_dev is not a valid block device"
local invalidblk=1
unset aufs_dev
- else
+ #skip this block when aufs_dev_mnt is already mounted
+ elif [ "$aufs_mounted" != "1" ]; then
good_msg "Mounting $aufs_dev to $aufs_memory for aufs support"
if ! mount -t auto "$aufs_dev" "$aufs_dev_mnt" &>/dev/null; then
@@ -428,6 +445,9 @@ setup_aufs() {
elif [ -n "$aufs_dev" ]; then
while :; do
if mount -t auto "$aufs_dev_mnt$aufs_union_file" "$aufs_memory" &>/dev/null; then
+ if [ "$aufs_union_file" = "/casper-rw" ];then
+ bad_msg "Use of livecd.aufs preferred to casper-rw for changes saving, please rename the file."
+ fi
break
else
bad_msg "Mounting of changes file failed, Running e2fsck"