summaryrefslogtreecommitdiff
path: root/packages/altboot/files/altboot.func
diff options
context:
space:
mode:
authorMatthias Hentges <oe@hentges.net>2006-04-04 12:07:29 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-04-04 12:07:29 +0000
commite21f2e5093a027058a685f09a4b9d0151bb4dafd (patch)
tree40635582f4d8f687e198f825a2e3be2318aba3a4 /packages/altboot/files/altboot.func
parentbe327e49437c5d3c5ac8f3f47f0274975670e434 (diff)
altboot: - Allow a basic reconfiguration of non-flash based installations:
- Move /home from flash into the image - Remove SD / CF / /home ipkg dests - Move ipkg package data from RAM into the image - All of the above is _optional_ - Be a little bit less verbose. - Yet _again_ change the way we detect wheter we are called by the kernel or the user...this is driving me nuts.
Diffstat (limited to 'packages/altboot/files/altboot.func')
-rw-r--r--packages/altboot/files/altboot.func108
1 files changed, 105 insertions, 3 deletions
diff --git a/packages/altboot/files/altboot.func b/packages/altboot/files/altboot.func
index 612a0243b2..0cc59116ce 100644
--- a/packages/altboot/files/altboot.func
+++ b/packages/altboot/files/altboot.func
@@ -93,6 +93,8 @@ pivot_realfs() {
mount -o remount,ro / >/dev/null 2>&1
+ test "$ENABLE_IMAGECONF" = yes && image_conf $1
+
do_pivot "$1" "$RL"
}
@@ -152,27 +154,28 @@ pivot_image() {
echo ""
- echo "Using [$IMAGE_NAME]"
mkdir -p /media/image || die "mkdir -p /media/image failed"
- echo "Setting up loopback (/dev/loop0) for $IMAGE_NAME"
losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME || die "losetup /dev/loop0 $1/$IMAGE_PATH/$IMAGE_NAME failed!"
check_fs /dev/loop0 $IMAGE_TYPE
- echo -e "\n* * * Booting rootfs image * * *\n"
+ echo -e "\n* * * Mounting rootfs image * * *\n"
# Busybox's "mount" doesn't seem to like "-o loop" for some reason
# It works on collie and b0rks on poodle.
if [ "$IMAGE_TYPE" = "" ]; then
IMAGE_TYPE="auto"
fi
+
# If mount fails it has the tendency to spew out a _lot_ of error messages.
# We direct the output to /dev/null so the user can see which step actually failed.
mount /dev/loop0 -t $IMAGE_TYPE /media/image >/dev/null 2>&1 || die "mount -t $IMAGE_TYPE /dev/loop0 /media/image failed!"
mkdir -p /media/image/media/ROM || die "mkdir -p /media/image/media/ROM failed"
+ test "$ENABLE_IMAGECONF" = yes && image_conf /media/image
+
do_pivot /media/image "$RL"
}
@@ -214,6 +217,105 @@ do_pivot(){
}
+# $1: Path to mounted rootfs
+image_conf(){
+ ! test -d "$1" && die "image_conf: [$1] not found / no directory"
+
+ test -e "$1/etc/.image_conf.done" && return
+
+ echo -e "\n\n* * * rootfs configuration * * *\n"
+ echo -e "This setup lets you reconfigure your new rootfs."
+ echo "Most probably the rootfs is configured with"
+ echo "defaults based on a flash installation."
+ echo "If unsure, go with the defaults by pressing <ENTER>."
+ echo ""
+
+ if ( cat $1/etc/fstab | grep -v "^#" | grep -q "/home " )
+ then
+ while true
+ do
+ echo "Usually your /home directory is located on another flash partition."
+ echo -n "Do you want me to move /home inside the loop-image? [N|y] "
+ read junk
+
+ if test "$junk" = "y" -o "$junk" = "Y"
+ then
+ cat $1/etc/fstab | sed "/.*\/home.*/s/\/home/\/home.orig/" > $1/etc/fstab_
+ mv $1/etc/fstab_ $1/etc/fstab
+ break
+ fi
+
+ test "$junk" = "" -o "$junk" = n -o "$junk" = N && break
+ done
+
+ fi
+
+ echo ""
+
+# if ( cat $1/etc/fstab | grep -v "^#" | grep -q "/var" )
+# then
+# while true
+# do
+# echo "This is mainly for testing purposes."
+# echo -n "Do you want to configure /var as a normal non-tmpfs directory? [N|y] "
+# read junk
+#
+# if test "$junk" = "y" -o "$junk" = "Y"
+# then
+# cat $1/etc/fstab | sed "/.*\/var.*/s/\(.*\)/#\ \1/" > $1/etc/fstab_
+# mv $1/etc/fstab_ $1/etc/fstab
+# break
+# fi
+#
+# test "$junk" = "" -o "$junk" = n -o "$junk" = N && break
+# done
+# fi
+
+ echo ""
+
+ if ( cat $1/etc/ipkg.conf | grep -q ^lists_dir )
+ then
+ while true
+ do
+ echo -e "Wasting RAM is never a good idea.\nOnly say Y if your rootfs is very small in size"
+ echo -n "Do you want to store ipkg package data in RAM? [N|y] "
+ read junk
+
+ if test "$junk" = "" -o "$junk" = n -o "$junk" = N
+ then
+ cat $1/etc/ipkg.conf | sed "/^lists_dir.*/s/\(.*\)/#\ \1/"> $1/etc/ipkg.conf_
+ mv $1/etc/ipkg.conf_ $1/etc/ipkg.conf
+ break
+ fi
+
+ test "$junk" = "y" -o "$junk" = "Y" && break
+ done
+ fi
+
+ echo ""
+
+ if ( cat $1/etc/ipkg.conf | grep -q "^dest sd" )
+ then
+ while true
+ do
+ echo -n "Do you want to keep the SD, CF and /home ipkg install targets? [N|y] "
+ read junk
+
+ if test "$junk" = "" -o "$junk" = n -o "$junk" = N
+ then
+ cat $1/etc/ipkg.conf | sed "/^dest\ \(sd\|cf\|home\).*/s/\(.*\)/#\ \1/" > $1/etc/ipkg.conf_
+ mv $1/etc/ipkg.conf_ $1/etc/ipkg.conf
+ break
+ fi
+
+ test "$junk" = "y" -o "$junk" = "Y" && break
+ done
+ fi
+
+
+ touch "$1/etc/.image_conf.done"
+}
+
# This functions configures the master password for altboot if none is set
set_password() {
mount -o remount,rw /