Re: Assorted patches for Debian boot-floppies package
"Stephen R. van den Berg" <srb@cuci.nl> writes:
> This patch fixes several things:
> - Allow the actual image to decide if it does or doesn't fit.
> - Make sure the library paths are corrected for the standard prefix.
> - Test for the modprobe proc/sys entry, in case it's not in the kernel,
> it has a tendency to hang.
> - Enhance functionality of ping by letting it ping once per second until
> response is received (good for programmatic reachability tests).
Uh, this message was sent to me personally, so it never got processed.
Sorry. You should send to debian-boot@lists.debian.org.
Are these patches still relevant? Are they correct?
> diff -U 2 -b -B -p -r -d --horizon-lines=2 -X xdiff boot-floppies.old/rescue.sh boot-floppies/rescue.sh
> --- boot-floppies.old/rescue.sh Mon Jan 24 11:52:57 2000
> +++ boot-floppies/rescue.sh Mon Feb 28 03:13:47 2000
> @@ -423,9 +425,7 @@ fi
>
> # copy root.bin to 2880k floppies
> -if [ \( "$arch" = i386 -a "$blocks" = "2880" \) -o \
> - \( "$arch/$system" = "m68k/bvme6000" -a "$blocks" = "2880" \) -o \
> - \( "$arch" = powerpc -a "$revext" != -graphical -a "$blocks" != "1440" \) ]; then
> - info "copying root filesystem ($rootimage) into filesystem"
> - cp $rootimage $mnt/root.bin
> +if cp $rootimage $mnt/root.bin 2>/dev/null
> +then
> + info "copied root filesystem ($rootimage) into filesystem"
> else
> info "rescue image too small to include root.bin"
> diff -U 2 -b -B -p -r -d --horizon-lines=2 -X xdiff boot-floppies.old/rootdisk.sh boot-floppies/rootdisk.sh
> --- boot-floppies.old/rootdisk.sh Sun Jan 23 09:27:49 2000
> +++ boot-floppies/rootdisk.sh Mon Feb 28 03:14:58 2000
> @@ -416,5 +418,6 @@ fi
> # we have all the required libraries -- copy them under $R
> TMP=`LD_LIBRARY_PATH=$E/lib:$E/usr/lib ldd $EXECUTABLES 2>/dev/null | \
> - awk -- '{print $3}' | fgrep -v "dynamic" | sort -u`
> + awk -- '{print $3}' | sed -e "s%^/lib/ld%$E/lib/ld%" | \
> + fgrep -v "dynamic" | sort -u`
> for i in $TMP; do
> j=`echo $i | sed -e "s%^$E%.%g" -e "s%^/%./%" `
> diff -U 2 -b -B -p -r -d --horizon-lines=2 -X xdiff boot-floppies.old/scripts/rootdisk/prototype/etc/init.d/rcS boot-floppies/scripts/rootdisk/prototype/etc/init.d/rcS
> --- boot-floppies.old/scripts/rootdisk/prototype/etc/init.d/rcS Thu Jan 20 08:46:22 2000
> +++ boot-floppies/scripts/rootdisk/prototype/etc/init.d/rcS Mon Feb 28 03:05:13 2000
> @@ -2,4 +2,5 @@
>
> # disable modprobe calls
> +test -f /proc/sys/kernel/modprobe &&
> echo "/bin/true" >/proc/sys/kernel/modprobe
>
> diff -U 2 -b -B -p -r -d --horizon-lines=2 -X xdiff boot-floppies.old/utilities/busybox/ping.c boot-floppies/utilities/busybox/ping.c
> --- boot-floppies.old/utilities/busybox/ping.c Wed Jan 26 07:28:39 2000
> +++ boot-floppies/utilities/busybox/ping.c Mon Feb 28 03:05:13 2000
> @@ -55,4 +55,5 @@
> #define MAXWAIT 10
> #define PINGINTERVAL 1 /* second */
> +#define TIMEOUT 4
>
> #define O_QUIET (1 << 0)
> @@ -94,8 +95,28 @@ static const char* ping_usage = "ping ho
> static char* hostname = NULL;
>
> -static void noresp(int ign)
> +static int pingsock;
> +static char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
> +static struct sockaddr_in pingaddr;
> +
> +static void sendping(int ign)
> {
> + int c;
> + static unsigned maxpings = TIMEOUT;
> +
> + if (!--maxpings) {
> printf("No response from %s\n", hostname);
> - exit(0);
> + exit(2);
> + }
> +
> + c = sendto(pingsock, packet, sizeof(packet), 0,
> + (struct sockaddr *)&pingaddr, sizeof(struct sockaddr_in));
> +
> + if (c < 0 || c != sizeof(packet)) {
> + if (c < 0) perror("ping");
> + fprintf(stderr, "ping: write incomplete\n");
> + exit(1);
> + }
> + signal(SIGALRM, sendping);
> + alarm(PINGINTERVAL);
> }
>
> @@ -103,8 +124,5 @@ static int ping(const char *host)
> {
> struct hostent *h;
> - struct sockaddr_in pingaddr;
> struct icmp *pkt;
> - int pingsock, c;
> - char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
>
> if ((pingsock = socket(AF_INET, SOCK_RAW, 1)) < 0) { /* 1 == ICMP */
> @@ -130,19 +148,11 @@ static int ping(const char *host)
> pkt->icmp_cksum = in_cksum((unsigned short *)pkt, sizeof(packet));
>
> - c = sendto(pingsock, packet, sizeof(packet), 0,
> - (struct sockaddr *)&pingaddr, sizeof(struct sockaddr_in));
> -
> - if (c < 0 || c != sizeof(packet)) {
> - if (c < 0) perror("ping");
> - fprintf(stderr, "ping: write incomplete\n");
> - exit(1);
> - }
> + sendping(0);
>
> - signal(SIGALRM, noresp);
> - alarm(5); /* give the host 5000ms to respond */
> /* listen for replies */
> while (1) {
> struct sockaddr_in from;
> size_t fromlen = sizeof(from);
> + int c;
>
> if ((c = recvfrom(pingsock, packet, sizeof(packet), 0,
> --
> Sincerely, srb@cuci.nl
> Stephen R. van den Berg (AKA BuGless).
>
> "Am I paying for this abuse or is it extra?"
>
>
--
.....Adam Di Carlo....adam@onShore.com.....<URL:http://www.onShore.com/>
Reply to: