3 # mkdist 3.6 - Make a Minix distribution Author: Kees J. Bot
11 Minix
) echo "Usage: $0" >&2
13 Minix-vmd
) echo "Usage: $0 base-path root-device usr-device" >&2
19 while getopts '' opt
; do usage
; done
20 shift `expr $OPTIND - 1`
29 *) # Move out of /usr.
30 cp -p "$0" /tmp
/mkdist
35 export PATH
=/bin
:/usr
/bin
38 # Called by an external script from Minix-vmd to help make a distribution.
40 base
="$1" rootdev
="$2" usrdev
="$3"
54 `test -f $base/usr/bin/mtools || echo bin/dosdir bin/dosread bin/doswrite`
55 `test -f $base/usr/bin/mtools && echo bin/mtools`
96 `cd $base/usr && echo lib/keymaps/*`
108 # Find the root device, and the real root device.
110 realroot
=`printroot -r`
111 if [ $realroot = $root ]
115 umount
$root >/dev
/null
2>&1
116 mount
$root /root ||
exit
121 The installation root and /usr can be put on either one diskette of at least
122 1.2 Mb, or on two diskettes of at least 720 kb.
124 Do you want to use a single diskette of at least 1.2 Mb? [y] "; read single
133 echo -n "Which drive to use? [0] "; read drive
139 *) echo "Please type '0' or '1'" >&2; exit 1
144 echo -n "Insert the root+usr diskette in drive $drive and hit RETURN"
146 echo -n "Insert the root diskette in drive $drive and hit RETURN"
150 rootdev
=/dev
/fd
$drive
157 umount
$rootdev 2>/dev
/null
160 umount
${rootdev}p1
2>/dev
/null
161 umount
${rootdev}p2
2>/dev
/null
163 umount
$rootdir/minix
2>/dev
/null
164 umount
$rootdir/etc
2>/dev
/null
166 mkfs
$v1 -i 272 $rootdev 480 ||
exit
167 mount
$rootdev /mnt ||
exit
170 partition
-mf $rootdev 0 81:960 81:240 81:240 >/dev
/null ||
exit
171 repartition
$rootdev >/dev
/null ||
exit
172 mkfs
$v1 ${rootdev}p1 ||
exit
173 mkfs
$v1 ${rootdev}p2 ||
exit
174 mount
${rootdev}p1
$rootdir/minix ||
exit # Hide /minix and /etc
175 mount
${rootdev}p2
$rootdir/etc
2>/dev
/null
# (complains about /etc/mtab)
177 install -d /tmp
/.minix ||
exit
178 install -d /tmp
/.etc ||
exit # Hide /minix and /etc
179 mount
-t lo
/tmp
/.minix
$rootdir/minix ||
exit
180 mount
-t lo
/tmp
/.etc
$rootdir/etc ||
exit
182 cpdir
-vx $rootdir /mnt ||
exit
183 install -d -o 0 -g 0 -m 755 /mnt ||
exit
184 install -d -o 0 -g 0 -m 555 /mnt
/root ||
exit
185 install -d -o 0 -g 0 -m 555 /mnt
/mnt ||
exit
186 install -d -o 0 -g 0 -m 555 /mnt
/usr ||
exit
189 umount
${rootdev}p2
2>/dev
/null
# Unhide /etc
190 umount
${rootdev}p1 ||
exit # Unhide /minix
192 umount
$rootdir/etc ||
exit # Unhide /etc
193 umount
$rootdir/minix ||
exit # Unhide /minix
195 install -d -o 2 -g 0 -m 755 /mnt
/minix ||
exit
196 install -d -o 2 -g 0 -m 755 /mnt
/etc ||
exit
197 set `ls -t $rootdir/minix` # Install the latest kernel
198 install -c $rootdir/minix
/$1 /mnt
/minix
/`echo $1 | sed 's/r[0-9]*$//` ||
exit
199 cpdir
-v $base/usr
/src
/etc
/mnt
/etc ||
exit # Install a fresh /etc
200 chown
-R 0:0 /mnt
/etc
# Patch up owner and mode
201 chmod 600 /mnt
/etc
/shadow
204 echo >/mnt
/etc
/fstab
"\
205 # Poor man's File System Table.
211 echo >/mnt
/etc
/issue
"\
213 Login as root and run 'setup' to install Minix."
215 umount
$rootdev ||
exit
216 test "$std" && umount
$root 2>/dev
/null
217 installboot
-d $rootdev $base/usr
/mdec
/bootblock boot
>/dev
/null
219 # Partition the root floppy whether necessary or not. (Two images can be
220 # concatenated, or a combined image can be split later.)
221 partition
-mf $rootdev 0 81:960 0:0 81:1440 81:480 >/dev
/null ||
exit
227 repartition
$rootdev >/dev
/null
230 echo -n "Insert the usr diskette in drive $drive and hit RETURN"
236 mkfs
$v1 -i 96 $usrdev 720 ||
exit
237 mount
$usrdev /mnt ||
exit
238 install -d -o 0 -g 0 -m 755 /mnt ||
exit
239 (cd $base/usr
&& exec tar cfD
- $usrlist) |
(cd /mnt
&& exec tar xvfp
-) ||
exit
240 umount
$usrdev ||
exit
242 # Put a "boot the other drive" bootblock on the /usr floppy.
243 installboot
-m $usrdev /usr
/mdec
/masterboot
>/dev
/null
245 # We're done for Minix-vmd here, it has its own ideas on how to package /usr.
246 test "$std" ||
exit 0
248 # Guess the size of /usr in compressed form. Assume compression down to 60%
249 # of the original size. Use "disk megabytes" of 1000*1024 for a safe guess.
250 set -$
- `df | grep "^$usr"`
251 size
=`expr \\( $4 \\* 6 / 10 + 999 \\) / 1000`
254 You now need enough diskettes to hold /usr in compressed form, close to
260 if [ "$single" ]; then defsize
=1440; else defsize
=720; fi
262 echo -n "What is the size of the diskettes? [$defsize] "; read size
269 *) echo "Sorry, I don't believe \"$size\", try again." >&2
275 while [ -z "$drive" ]
277 echo -n "What floppy drive to use? [0] "; read drive
284 *) echo "It must be 0 or 1, not \"$drive\"."
290 Enter the floppies in drive $drive when asked to. Mark them with the volume
295 if [ `arch` = i86
]; then bits
=13; else bits
=16; fi
298 cd /usr
&& tar cvf
- .
/tmp
/DONE \
299 |
compress -b$bits | vol
-w $size /dev
/fd
$drive &&