📄 mkdist.sh
字号:
#!/bin/sh## mkdist 2.3 - Make a Minix distribution Author: Kees J. Bot# 20 Dec 1994# (An external program can use the X_* hooks to add# a few extra files and actions. It needs to use a sed script to change# them though, the shell doesn't get it otherwise.)PATH=/bin:/usr/binexport PATH# Move out of /usr.case "$0" in/tmp/*) rm -f "$0" ;;*) cp -p "$0" /tmp/mkdist exec /tmp/mkdistesacusrlist="binbin/MAKEDEVbin/archbin/badblocksbin/basenamebin/chmodbin/clonebin/compressbin/cpbin/cpdirbin/debin/dfbin/edparamsbin/gettybin/grepbin/installbootbin/killbin/lnbin/loginbin/lsbin/minedbin/mkdirbin/mkfsbin/mknodbin/morebin/mvbin/odbin/partbin/partitionbin/readallbin/readfsbin/repartitionbin/rmbin/rmdirbin/sedbin/setupbin/shutdownbin/sleepbin/sortbin/sttybin/tarbin/teebin/timebin/unamebin/uncompressbin/updatebin/volbin/yapbin/zcatliblib/keymaps`cd /usr && echo lib/keymaps/*`lib/pwdauthmdecmdec/bootmdec/bootblockmdec/masterboottmp$X_USRLIST"# Find the root device, and the real root device.. /etc/fstabrealroot=`printroot -r`if [ $realroot = $root ]then rootdir=/else umount $root >/dev/null 2>&1 mount $root /root || exit rootdir=/rootfiecho -n "The installation root and /usr can be put on either one diskette of at least1.2 Mb, or on two diskettes of at least 720 kb.Do you want to use a single diskette of at least 1.2 Mb? [y] "; read singlecase $single in''|[yY]*|sure) single=true ;;*) single=esacecho -n "Which drive to use? [0] "; read drivecase $drive in'') drive=0 ;;[01]) ;;*) echo "Please type '0' or '1'" >&2; exit 1esacif [ "$single" ]then echo -n "Insert the root+usr diskette in drive $drive and hit RETURN"else echo -n "Insert the root diskette in drive $drive and hit RETURN"firead retumount /dev/fd$drive 2>/dev/nullumount /dev/fd${drive}b 2>/dev/nullmkfs -1 -i 240 /dev/fd$drive 480 || exitpartition -mf /dev/fd$drive 0 81:960 81:480 >/dev/null || exitrepartition /dev/fd$drive >/dev/null || exitmkfs -1 /dev/fd${drive}b || exitmount /dev/fd$drive /mnt || exitmount /dev/fd${drive}b /minix || exit # Hide /minix for a momentcpdir -vx $rootdir /mnt || exitinstall -d -o 0 -g 0 -m 755 /mnt || exitinstall -d -o 0 -g 0 -m 555 /mnt/root || exitinstall -d -o 0 -g 0 -m 555 /mnt/mnt || exitinstall -d -o 0 -g 0 -m 555 /mnt/usr || exitumount /dev/fd${drive}b || exit # Unhide /minixinstall -d -o 2 -g 0 -m 755 /mnt/minix || exitset `ls -t /minix` # Install the latest kernelinstall -c /minix/$1 /mnt/minix/`uname -r`.`uname -v` || exit# Change /etc/fstab.echo >/mnt/etc/fstab "\# Poor man's File System Table.root=unknownusr=unknown"# How to install?echo >/mnt/etc/issue "\Login as root and run 'setup' to install Minix."eval "$X_ROOT1"umount /dev/fd$drive || exitumount $root 2>/dev/nullinstallboot -d /dev/fd$drive /usr/mdec/bootblock boot >/dev/nulleval "$X_ROOT2"# Partition the root floppy whether necessary or not. (Two images can be# concatenated, or a combined image can be split later.)partition -mf /dev/fd$drive 0 81:960 0:0 81:1440 >/dev/null || exitif [ "$single" ]then repartition /dev/fd$drive >/dev/null part=celse echo -n "Insert the usr diskette in drive $drive and hit RETURN" read ret part=fimkfs -1 -i 96 /dev/fd$drive$part 720 || exitmount /dev/fd$drive$part /mnt || exitinstall -d -o 0 -g 0 -m 755 /mnt || exit(cd /usr && exec tar cfD - $usrlist) | (cd /mnt && exec tar xvfp -) || exiteval "$X_USR1"umount /dev/fd$drive$part || exiteval "$X_USR2"# Put a "boot the other drive" bootblock on the /usr floppy.installboot -m /dev/fd$drive$part /usr/mdec/masterboot >/dev/null# Guess the size of /usr in compressed form. Assume compression down to 60%# of the original size. Use "disk megabytes" of 1000 kb.set -$- `df | grep "^$usr"`size=`expr \\( $6 \\* 6 / 10 + 999 \\) / 1000`echo -n "You now need enough diskettes to hold /usr in compressed form, close to$size Mb total. "size=while [ -z "$size" ]do if [ "$single" ]; then defsize=1440; else defsize=720; fi echo -n "What is the size of the diskettes? [$defsize] "; read size case $size in '') size=$defsize ;; 360|720|1200|1440) ;; *) echo "Sorry, I don't believe \"$size\", try again." >&2 size= esacdonedrive=while [ -z "$drive" ]do echo -n "What floppy drive to use? [0] "; read drive case $drive in '') drive=0 ;; [01]) ;; *) echo "It must be 0 or 1, not \"$drive\"." drive= esacdoneecho "Enter the floppies in drive $drive when asked to. Mark them with the volumenumbers!"sleep 2if [ `arch` = i86 ]; then bits=13; else bits=16; fi>/tmp/LASTcd /usr && tar cvf - . /tmp/LAST \ | compress -b$bits | vol -w $size /dev/fd$drive &&echo Done.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -