diff --git a/src/08_generate_rootfs/etc/prepare.sh b/src/08_generate_rootfs/etc/01_prepare.sh similarity index 65% rename from src/08_generate_rootfs/etc/prepare.sh rename to src/08_generate_rootfs/etc/01_prepare.sh index ce05206b5..e1b9aa552 100755 --- a/src/08_generate_rootfs/etc/prepare.sh +++ b/src/08_generate_rootfs/etc/01_prepare.sh @@ -1,7 +1,9 @@ #!/bin/sh +echo "Suppress most kernel messages." dmesg -n 1 +echo "Mount all core filesystems." mount -t devtmpfs none /dev mount -t proc none /proc mount -t tmpfs none /tmp -o mode=1777 diff --git a/src/08_generate_rootfs/etc/switch.sh b/src/08_generate_rootfs/etc/02_overlay.sh similarity index 96% rename from src/08_generate_rootfs/etc/switch.sh rename to src/08_generate_rootfs/etc/02_overlay.sh index d8fea5efb..2deaee910 100755 --- a/src/08_generate_rootfs/etc/switch.sh +++ b/src/08_generate_rootfs/etc/02_overlay.sh @@ -106,7 +106,7 @@ for DEVICE in /dev/* ; do mkdir -p $UPPER_DIR mkdir -p $WORK_DIR - mount -t overlay -o lowerdir=/mnt:$OVERLAY_DIR,upperdir=$UPPER_DIR,workdir=$WORK_DIR none /mnt 2>/dev/null + mount -t overlay -o lowerdir=$OVERLAY_DIR:/mnt,upperdir=$UPPER_DIR,workdir=$WORK_DIR none /mnt 2>/dev/null OUT=$? if [ ! "$OUT" = "0" ] ; then @@ -142,9 +142,9 @@ mount --move /tmp /mnt/tmp # The new mountpoint becomes file system root. All original root folders are # deleted automatically as part of the command execution. The '/sbin/init' # process is invoked and it becomes the new PID 1 parent process. -exec switch_root /mnt /sbin/init +exec switch_root /mnt /etc/03_init.sh -echo "You can never see this... unless there is a serious bug..." +echo "(/etc/02_overlay.sh) - there is a serious bug..." # Wait until any key has been pressed. read -n1 -s diff --git a/src/08_generate_rootfs/etc/03_init.sh b/src/08_generate_rootfs/etc/03_init.sh new file mode 100755 index 000000000..f1d53f3c4 --- /dev/null +++ b/src/08_generate_rootfs/etc/03_init.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +# If you have persistent overlay support then you can edit this file and replace +# the default initialization of the system. For example, you could use this: +# +# exec setsid cttyhach sh +# +# This gives you PID 1 shell inside the initramfs area. Since this is a PID 1 +# shell, you can still invoke the original initialization logic by executing +# this command: +# +# exec /sbin/init + +cat << CEOF + + Wait 5 seconds for the default system initialization process based on the + files /sbin/init and /etc/inittab or press any key for PID 1 shell. + +CEOF + +read -t 5 -n1 -s key + +if [ "$key" = "" ] ; then + # Use default initialization logic based on configuration in '/etc/inittab'. + echo "Executing /sbin/init as PID 1." + exec /sbin/init +else + +# Using no indentation for this snippet or otherwise it causes kernel panic. +cat << CEOF + + This is PID 1 shell. Execute the following in order to continue with the + default system initialization process: + + exec /sbin/init + +CEOF + + exec setsid cttyhack sh +fi + +echo "(/etc/03_init.sh) - there is a serious bug..." + +# Wait until any key has been pressed. +read -n1 -s + diff --git a/src/config_predefined/README.txt b/src/config_predefined/README.txt new file mode 100644 index 000000000..f458cbda5 --- /dev/null +++ b/src/config_predefined/README.txt @@ -0,0 +1,5 @@ +TODO 1- add documentation about this folder and the purpose of the predefined +configuration file. + +TODO 2 - Edit all comments and readme files to use maximum 80 chars per line. +