Anaconda patches (fwd)

Dean Anderson <[email protected]> Thu, 11 Mar 2004 01:07:33 -0500 (EST)
Newsgroups gmane.linux.aurora.devel
Message-ID <[email protected]>
Someone was having trouble getting the tftp64.img built...  These patches
aren't necessary, but may be interesting.

I also found this very useful:

http://www.linuxworks.com.au/redhat-installer-howto.html

		--Dean

---------- Forwarded message ----------
Date: Wed, 3 Dec 2003 17:50:05 -0500 (EST)
From: Dean Anderson <[email protected]>
To: Aurora development <[email protected]>
Subject: Anaconda patches

Patch 1 fixes a problem with booting rescue mode on a serial console and 
also includes adding -64 and -32 to image names. Since the distribution 
does this, the anaconda used in creating the distribution images must be 
different than the one on the 1.0 distribution...

Patch 2 allows the use of an FTP site for kickstart.  No rocket science. I 
notice that anaconda is running out of flag space. Only 5 bits left...

While I'm on the subject, one thing I am considering is a adding another
'gui' framework that doesn't use the snack text menu system.  I like the
text gui, and I also like the Gnome gui, all in the right contexts.  What
I seem to require yet is an interface that can be supervised by expect.  
Is anyone else interested in this?

One use of fully automated, expect supervised installation is the periodic
netbooting of a virus/worm/crack checker, which (from a netbooted clean
kernel), checks the real system for inappropriate file changes. It is now
clear to me that a running system can't be trusted to check itself, given
the possibility of a kernel compromise**.  The netboot image, after
finding a problem, then just has to notify something/someone, perhaps
backup non-OS files (using RPM database as a guide), and probably modified
OS files, and an then perhaps an automated reinstall can then take place.  
No fuss, no travel, and back up in minimum time.

		--Dean

**I'm in possession of a kernel module rootkit that I can't find when its
successfully installed.  When running, it is undetectable.  The only way
to detect it is to boot something else. Only then will you be able to see
the modified files. I only got it (source) because I happened to catch it
during download from a cracked server at ISC.org in October, 2001, and I
was able to kill its installation.  I notified Mark Andrews about this
back then.  His response was that the IP address I gave was a Tru64 box,
and a Tru64 machine can't be used to crack an intel linux box.  I tried to
explain that this isn't the case.  So, I've stopped using ISC software.

_______________________________________________
Aurora-sparc-devel mailing list
[email protected]
http://lists.auroralinux.org/mailman/listinfo/aurora-sparc-devel
Aurora FAQ: http://www.ecs.soton.ac.uk/~mas01r/aurorafaq.html
anaconda-7.3-av8-2.patch (text/plain, 4.3 KB)
diff -r -u anaconda-7.3-1av8/loader/loader.c anaconda-7.3/loader/loader.c
--- anaconda-7.3-1av8/loader/loader.c	Sat Nov 29 23:44:35 2003
+++ anaconda-7.3/loader/loader.c	Sun Nov 30 02:02:03 2003
@@ -2720,6 +2720,9 @@
 	} else if (!strncasecmp(argv[i], "ks=http://", 10)) {
             flags |= LOADER_FLAGS_KSHTTP;
 	    *ksSource = argv[i] + 10;
+	} else if (!strncasecmp(argv[i], "ks=ftp://", 9)) {
+            flags |= LOADER_FLAGS_KSFTP;
+	    *ksSource = argv[i] + 9;
         } else if (!strcasecmp(argv[i], "ks=floppy"))
 	    flags |= LOADER_FLAGS_KSFLOPPY;
 	else if (!strncasecmp(argv[i], "display=", 8))
@@ -2908,6 +2911,90 @@
 
     return 0;
 }
