--- toast-linux 2004/04/11 02:49:44 1.9 +++ toast-linux 2004/04/11 07:13:31 1.10 @@ -15,6 +15,7 @@ my($genby) = "generated by toast linux configure version $version on $gendate"; my($configure) = $0 =~ m!/! ? $0 : "./$0"; +my($prefix) = "/usr/local"; # TODO my($target) = @ARGV; if(scalar(@ARGV) != 1 || $target =~ /^-/) { @@ -49,6 +50,7 @@ $text{"Makefile"} =~ s/!GENBY!/$genby/g; $text{"Makefile"} =~ s/!VERSION!/$version/g; $text{"Makefile"} =~ s/!CONFIGURE!/$configure/g; +$text{"Makefile"} =~ s/!PREFIX!/$prefix/g; my($ok); for(sort(keys(%text))) @@ -170,17 +172,22 @@ PKGDIR = root/toast/pkg BUSYBOX_ROOTDIR = $(PKGDIR)/busybox/v$(BUSYBOX_VERSION)/1/root SCRIPTS_ROOTDIR = $(PKGDIR)/scripts/v$(VERSION)/1/root -OTHER_ROOTDIR = $(PKGDIR)/disk-utils/v0/1/root +OTHER_ROOTDIR = $(PKGDIR)/disk-utils/v$(VERSION)/1/root -DIST_TARBALL = toast-linux-$(VERSION).tar.gz +INSTALL_DIR = $(DESTDIR)!PREFIX! +INSTALL_BIN_DIR = $(INSTALL_DIR)/bin +INSTALL_MAN_DIR = $(INSTALL_DIR)/man/man1 -all: floppy.img - $(MDIR) -a -i $< :: +PROGRAM = toast-linux +MAN_PAGE = $(PROGRAM).1 -# XXX -install: floppy.img - cp $< ~/www/toastball.net/ +all: $(PROGRAM) $(MAN_PAGE) +install: all + mkdir -p $(INSTALL_BIN_DIR) $(INSTALL_MAN_DIR) + cp $(PROGRAM) $(INSTALL_BIN_DIR)/$(PROGRAM) + cp $(MAN_PAGE) $(INSTALL_MAN_DIR)/$(MAN_PAGE) + # surely there must be a way to avoid writing out these rules: $(TOOLCHAIN_ARCHIVE): ; $(WGET) $(TOOLCHAIN_URL) $(LINUX_ARCHIVE): ; $(WGET) $(LINUX_URL) @@ -201,6 +208,8 @@ cleaner: clean rm -f *.tar.gz *.tar.bz2 *.diff.gz +.DELETE_ON_ERROR: + $(LINUX_DIR)/.config: $(LINUX_ARCHIVE) linux-config smartcat rm -fr $(LINUX_DIR) ./smartcat $< | tar x @@ -273,7 +282,7 @@ symbols: $(BUSYBOX) $(E2FSCK) $(TUNE2FS) $(NTFSRESIZE) $(PARTED) $(DEVMAP) $(LVM2) $(TOOLCHAIN_BIN_DIR)/nm -Dp $^ | perl -lne '/.{8} [BUV] (.+)/ && print "-u $$1"' | sort -u > $@ -Makefile dev mkhd bochs-config: !CONFIGURE! +Makefile dev toast-linux.stub mkhd bochs-config: !CONFIGURE! !CONFIGURE! $@ # these depend on configure, but we pretend they don't to speed things up: @@ -334,15 +343,24 @@ cp rootfs.gz $@/initrd cp skel/floppy/* $@ -floppy.img: floppy $(MFORMAT) $(SYSLINUX) +floppy.img: floppy $(MFORMAT) $(SYSLINUX) $(MCOPY) $(MDIR) rm -f $@ $(MFORMAT) -C -v "toast linux" -f $(FLOPPY_SIZE) -r 1 -i $@ :: $(SYSLINUX) $@ $(MCOPY) -i $@ -s $</* :: + $(MDIR) -a -i $@ :: -cd.iso: floppy.img - mkisofs -o $@ -b $< $< +cd.iso: floppy.img $(MKISOFS) + $(MKISOFS) -o $@ -b $< $< +toast-linux: toast-linux.stub cd.iso.gz + rm -f $@ + cat $^ > $@ + chmod +x $@ + +toast-linux.1: toast-linux.stub + pod2man $< > $@ + run: floppy.img bochs-config ./mkhd hda.img $(HDA_CYLINDERS) HDA_CYLINDERS=$(HDA_CYLINDERS) bochs -qf bochs-config @@ -367,6 +385,92 @@ %.gz: % gzip -9 -c $< > $@ + +--- FILE toast-linux.stub --- +#!/usr/bin/perl + +use warnings; +use strict; + +=head1 NAME + +toast-linux - create toast linux install floppy or CD + +=head1 SYNOPSIS + +B<toast-linux> I<TODO: insert options here> + +=head1 DESCRIPTION + +TODO: describe toast linux in general, what the installer does, and what +this program does + +=head1 AVAILABILITY + +TODO: link to source and precompiled versions +TODO: figure out what kind of license I can use for this thing (GPL?) + +=head1 BUGS + +Known bugs: + + - is not finished + - does not actually work + - missing documentation + - no web page + +Wish list: + + - this program should be able to write a floppy or CD in one step + - this program should be usable under ActiveState Perl (Windows) + - this program should be able to configure defaults for installer + - install disk should double as a rescue disk including e2fsck + - install disk should automatically resize FAT and NTFS partitions + - Makefile should build and use its own mkisofs + +=head1 SEE ALSO + +TODO: refer to toast itself, some other distributions like Gentoo +and Debian, some of the constitutent software like BusyBox + +=head1 AUTHOR + +Jacques Frechet + +=cut + +my($floppy); # TODO: make true if writing floppy image, false for cd + +if($floppy) +{ + my($pid) = open(STDOUT, "|-"); + die("fork: $!") unless defined($pid); + binmode(STDOUT); + if(!$pid) + { + binmode(STDIN); + my($i, $rc, $buf, $on) = 0; + while($rc = read(STDIN, $buf = "", 512, 0)) + { + next unless $on ||= /^...SYSLINUX.{32}TOAST LINUXFAT12/; + print($buf) || die("write: $!"); + $on &&= ++$i < 2880; + } + die("read: $!") unless defined($rc); + die("error: wrote $i sectors") unless $i == 2880; + close(STDOUT) || die("close: $!"); + exit(0); + } +} + +open(STDOUT, "| gzip -cd") || die("spawn gzip: $!"); +binmode(STDOUT); +binmode(DATA); +my($rc, $buf); +print($buf) || die("write: $!") while $rc = read(DATA, $buf = "", 8192, 0); +close(STDOUT) || die("close: $!"); + +__DATA__ --- FILE dev --- drwx /dev