No empty .Rs/.Re
[netbsd-mini2440.git] / distrib / atari / floppies / tos / build_image.sh
blob52976a642d045ae924fb61a68fbfdaeb2b8ec7fa
1 #!/bin/sh
2 # $NetBSD: build_image.sh,v 1.1.1.1 2002/09/10 13:58:51 leo Exp $
3 # This script is a quick hack to generate the various floppies in the
4 # 'installation/floppies' directory. This script cannot be run in the
5 # build environment, it is provided as a howto.
6 # When msdos support is added to makefs, it makes sense to provide a
7 # decent script that can be integrated into the build environment.
9 # Leo 10 Sept. 2002.
11 DESTDIR=/tmp/flop_images
12 TOOLDIR=/tmp/flop_tools
13 KERNEL_DIR=/tmp/kernels
14 MNT_DIR=/mnt2
15 VND_DEV=vnd0
16 SUDO=sudo
18 IMAGE720="boot BOOT"
19 IMAGE144="hades_boot HADES milan_isa_boot MILAN-ISAIDE"
20 IMAGE144="$IMAGE144 milan_pci_boot MILAN-PCIIDE"
21 TOOLS="chg_pid.ttp file2swp.ttp loadbsd.ttp rawwrite.ttp aptck.ttp"
23 unpack_tools() {
24 if [ ! -d $TOOLDIR ]; then
25 mkdir $TOOLDIR;
27 for i in $TOOLS
29 cat ${i}.gz.uu | (cd $TOOLDIR; uudecode)
30 gunzip -f $TOOLDIR/${i}.gz
31 done
34 do_images() {
35 base_img=$1; geom=$2; shift 2
37 while : ; do
38 if [ -z "$1" ]; then
39 break;
41 cat ${base_img}.fs.gz.uu | (cd /tmp; uudecode)
42 gunzip /tmp/${base_img}.fs.gz
43 $SUDO vnconfig $VND_DEV /tmp/${base_img}.fs $geom
44 $SUDO mount -t msdos /dev/${VND_DEV}c ${MNT_DIR}
46 # Copy the kernel first...
47 cp ${KERNEL_DIR}/netbsd-${2}.gz ${MNT_DIR}/netbsd
49 # Thereafter the tools, some may not fit :-(
50 for i in $TOOLS; do
51 cp $TOOLDIR/$i ${MNT_DIR} 2> /dev/null
52 if [ $? -ne 0 ]; then
53 echo "$i does not fit on ${1}.fs"
54 rm -f ${MNT_DIR}/$i
56 done
57 echo "Contents of ${1}.fs:\n"; ls -l ${MNT_DIR}
59 $SUDO umount ${MNT_DIR}
60 $SUDO vnconfig -u ${VND_DEV}
61 mv /tmp/${base_img}.fs /tmp/$1.fs
62 gzip -9n /tmp/$1.fs
63 mv /tmp/$1.fs.gz $DESTDIR
64 shift 2
65 done
69 if [ ! -d $DESTDIR ]; then
70 mkdir $DESTDIR
73 if [ ! -d $KERNEL_DIR ]; then
74 echo "Please put the kernel images in $KERNEL_DIR!!"
75 exit 1
77 rm -f $TOOLDIR/* $DESTDIR/*
79 unpack_tools
80 do_images boot720 "512/18/1/80" ${IMAGE720}
81 do_images boot144 "512/18/2/80" ${IMAGE144}
83 echo "The images can be found in: $DESTDIR"