+
+int kickstartFromFtp(struct knownDevices * kd, char * location, 
+		     moduleInfoSet modInfo, moduleList modLoaded, 
+		     moduleDeps * modDepsPtr, int flags, char * ksSource,
+		     char * ksDevice) {
+    struct networkDeviceConfig netDev;
+    struct iurlinfo ui;
+    char * file;
+    char * ksPath;
+    char * devName;
+    char * chptr;
+    int fd, rc;
+
+    memset(&ui, 0, sizeof(ui));
+
+    if (!ksDevice) {
+        if (ensureNetDevice(kd, modInfo, modLoaded, modDepsPtr, flags, 
+                            &devName))
+            return 1;
+    } else {
+        devName = ksDevice;
+    }
+
+    if (kickstartNetwork(&devName, &netDev, "dhcp", flags)) {
+        logMessage("no dhcp response received");
+        return 1;
+    }
+
+    writeNetInfo("/tmp/netinfo", &netDev, kd);
+
+    if (ksSource) {
+        ksPath = alloca(strlen(ksSource) + 1);
+        strcpy(ksPath, ksSource);
+    } else {
+        logMessage("no location specified");
+        return 1;
+    }
+
+    if (ksPath[strlen(ksPath) - 1] == '/') {
+        ksPath[strlen(ksPath) - 1] = '\0';
+        file = malloc(30);
+        sprintf(file, "%s-kickstart", inet_ntoa(netDev.dev.ip));
+    } else {
+        file = strrchr(ksPath, '/');
+        if (!file) {
+	    file = ksPath;
+	    ksPath = "/";
+        } else {
+	    *file++ = '\0';
+        }
+    }
+
+    logMessage("ks location: ftp:/%s/%s", ksPath, file);
+
+    ui.protocol = URL_METHOD_FTP;
+    chptr = strchr(ksPath, '/');
+    if (chptr == NULL) {
+        ui.address = strdup(ksPath);
+        ui.prefix = strdup("/");
+    } else {
+        *chptr = '\0';
+        ui.address = strdup(ksPath);
+        ksPath = chptr;
+        *ksPath = '/';
+        ui.prefix = strdup(ksPath);
+    }
+
+    fd = urlinstStartTransfer(&ui, file, 1);
+    if (fd < 0) {
+        logMessage("failed to retrieve ftp:/%s/%s/%s", ui.address, ui.prefix, file);
+        return 1;
+    }
+
+    rc = copyFileFd(fd, "/tmp/ks.cfg");
+    if (rc) {
+        unlink("/tmp/ks.cfg");
+        logMessage("failed to copy ks.cfg to /tmp/ks.cfg");
+        return 1;
+    }
+
+    urlinstFinishTransfer(&ui, fd);
+
+    return 0;
+}
 #endif
 
 int kickstartFromHardDrive(char * location, 
@@ -3607,6 +3694,13 @@
                                ksSource, ksNetDevice))
 	    flags |= LOADER_FLAGS_KICKSTART;
     }
+    if (FL_KSFTP(flags)) {
+        ksFile = "/tmp/ks.cfg";
+	startNewt(flags);
+	if (!kickstartFromFtp(&kd, ksFile, modInfo, modLoaded, &modDeps, flags,
+                               ksSource, ksNetDevice))
+	    flags |= LOADER_FLAGS_KICKSTART;
+    }
 #endif
 
     if (ksFile) {
Only in anaconda-7.3/loader: loader.c.av8-2
diff -r -u anaconda-7.3-1av8/loader/loader.h anaconda-7.3/loader/loader.h
--- anaconda-7.3-1av8/loader/loader.h	Sat Nov 29 23:44:34 2003
+++ anaconda-7.3/loader/loader.h	Sun Nov 30 02:00:30 2003
@@ -32,6 +32,7 @@
 #define LOADER_FLAGS_KSHTTP             (1 << 24)
 #define LOADER_FLAGS_MEDIACHECK         (1 << 25)
 #define LOADER_FLAGS_NOUSBSTORAGE       (1 << 26)
+#define LOADER_FLAGS_KSFTP              (1 << 27)
 
 #define FL_TESTING(a)	    ((a) & LOADER_FLAGS_TESTING)
 #define FL_EXPERT(a)	    ((a) & LOADER_FLAGS_EXPERT)
@@ -58,6 +59,7 @@
 #define FL_TELNETD(a)	    ((a) & LOADER_FLAGS_TELNETD)
 #define FL_NOPASS(a)	    ((a) & LOADER_FLAGS_NOPASS)
 #define FL_KSHTTP(a)        ((a) & LOADER_FLAGS_KSHTTP)
+#define FL_KSFTP(a)         ((a) & LOADER_FLAGS_KSFTP)
 #define FL_MEDIACHECK(a)    ((a) & LOADER_FLAGS_MEDIACHECK)
 #define FL_NOUSBSTORAGE(a)  ((a) & LOADER_FLAGS_NOUSBSTORAGE)
 
Only in anaconda-7.3/loader: loader.h.av8-2
anaconda-7.3-av8-1.patch (text/plain, 3.6 KB)
diff -r -u anaconda-7.3.orig/loader/loader.c anaconda-7.3/loader/loader.c
--- anaconda-7.3.orig/loader/loader.c	Mon Nov 24 21:19:30 2003
+++ anaconda-7.3/loader/loader.c	Thu Nov 27 20:52:49 2003
@@ -748,8 +748,8 @@
 	    if (doPwMount(filename, mntpoint, "cramfs", 1,
 			  0, NULL, NULL)) {
 	    
-		logMessage("failed to mount loop: %s", 
-			   strerror(errno));
+		logMessage("failed to mount %s on %s (loop): %s", 
+			   filename, mntpoint, strerror(errno));
 		return LOADER_ERROR;
 	    }
 	}
