Re: [PATCH 03/15] Copy /etc and /var from /mnt/runtime to the root filesystem.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bill Nottingham (notting@xxxxxxxxxx) said: 
> Jeremy Katz (katzj@xxxxxxxxxx) said: 
> > Oh, I think I'm following you now.  Because there's now /etc in stage1
> > and stage2 and different things need from one vs the other?  What if we
> > just had a copy of the files which are in the initrd in both places.
> > Then we could just move over /mnt/runtime/etc like we do today.  I can't
> > imagine the space hit being that significant
> 
> You want to prefer the stage2 /etc/passwd and /etc/group, but other than that,
> copying stage1 over to stage2 and switching should work fine.

Updated patchset:

commit 213985cdbb8c1dea25e3e88d28c7919a975eca29
Author: Bill Nottingham <notting@xxxxxxxxxx>
Date:   Thu Dec 6 15:59:13 2007 -0500

    Use the passwd and group from the second stage, rather than create our own.

diff --git a/scripts/mk-images b/scripts/mk-images
index 006314f..55c82f5 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -350,16 +350,6 @@ makeproductfile() {
 
 setupShellEnvironment() {
     # setup password/group entries
-    cat > $MBD_DIR/etc/passwd << EOF
-root::0:0::/:/sbin/loader
-debug::0:0:debug shell:/:/bin/bash
-sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
-EOF
-    cat > $MBD_DIR/etc/group << EOF
-root:x:0:root
-tty:x:5:
-EOF
-    echo "sshd:x:74:" >> $MBD_DIR/etc/group
     echo "tcp     6       TCP" > $MBD_DIR/etc/protocols
 
     # PAM configuration
@@ -626,10 +616,6 @@ makeinitrd() {
         esac
     done
 
-    cat > $MBD_DIR/etc/passwd << EOF
-    root::0:0:root:/:/bin/bash
-EOF
-
     # set up the arch bits
     echo $arch > $MBD_DIR/etc/arch
 
@@ -650,7 +636,9 @@ EOF
        install -m 644 $SCREENFONT $MBD_DIR/etc/screenfont.gz
     fi
     install -m 644 $MYLANGTABLE $MBD_DIR/etc/lang-table
-    
+    install -m 644 $IMGPATH/etc/passwd $MBD_DIR/etc/passwd
+    install -m 644 $IMGPATH/etc/group $MBD_DIR/etc/group
+
     install -m 644 $LOADERBINDIR/$MYLOADERTR $MBD_DIR/etc/loader.tr
     for i in a/ansi d/dumb l/linux s/screen v/vt100 v/vt100-nav v/vt102 x/xterm x/xterm-color g/gnome ; do
 	[ -f $IMGPATH/usr/share/terminfo/$i ] && \

commit 6f5bcc6457d5fd3fe0b4f3846515d35743a68575
Author: Bill Nottingham <notting@xxxxxxxxxx>
Date:   Thu Dec 6 16:08:47 2007 -0500

    Copy /var from stage2 to stage1, use /mnt/runtime/etc as /etc
    
    Apps running in the second stage may expect to have 'normal' files in
    /etc or /var. We use /mnt/runtime/etc as /etc, but only after copying
    over the stage1 /etc. We do the reverse for /var - we copy the files
    from /mnt/runtime, as we can't use the read-only /var on stage2.

diff --git a/loader2/loader.c b/loader2/loader.c
index 90a1e0c..bc60b5c 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -1708,10 +1708,15 @@ int main(int argc, char ** argv) {
     url = doLoaderMain("/mnt/source", &loaderData, modInfo, modLoaded, &modDeps);
 
     if (!FL_TESTING(flags)) {
+        int ret;
+
         /* unlink dirs and link to the ones in /mnt/runtime */
         migrate_runtime_directory("/usr");
         migrate_runtime_directory("/lib");
         migrate_runtime_directory("/lib64");
+        copyDirectory("/etc","/mnt/runtime/etc", copyWarnFn, copyErrorFn);
+        migrate_runtime_directory("/etc");
+        copyDirectory("/mnt/runtime/var","/var", copyWarnFn, copyErrorFn);
     }
 
     /* now load SELinux policy before exec'ing anaconda and the shell
@@ -1721,10 +1726,6 @@ int main(int argc, char ** argv) {
             logMessage(ERROR, "failed to mount /selinux: %s, disabling SELinux", strerror(errno));
             flags &= ~LOADER_FLAGS_SELINUX;
         } else {
-            /* FIXME: this is a bad hack for libselinux assuming things
-             * about paths */
-            int ret;
-            ret = symlink("/mnt/runtime/etc/selinux", "/etc/selinux");
             if (loadpolicy() == 0) {
                 setexeccon(ANACONDA_CONTEXT);
             } else {

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux