From a15ef1ed3d21eeca6d011f8143830ba2b7b8c1d8 Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov Date: Tue, 9 Sep 2003 22:21:49 +0000 Subject: [PATCH] Dimitar Zhekov : This patch adds stone support to 2nd_stage_small (-text only, no space for -dialog). build_stage2.sh: [2nd_stage_small changes only] - create local/bin to serve as a mountpoint for initrd/bin - do not copy wget and ip (using the initrd ones) - copy the programs required by stone and mkreiserfs - copy the stone files and create a head replacement script linuxrc.c: - mount (MS_BIND) initrd's bin under stage 2 /usr/local/bin - fail if mount fails && /bin/gzip does not exist [= small] linuxrc2.sh: - display a different startup message if dialog is missing git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@1363 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc --- Documentation/Developers/CHANGELOG-RENE | 4 +++- target/bootdisk/build_stage2.sh | 26 +++++++++++++++++++++---- target/bootdisk/linuxrc.c | 10 +++++++++- target/bootdisk/linuxrc2.sh | 7 ++++++- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Documentation/Developers/CHANGELOG-RENE b/Documentation/Developers/CHANGELOG-RENE index 5382a67a3..0ff4dc220 100644 --- a/Documentation/Developers/CHANGELOG-RENE +++ b/Documentation/Developers/CHANGELOG-RENE @@ -12,7 +12,9 @@ - fixed openldap to install the .init (#109) - Dimitar Zhekov: fixed mplayer doc copy, enabled mp3x in lame, fixed xfree86-doc, added xfce4 session manager, fixed cd ; echo, - added new lilo config options + added new lilo config optionsm, added stone to the + 2nd_stage_small incl. further space optimizations + *) 2003-09-07 (2.0.0-rc1 - 2.0.0-rc2) diff --git a/target/bootdisk/build_stage2.sh b/target/bootdisk/build_stage2.sh index 911f9c4b8..e961113f9 100644 --- a/target/bootdisk/build_stage2.sh +++ b/target/bootdisk/build_stage2.sh @@ -95,15 +95,16 @@ tar -czf ../2nd_stage.tar.gz * ; cd .. echo_header "Creating small 2nd stage filesystem:" mkdir -p 2nd_stage_small ; cd 2nd_stage_small -mkdir dev proc tmp bin lib etc share +mkdir -p dev proc tmp bin lib etc share local/bin mkdir -p mnt/source mnt/target ln -s bin sbin ; ln -s . usr # -progs="agetty bash cat cp date dd df ifconfig ip ln ls mine mkdir mke2fs \ - mkswap mount mv rm reboot route sleep swapoff swapon sync umount wget \ - eject chmod chroot grep halt rmdir sh shutdown uname killall5" +progs="agetty bash cat cp date dd df ifconfig ln ls mine mkdir mke2fs \ + mkswap mount mv rm reboot route sleep swapoff swapon sync umount \ + eject chmod chroot grep halt rmdir sh shutdown uname killall5 \ + stone mktemp sort fold sed mkreiserfs cut" progs="$progs fdisk sfdisk" @@ -150,6 +151,23 @@ echo_status "Copy linuxrc." cp ../2nd_stage/linuxrc . echo_status "Copy /etc/fstab." cp ../2nd_stage/etc/fstab etc +echo_status "Copy stone.d." +mkdir -p etc/stone.d +for i in gui_text mod_install mod_packages mod_gas default ; do + cp -v ../2nd_stage/etc/stone.d/$i.sh etc/stone.d +done +# +echo_status "Creating head replacement script." +cat << 'EOT' > bin/head +#!/bin/sh +m=10 +if echo "$1" | grep -- "-[0-9]\+" > /dev/null ; then + m="${1#-}" + shift +fi +exec grep -m$m "" $* +EOT +chmod +x bin/head # echo_status "Creating links for identical files." while read ck fn diff --git a/target/bootdisk/linuxrc.c b/target/bootdisk/linuxrc.c index 3d138449f..f2d1f4b28 100644 --- a/target/bootdisk/linuxrc.c +++ b/target/bootdisk/linuxrc.c @@ -61,9 +61,17 @@ void doboot() if ( mkdir("/mnt_root/old_root", 700) ) { perror("Can't create /mnt_root/old_root"); exit_linuxrc=0; } - if (access("/mnt_root/linuxrc", R_OK)) + if ( access("/mnt_root/linuxrc", R_OK) ) { printf("Can't find /mnt_root/linuxrc!\n"); exit_linuxrc=0; } + if ( mount("/bin", "/mnt_root/usr/local/bin", NULL, MS_BIND, NULL) ) { + perror("Can't mount /mnt_root/usr/local/bin"); + if (access("/mnt_root/bin/gzip", R_OK)) { + perror("Can't find /mnt_root/bin/gzip"); + exit_linuxrc=0; + } + } + if ( exit_linuxrc ) { if ( pivot_root("/mnt_root", "/mnt_root/old_root") ) { perror("Can't call pivot_root"); exit_linuxrc=0; } diff --git a/target/bootdisk/linuxrc2.sh b/target/bootdisk/linuxrc2.sh index 712ea1214..3f7e00f53 100644 --- a/target/bootdisk/linuxrc2.sh +++ b/target/bootdisk/linuxrc2.sh @@ -40,7 +40,12 @@ echo -n "An empty text stands for vc/1 - vc/6: " ; read ttydevs echo echo 'Just type "stone" now if you want to make a normal installation of a ROCK' -echo 'Linux build (or type "stone -text" if you prefer non-dialog based menus).' +echo -n 'Linux build ' +if type -p dialog > /dev/null ; then + echo '(or type "stone -text" if you prefer non-dialog based menus).' +else + echo '(only the text interface is available).' +fi echo -e '#!/bin/sh\ncd ; exec /bin/sh --login' > /sbin/login-shell chmod +x /sbin/login-shell