@@ -3803,6 +3803,8 @@
 	*argptr++ = "--rescue";
 	if (FL_RESCUE_NOMOUNT(flags))
 	    *argptr++ = "--nomount";
+	if (FL_SERIAL(flags))
+	    *argptr++ = "--serial";
     } else {
 	if (FL_SERIAL(flags))
 	    *argptr++ = "--serial";
@@ -3885,6 +3887,11 @@
 
     if (!FL_TESTING(flags)) {
 	printf(_("Running anaconda - please wait...\n"));
+	{ int i;
+	for(i=0; anacondaArgs[i] != NULL; i++)
+		printf("%s ", anacondaArgs[i]);
+	}
+	printf("\n");
     	execv(anacondaArgs[0], anacondaArgs);
         perror("exec");
     }
diff -r -u anaconda-7.3.orig/scripts/check-repository.py anaconda-7.3/scripts/check-repository.py
--- anaconda-7.3.orig/scripts/check-repository.py	Fri Jan 12 11:26:47 2001
+++ anaconda-7.3/scripts/check-repository.py	Thu Nov 27 19:32:29 2003
@@ -35,7 +35,7 @@
 import os
 import rpm
 
-import todo
+#import todo
 
 FILENAME = 1000000
 
diff -r -u anaconda-7.3.orig/scripts/mk-images anaconda-7.3/scripts/mk-images
--- anaconda-7.3.orig/scripts/mk-images	Mon Nov 24 21:19:30 2003
+++ anaconda-7.3/scripts/mk-images	Thu Nov 27 19:32:29 2003
@@ -632,17 +632,19 @@
     echo $IMAGEUUID > $tmpdir/.buildstamp
 
     if [ "$BUILDARCH" = "sparc64" ]; then
-       mkcramfs --blocksize 8192 $tmpdir $INSTIMGPATH/${imagename}1.img
+       mkcramfs --blocksize 8192 $tmpdir $INSTIMGPATH/${imagename}1-64.img
        echo "sparc64 found: using blocksize 8192"
+       size=$(ls -l $INSTIMGPATH/${imagename}1-64.img | awk '{print $5}')
     elif [ "$BUILDARCH" = "sparc" ]; then
-       mkcramfs --blocksize 4096 $tmpdir $INSTIMGPATH/${imagename}1.img 
+       mkcramfs --blocksize 4096 $tmpdir $INSTIMGPATH/${imagename}1-32.img 
        echo "sparc32 found: using blocksize 4096"
+       size=$(ls -l $INSTIMGPATH/${imagename}1-32.img | awk '{print $5}')
     else
        mkcramfs $tmpdir $INSTIMGPATH/${imagename}1.img
        echo "not sparc: no forced blocksize"
+       size=$(ls -l $INSTIMGPATH/${imagename}1.img | awk '{print $5}')
     fi
 
-    size=$(ls -l $INSTIMGPATH/${imagename}1.img | awk '{print $5}')
     size=$(expr $size / 1024)
     echo "Wrote $INSTIMGPATH/${imagename}1.img (${size}k)..."
     rm -rf $tmpdir
@@ -692,10 +694,20 @@
         SIZE=$(expr `cat $mmi_tmpimage | wc -c` / 1024)
     fi
     
-    cp $mmi_tmpimage $INSTIMGPATH/${imagename}.img
-    chmod 644 $INSTIMGPATH/${imagename}.img
+    if [ "$BUILDARCH" = "sparc64" ]; then
+        cp $mmi_tmpimage $INSTIMGPATH/${imagename}-64.img
+        chmod 644 $INSTIMGPATH/${imagename}-64.img
+        echo "Wrote $INSTIMGPATH/${imagename}-64.img (${SIZE}k)"
+    elif [ "$BUILDARCH" = "sparc" ]; then
+        cp $mmi_tmpimage $INSTIMGPATH/${imagename}-32.img
+        chmod 644 $INSTIMGPATH/${imagename}-32.img
+        echo "Wrote $INSTIMGPATH/${imagename}-32.img (${SIZE}k)"
+    else
+        cp $mmi_tmpimage $INSTIMGPATH/${imagename}.img
+        chmod 644 $INSTIMGPATH/${imagename}.img
+        echo "Wrote $INSTIMGPATH/${imagename}.img (${SIZE}k)"
+    fi
 
-    echo "Wrote $INSTIMGPATH/${imagename}.img (${SIZE}k)"
     
     rm $mmi_tmpimage
 }