--- toast-linux 2004/04/13 19:55:57 1.14 +++ toast-linux 2004/04/13 21:25:28 1.15 @@ -58,13 +58,13 @@ # looks like SYSLINUX doesn't support tabs.... # TODO: banish non-printing characters from configure script -#for($text{"skel/floppy/logo"}) +#for($text{"floppy/logo"}) #{ # s!^(( {8})+)!"\t" x (length($1)/8)!mge; #} my($oldcfg); -for($text{"skel/floppy/syslinux.cfg"}) +for($text{"floppy/syslinux.cfg"}) { $_ .= "# pad to fill one 512-byte sector\n" while length($_) < 512; s/\n/\r\n/g; @@ -207,11 +207,6 @@ SYSLINUX = $(SYSLINUX_DIR)/syslinux MKISOFS = $(CDRTOOLS_DIR)/mkisofs/mkisofs -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/v$(VERSION)/1/root - INSTALL_DIR = $(DESTDIR)!PREFIX! INSTALL_BIN_DIR = $(INSTALL_DIR)/bin INSTALL_MAN_DIR = $(INSTALL_DIR)/man/man1 @@ -242,7 +237,7 @@ $(CDRTOOLS_ARCHIVE): ; $(WGET) $(CDRTOOLS_URL) clean: - rm -fr $(PKG_DIRS) symbols floppy* cd* root* toast-linux* $(FROMCONF) $(FROMCONF2) skel + rm -fr $(PKG_DIRS) symbols floppy* cd* root* toast-linux* $(FROMCONF) $(FROMCONF2) cleaner: clean rm -f *.tar.gz *.tar.bz2 *.diff.gz @@ -331,32 +326,23 @@ $(FROMCONF2): !CONFIGURE! $@ -skel: !CONFIGURE! +root: $(LINUX) symbols !CONFIGURE! rm -fr $@ !CONFIGURE! $@ - mkdir -p $@/root/{root,proc,sys,tmp,mnt/{floppy,root},var/{empty,run,log,lock},usr/man} - for i in bin lib sbin share; do ln -sf usr/$$i $@/root/$$i; done - ln -sf ../usr/share/zoneinfo/"`cat $@/root/etc/TZ`" $@/root/etc/localtime + mkdir -p $@/{root,proc,sys,tmp,mnt/{floppy,root},var/run} + ln -s . $@/usr + install -D $(TOOLCHAIN_LIB_DIR)/ld-uClibc.so.0 $@/lib/ld-uClibc.so.0 + install -D $(TOOLCHAIN_LIB_DIR)/libdl.so.0 $@/lib/libdl.so.0 + gcc -s -nostdlib -Wl,-warn-common -shared -o $@/lib/libc.so.0 `cat symbols` $(TOOLCHAIN_LIB_DIR)/libc.a + $(MAKE) -C $(BUSYBOX_DIR) PREFIX=$(CURDIR)/$@ install +# install -D $(E2FSCK) $@/sbin/e2fsck + install -D $(TUNE2FS) $@/sbin/tune2fs +# install -D $(NTFSRESIZE) $@/sbin/ntfsresize + install -D $(PARTED) $@/sbin/parted + install -D $(DEVMAP) $@/lib/libdevmapper.so.1.00 + install -D $(LVM2) $@/sbin/lvm + for i in `cat $(LVM2_DIR)/tools/.commands`; do ln -s lvm $@/sbin/$$i; done -root: $(LINUX) symbols skel - rm -fr $@ - mkdir -p $(SCRIPTS_ROOTDIR) - set -e; (cd skel/root && tar c .) | (cd $@ && tar x) - set -e; (cd skel/scripts && tar c .) | (cd $(SCRIPTS_ROOTDIR) && tar x) - install -D $(TOOLCHAIN_LIB_DIR)/ld-uClibc.so.0 $(BUSYBOX_ROOTDIR)/lib/ld-uClibc.so.0 - install -D $(TOOLCHAIN_LIB_DIR)/libdl.so.0 $(BUSYBOX_ROOTDIR)/lib/libdl.so.0 - gcc -s -nostdlib -Wl,-warn-common -shared -o $(BUSYBOX_ROOTDIR)/lib/libc.so.0 `cat symbols` $(TOOLCHAIN_LIB_DIR)/libc.a - $(MAKE) -C $(BUSYBOX_DIR) PREFIX=$(CURDIR)/$(BUSYBOX_ROOTDIR) install -# install -D $(E2FSCK) $(OTHER_ROOTDIR)/sbin/e2fsck - install -D $(TUNE2FS) $(OTHER_ROOTDIR)/sbin/tune2fs -# install -D $(NTFSRESIZE) $(OTHER_ROOTDIR)/sbin/ntfsresize - install -D $(PARTED) $(OTHER_ROOTDIR)/sbin/parted - install -D $(DEVMAP) $(OTHER_ROOTDIR)/lib/libdevmapper.so.1.00 - install -D $(LVM2) $(OTHER_ROOTDIR)/sbin/lvm - for i in `cat $(LVM2_DIR)/tools/.commands`; do ln -s lvm $(OTHER_ROOTDIR)/sbin/$$i; done - for i in $(BUSYBOX_ROOTDIR) $(SCRIPTS_ROOTDIR) $(OTHER_ROOTDIR); do echo "built by toast linux $(VERSION) on `date`" > $$i/../build.log; done - toast --noprotect --relative --storedir=$(CURDIR)/root/toast --armdir=$(CURDIR)/root/usr --arm - $(GENEXT2FS): $(GENEXT2FS_ARCHIVE) $(GENEXT2FS_PATCH) smartcat rm -fr $(GENEXT2FS_DIR) ./smartcat $< | tar x @@ -384,12 +370,11 @@ rm -f $@ $(GENEXT2FS) -d root -f dev -b $(ROOTFS_BLOCKS) -i $(ROOTFS_INODES) $@ -floppy: $(LINUX) rootfs.gz skel +floppy: $(LINUX) rootfs.gz !CONFIGURE! rm -fr $@ - mkdir $@ + !CONFIGURE! $@ cp $(LINUX) $@/linux cp rootfs.gz $@/initrd - cp skel/floppy/* $@ floppy.img: floppy $(MFORMAT) $(SYSLINUX) $(MCOPY) $(MDIR) rm -f $@ @@ -660,14 +645,14 @@ user_shortcut: keys=ctrlaltdel # no cmosimage ---- FILE skel/floppy/syslinux.cfg --- +--- FILE floppy/syslinux.cfg --- display logo prompt 1 timeout 200 f1 help append initrd=initrd root=/dev/ram0 rw ---- FILE skel/floppy/logo --- +--- FILE floppy/logo --- 6e 07 6e 07 @@ -692,7 +677,7 @@ Press 0fF107 within 20 seconds, or risk losing the contents of all hard disks! ---- FILE skel/floppy/help --- +--- FILE floppy/help --- By default, the network will be configured automatically using DHCP. All available network interfaces will be tried sequentially, starting with eth0; the first one that responds to DHCP will be used. You can @@ -717,7 +702,7 @@ DISKS=hda,hdb,sda install on specified disks only DESTROY=yes overwrite existing disk contents ---- FILE skel/root/etc/passwd --- +--- FILE root/etc/passwd --- root:x:0:0:root:/root:/bin/sh bin:x:1:1:bin:/bin:/bin/false daemon:x:2:2:daemon:/sbin:/bin/false @@ -735,7 +720,7 @@ toast:x:42:42:toast:/toast:/bin/sh nobody:x:99:99:nobody:/:/bin/false ---- FILE skel/root/etc/group --- +--- FILE root/etc/group --- root:x:0:root bin:x:1:bin daemon:x:2:daemon @@ -763,28 +748,28 @@ users:x:100: nofiles:x:65533: ---- FILE skel/root/etc/hosts --- +--- FILE root/etc/hosts --- 127.0.0.1 localhost ---- FILE skel/root/etc/host.conf --- +--- FILE root/etc/host.conf --- order hosts,bind multi on ---- FILE skel/root/etc/nsswitch.conf --- +--- FILE root/etc/nsswitch.conf --- hosts: files dns ---- FILE skel/root/etc/resolv.conf --- +--- FILE root/etc/resolv.conf --- nameserver 205.217.153.34 ---- FILE skel/root/etc/TZ --- +--- FILE root/etc/TZ --- PST8PDT ---- FILE skel/root/etc/ld.so.conf --- +--- FILE root/etc/ld.so.conf --- ---- FILE skel/root/etc/syslog.conf --- +--- FILE root/etc/syslog.conf --- *.* /var/log/syslog ---- FILE skel/root/etc/fstab --- +--- FILE root/etc/fstab --- /dev/ram0 / ext2 rw 0 0 proc /proc proc rw 0 0 sys /sys sysfs rw 0 0 @@ -792,20 +777,20 @@ /dev/fd0 /mnt/floppy vfat rw,noauto,sync 0 0 /dev/toast/root /mnt/root ext2 rw,noauto 0 0 ---- FILE skel/root/etc/fstab.hd --- +--- FILE root/etc/fstab.hd --- /dev/toast/root / ext3 rw 0 0 proc /proc proc rw 0 0 sys /sys sysfs rw 0 0 devpts /dev/pts devpts rw 0 0 /dev/fd0 /mnt/floppy vfat rw,noauto,sync 0 0 ---- FILE skel/root/etc/mtab --- +--- FILE root/etc/mtab --- /dev/ram0 / ext2 rw 0 0 ---- FILE skel/root/etc/mtab.hd --- +--- FILE root/etc/mtab.hd --- /dev/ram0 / ext2 rw 0 0 ---- FILE skel/root/etc/lilo.conf --- +--- FILE root/etc/lilo.conf --- boot = /dev/hda root = /dev/ram0 initrd = /usr/boot/initrd.gz @@ -839,17 +824,17 @@ label = toast.oldkernel.oldinitrd optional ---- FILE skel/root/etc/profile --- +--- FILE root/etc/profile --- PS1='\u@\h:\w\$ ' ---- FILE skel/root/etc/inittab --- +--- FILE root/etc/inittab --- ::sysinit:/etc/init.d/rcS ::respawn:-/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/sbin/swapoff -a ::shutdown:/bin/umount -a -r ---- FILE skel/root/etc/init.d/rcS --- +--- FILE root/etc/init.d/rcS --- #!/bin/sh devices mount -a @@ -857,7 +842,7 @@ hostname localhost autoinstall ---- FILE skel/scripts/sbin/autoinstall --- +--- FILE root/sbin/autoinstall --- #!/bin/sh -e echo "Configuring network." network @@ -872,9 +857,9 @@ rm /tmp/partition.tmp swap migrate -chroot /mnt/root toaststrap +toaststrap ---- FILE skel/scripts/sbin/network --- +--- FILE root/sbin/network --- #!/bin/sh IF="`echo \"$DNS\" | sed -e 's/[^a-z0-9]/ /g; s/^ *//; s/ *$//'`" @@ -939,7 +924,7 @@ echo "Unable to configure network." exit 1 ---- FILE skel/scripts/share/udhcpc/default.script --- +--- FILE root/share/udhcpc/default.script --- #!/bin/sh case "$1" in @@ -982,7 +967,7 @@ exit 0 ---- FILE skel/scripts/sbin/timeout --- +--- FILE root/sbin/timeout --- #!/bin/sh seconds="$1" @@ -1003,21 +988,11 @@ echo -ne '\r \r' [ -z "$key" ] ---- FILE skel/scripts/sbin/migrate --- -#!/bin/sh +--- FILE root/sbin/migrate --- +#!/bin/sh -e target="/mnt/root" -dirs="" -for i in `cd / && echo *`; do - case "$i" in - mnt|proc|sys|lost+found) ;; - *) dirs="$dirs $i" ;; - esac -done - -set -e - mount "$target" if [ "`cd /$target; echo *`" != "lost+found" ]; then @@ -1025,28 +1000,27 @@ exit 1 fi -(cd / && tar c $dirs) | (cd "$target" && tar x) +(cd / && tar c dev etc bin/busybox lib) | (cd "$target" && tar x) -if [ ! -x "$target/sbin/init" ]; then - echo "migration failed: $target" >&2 - exit 1 -fi - -for i in mnt proc sys; do - mkdir "$target/$i" +for i in mnt/floppy proc sys usr/man var/empty var/lock var/run var/log; do + mkdir -p "$target/$i" done -for i in `cd /mnt && echo *`; do - mkdir "$target/mnt/$i" -done - for i in `cd "$target/etc" && echo *.hd`; do mv "$target/etc/$i" "$target/etc/`basename $i .hd`" done +ln -s "../usr/share/zoneinfo/`cat /etc/TZ`" "$target/etc/localtime" +ln -s vim "$target/bin/vi" +ln -s gcc "$target/bin/cc" +ln -s bash "$garget/bin/sh.off.off" + +chroot "$target" /bin/busybox --install +# TODO: toastify busybox (bin, sbin, lib) + # TODO: adjust permissions ---- FILE skel/scripts/sbin/devices --- +--- FILE root/sbin/devices --- #!/bin/sh process() @@ -1079,7 +1053,7 @@ chmod 666 /dev/null ---- FILE skel/scripts/sbin/swap --- +--- FILE root/sbin/swap --- #!/bin/sh # If available memory is less than "goalmegs" megabytes, create and activate @@ -1106,7 +1080,7 @@ echo "$lvpath swap swap defaults 0 0" >> /etc/fstab swapon -a ---- FILE skel/scripts/sbin/partition --- +--- FILE root/sbin/partition --- #!/bin/sh # Environment variables: @@ -1345,15 +1319,33 @@ echo "parted -s $lvpath -- mkpartfs primary ext2 0 -0" echo "tune2fs -j $lvpath" ---- FILE skel/scripts/sbin/utoast --- +--- FILE root/sbin/lilo --- #!/bin/sh -# -# utoast -- minimal toast replacement shell script -# -# Intended for use in a busybox-only environment. -# Emulates just enough of "toast arm" to set things up for the real toast. -# +exec chroot /mnt/root lilo "$@" +--- FILE root/sbin/toast --- +#!/bin/sh + +# XXX use local squid proxy to reduce bandwidth consumption for testing: +export http_proxy=http://cli-03:3128/ +export ftp_proxy=http://cli-03:3128/ + +[ -z "$TOAST_ARMDIR" ] && export TOAST_ARMDIR=/usr +[ -x /mnt/root/bin/busybox ] && export TOAST_PRELOAD=false +exec chroot /mnt/root /bin/toast "$@" + +--- FILE root/sbin/utoast --- +#!/bin/sh + +# utoast - minimal toast replacement script for toast linux toaststrap process + +# paths to use: +chrootdir=/mnt/root +relstoredir=/toast +relarmdir=/usr +storedir="$chrootdir""$relstoredir" +armdir="$chrootdir""$relarmdir" + # functions announce() @@ -1373,11 +1365,6 @@ exit 1 } -# read environment variables - -storedir="$TOAST_STOREDIR" -armdir="$TOAST_ARMDIR" - # parse command line name="$1" @@ -1387,11 +1374,6 @@ # remaining args are urls [ -n "$*" ] || error "usage: $0 name version url..." -# apply defaults - -[ -n "$storedir" ] || storedir=/toast -[ -n "$armdir" ] || armdir=/usr/local - # add namedir="$storedir/pkg/$name" @@ -1432,8 +1414,12 @@ build=1 builddir="$verdir/$build" +relbuilddir="$relstoredir/$name/v$version/$build" srcdir="$builddir/src" +relsrcdir="$relbuilddir/src" rootdir="$builddir/root" +relrootdir="$relbuilddir/root" + announce mkdir "$builddir" mkdir "$builddir" || error @@ -1494,14 +1480,18 @@ # configure makedir="$srcdir" - subdir=`echo "$makedir"/*` - [ -d "$subdir" ] && makedir="$subdir" + relmakedir="$relsrcdir" + subdir=`cd $makedir && echo *` + if [ -d "$subdir" ]; then + makedir="$makedir/$subdir" + relmakedir="$relmakedir/$subdir" + fi unconfigured=true for confprog in configure.gnu configure; do if $unconfigured && [ -x "$makedir/$confprog" ]; then - announce "(cd $makedir && ./$confprog --prefix=$armdir)" - (cd "$makedir" && ./$confprog --prefix="$armdir") || error + announce chroot "$chrootdir" sh -c "cd $makedir && ./$confprog --prefix=$relarmdir" + chroot "$chrootdir" sh -c "cd $makedir && ./$confprog --prefix=$relarmdir" || error unconfigured=false fi done @@ -1518,23 +1508,17 @@ # bootstrap GNU make itself; work around apparent make 3.80 build.sh bug announce "sed -e 's/\@REMOTE\@/stub/' < $makedir/build.sh > $makedir/build.sh.patched" sed -e 's/\@REMOTE\@/stub/' < "$makedir/build.sh" > "$makedir/build.sh.patched" || error - announce "(cd $makedir && sh build.sh.patched)" - (cd "$makedir" && sh build.sh.patched) || error - announce "(cd $makedir && PATH=$PATH:$makedir make install DESTDIR=$rootdir)" - (cd "$makedir" && PATH="$PATH:$makedir" make install DESTDIR="$rootdir") || error + announce chroot "$chrootdir" sh -c "cd $makedir && sh build.sh.patched" + chroot "$chrootdir" sh -c "cd $makedir && sh build.sh.patched" || error + announce PATH="$PATH:$relmakedir" chroot "$chrootdir" make -C "$makedir" install DESTDIR="$relrootdir" + PATH="$PATH:$relmakedir" chroot "$chrootdir" make -C "$makedir" install DESTDIR="$relrootdir" || error else - announce "(cd $makedir && make all install DESTDIR=$rootdir)" - (cd "$makedir" && make all install DESTDIR="$rootdir") || error + announce chroot "$chrootdir" make -C "$makedir" all install DESTDIR="$relrootdir" + chroot "$chrootdir" make -C "$makedir" all install DESTDIR="$relrootdir" || error fi # fix rootdir - for lib in "$rootdir"/lib/*.so; do - if [ -r $lib ]; then - explain "TODO: fix links for $lib" - fi - done - announce chmod -R -w "$rootdir" chmod -R -w "$rootdir" || error @@ -1563,6 +1547,7 @@ (cd "$rootdir" && find .) | while read -r rel; do rootfile="$rootdir/$rel" + relrootfile="$relrootdir/$rel" armfile="$armdir/$rel" if [ -d "$rootfile" ]; then @@ -1573,21 +1558,14 @@ else [ -d "$armfile" ] && error "$armfile is a directory but $rootfile isn't" displace "$armfile" - announce ln -s "$rootfile" "$armfile" - ln -s "$rootfile" "$armfile" || error + announce ln -s "$relrootfile" "$armfile" + ln -s "$relrootfile" "$armfile" || error fi done ---- FILE skel/scripts/sbin/toaststrap --- +--- FILE root/sbin/toaststrap --- #!/bin/sh -e -# XXX use local squid proxy to reduce bandwidth consumption for testing: -export http_proxy=http://cli-03:3128/ -export ftp_proxy=http://cli-03:3128/ - -export TOAST_ARMDIR=/usr -export TOAST_PRELOAD=false - # Step 1: Download the minimum required binary packages. # These are all stolen from Debian testing. # I'm including a perl binary here because perl refuses to build without comm, @@ -1649,11 +1627,6 @@ # continue running without knowing the correct location of perl: toast rebuild perl toast remove deb-ncurses deb-glibc deb-bash -# When compiled from source, bash doesn't create a /bin/sh symlink, which -# means that /bin/sh is now busybox ash again, which won't work. Fix it: -ln -sf bash /bin/sh -# While we're at it, util-linux expects to be able to compile C with "cc": -ln -sf gcc /bin/cc # Step 4: Replace busybox with full GNU/Linux tools. @@ -1674,11 +1647,11 @@ toast arm http://udhcp.busybox.net/source/udhcp-0.9.8.tar.gz toast arm http://ftp.gnu.org/gnu/diffutils/diffutils-2.8.1.tar.gz toast arm ftp://ftp.vim.org/pub/vim/unix/vim-6.2.tar.bz2 -ln -sf vim /bin/vi -toast remove busybox disk-utils -# Now that uClibc is gone, it's safe to re-enable the LD_PRELOAD hack, -# which is good because a few packages need it in order to install properly: -unset TOAST_PRELOAD +toast remove busybox + +# Some of these packages can't be installed until busybox is gone because +# they require the LD_PRELOAD hack in order to install correctly: + toast arm http://mirrors.kernel.org/sources.redhat.com/bzip2/v102/bzip2-1.0.2.tar.gz toast arm http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.4.1.tar.gz toast arm http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-1.60.tar.bz2 @@ -1734,7 +1707,7 @@ # reorder and/or rebuild packages to take full advantage of optional libraries # garnome2toast ---- FILE skel/scripts/sbin/respin --- +--- FILE root/sbin/respin --- #!/bin/sh -e echo "This script destroys both the hard disk partition table and the floppy." echo "Press any key to abort." @@ -2602,7 +2575,7 @@ CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set # CONFIG_FEATURE_VERBOSE_USAGE is not set -# CONFIG_FEATURE_INSTALLER is not set +CONFIG_FEATURE_INSTALLER=y # CONFIG_LOCALE_SUPPORT is not set # CONFIG_FEATURE_DEVFS is not set CONFIG_FEATURE_DEVPTS=y