From 405d19a98e01603c797456a783626a3fbde1f47d Mon Sep 17 00:00:00 2001 From: freesource Date: Mon, 16 Dec 2002 13:35:30 +0000 Subject: [PATCH] This gets things working nicely. Now exits sooner for root_fs_helper because the nbd line no longer presents itself. Makefile is almost done. --- BootRoot/BootRoot.pm | 25 +++---------------------- BootRoot/Yard.pm | 3 +++ Makefile | 2 +- Makefile.pkg | 25 ++++++++++++++++++++++--- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/BootRoot/BootRoot.pm b/BootRoot/BootRoot.pm index 3ec2a51..a524611 100644 --- a/BootRoot/BootRoot.pm +++ b/BootRoot/BootRoot.pm @@ -286,25 +286,6 @@ my $time = sprintf("%02d:%02d:%02d-%02d-%02d-%04d", # Here's where stuff gets intersting, non-root users can create root_fs, # which is great for UML, and a boot disk. -if ( $> == 0 ) { - - if (!-d "$tmp1/gbootroot_tmp$time") { - $tmp = "$tmp1/gbootroot_tmp$time" if err_custom_perl( - "mkdir $tmp1/gbootroot_tmp$time", - "gBootRoot: ERROR: Could not make temporary directory") != 2; - } - if (!-d "$tmp1/gbootroot_mnt$time") { - $mnt = "$tmp1/gbootroot_mnt$time" if err_custom_perl( - "mkdir $tmp1/gbootroot_mnt$time", - "gBootRoot: ERROR: Could not make mount directory") != 2; - } - - # Why? - $tmp = "$tmp1/gbootroot_tmp$time"; - -} -else { - # The Administrator just needs to add a line like the one below to the # fstab for each non-root user who wants to be able to create root_fs. # In this example, `id -u` has to be the actual effective numeric user @@ -333,6 +314,8 @@ else { # # /dev/fd0 /tmp/gboot_not_root_mnt_`id -u` auto defaults,noauto,user 0 0 + # We call root, non-root, too, that's an in-joke. Root should stay + # out the picture anyways. my $user = $>; @@ -350,8 +333,6 @@ else { } $mnt = "$tmp1/gboot_non_root_mnt_$user"; -} - # Verbosity is universal for all methods, and controlled by a scale slider. # Yard @@ -896,7 +877,7 @@ if ( $option{"preserve-ownership"} ) { $ars->{uml_exclusively} = $uml_exclusively; ars2($ars); #not used in function below -$ars->{preserve_ownership} = $uml_exclusively; +$ars->{preserve_ownership} = $preserve_ownership; ars2($ars); # links_deps() diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index d86e9b6..1e2540a 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -1573,6 +1573,9 @@ sub create_expect_uml { info(1,"$x_count $_"); $x_count++; # Didn't need this before, but now do. + if ( $_ =~/Power down\./ ) { + last; + } if ( $_ =~/nbd.*module cleaned up/ ) { last; } diff --git a/Makefile b/Makefile index cb359b7..f6bbd2e 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ install: chmod 0444 yard/templates/*.yard cp -fa yard/templates/Example* /usr/share/gbootroot/yard/templates cp -fa yard/templates/Helper.yard /usr/share/gbootroot/yard/templates - cp -fa yard/templates/Helper.yard /usr/share/gbootroot/yard/templates + cp -fa yard/templates/Initrd.yard /usr/share/gbootroot/yard/templates install -d /usr/share/gbootroot/genext2fs cp -fa genext2fs/genext2fs.c /usr/share/gbootroot/genext2fs cp -fa genext2fs/Makefile /usr/share/gbootroot/genext2fs diff --git a/Makefile.pkg b/Makefile.pkg index 863dd06..7bccd77 100644 --- a/Makefile.pkg +++ b/Makefile.pkg @@ -6,9 +6,9 @@ PATCH_VERSION=35 UTIL_VER=20021103 BASE_DIR=${shell pwd} -TARGET_DIR=$(BASE_DIR)/root -BUILD_DIR=$(BASE_DIR)/staging_dir SOURCE_DIR=$(BASE_DIR)/sources +ROOT_FS_DIR=$(BASE_DIR)/root_filesystem +TMP=/tmp/gboot_non_root_`id -u` KERNEL=$(BASE_DIR)/user-mode-linux/usr/bin/linuxbr IMAGE=$(BASE_DIR)/root_filesystem/root_fs_helper @@ -92,6 +92,25 @@ kernel: +root_fs_helper: + + @if [ ! -f $(ROOT_FS_DIR)/root_fs_helper ] ; then \ + perl -I . ./gbootroot --home . --template Helper.yard --root-filename root_fs_helper --filesystem-command "genext2fs -z -r0" --genext2fs-dir genext2fs/ ; \ + cp -fa $(TMP)/root_fs_helper $(ROOT_FS_DIR) ; \ + fi; + @if [ -f $(ROOT_FS_DIR)/root_fs_helper ] ; then \ + perl -I. ./gbootroot --home . --template Helper.yard --root-filename root_fs_helper --filesystem-command mkcramfs --uml-exclusively on --expect-program ./expect_uml --uml-kernel user-mode-linux/usr/bin/linuxbr --root-fs-helper root_filesystem/root_fs_helper; \ + cp -fa $(TMP)/root_fs_helper_cramfs $(ROOT_FS_DIR)/root_fs_helper; \ + fi; + +initrd: root_fs_helper + + @if [ ! -f $(ROOT_FS_DIR)/Initrd.gz ] ; then \ + perl -I. ./gbootroot --home . --template Initrd.yard --root-filename Initrd --uml-exclusively on --expect-program ./expect_uml --uml-kernel user-mode-linux/usr/bin/linuxbr --root-fs-helper root_filesystem/root_fs_helper --filesystem-size 4096; \ + gzip -c9 $(TMP)/Initrd > $(ROOT_FS_DIR)/Initrd.gz; \ + fi; + + modules: cd linux-$(VERSION) ; \ mkdir ../modules-2.4 ; \ @@ -186,4 +205,4 @@ remove: rm /usr/X11R6/include/X11/pixmaps/gbootroot.xpm rm -rf /usr/share/doc/gbootroot -.PHONY: tools sources genext2fs \ No newline at end of file +.PHONY: tools sources genext2fs root_fs_helper_genext2fs root_fs_helper \ No newline at end of file