2011-04-30 21:25:05 +02:00
|
|
|
|
|
|
|
make_hdimage()
|
|
|
|
{
|
|
|
|
dd if=$TMPDISKUSR of=usrimage bs=$BS count=$USRBLOCKS
|
|
|
|
|
2011-07-20 16:57:51 +02:00
|
|
|
rootsize=`stat -f %z rootimage`
|
|
|
|
usrsize=`stat -f %z usrimage`
|
2011-04-30 21:25:05 +02:00
|
|
|
|
|
|
|
rootsects=`expr $rootsize / 512`
|
|
|
|
usrsects=`expr $usrsize / 512`
|
|
|
|
|
|
|
|
# installboot -m needs at least 1KB
|
|
|
|
dd < /dev/zero >tmpimage count=2
|
|
|
|
partition -fm tmpimage 2 81:$rootsects* 0:0 81:$usrsects
|
2012-02-02 12:02:34 +01:00
|
|
|
installboot_nbsd -m tmpimage /usr/mdec/mbr
|
2011-04-30 21:25:05 +02:00
|
|
|
dd < tmpimage > subpart count=1
|
|
|
|
|
|
|
|
primsects=`expr 1 + $rootsects + $usrsects`
|
|
|
|
cyl=`expr '(' $primsects ')' / $secs + 1`
|
|
|
|
padsects=`expr $cyl \* $secs - 1 - $primsects`
|
|
|
|
|
|
|
|
{ dd < /dev/zero count=1
|
|
|
|
cat subpart
|
|
|
|
cat rootimage
|
|
|
|
cat usrimage
|
|
|
|
dd < /dev/zero count=$padsects
|
|
|
|
} > hdimage
|
|
|
|
partition -m hdimage 81:`expr $primsects + $padsects`*
|
2012-02-02 12:02:34 +01:00
|
|
|
installboot_nbsd -m hdimage /usr/mdec/mbr
|
2011-04-30 21:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
retrieve()
|
|
|
|
{
|
|
|
|
dir=$1
|
|
|
|
list=`pwd`/$2
|
2012-02-17 15:26:46 +01:00
|
|
|
URLS=""
|
|
|
|
echo "Retrieving packages form $PACKAGEURL"
|
|
|
|
(
|
|
|
|
cd $dir || exit 1
|
|
|
|
SUMMARY=pkg_summary
|
|
|
|
rm -f pkg_summary* || true
|
|
|
|
fetch $PACKAGEURL/$SUMMARY.bz2
|
|
|
|
bzip2 -d $SUMMARY.bz2
|
|
|
|
cat $list | while read name
|
|
|
|
do pkgname="`fgrep PKGNAME=${name} $SUMMARY | sed 's/PKGNAME=//g'`"
|
|
|
|
if [ `echo $pkgname | wc -w` -ne 1 ]
|
|
|
|
then echo " *** Could not resolve $name (not found or too many matches: $pkgname) ***"
|
|
|
|
else echo Getting $pkgname
|
|
|
|
fetch -r ${PACKAGEURL}/${pkgname}.tgz
|
|
|
|
fi
|
|
|
|
echo -n "."
|
|
|
|
done
|
2011-04-30 21:25:05 +02:00
|
|
|
)
|
2012-02-17 15:26:46 +01:00
|
|
|
echo done
|
2011-04-30 21:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cd_root_changes()
|
|
|
|
{
|
2012-02-02 12:02:34 +01:00
|
|
|
cat >$CDFILES/boot.cfg <<END_BOOT_CFG
|
2012-02-07 19:54:08 +01:00
|
|
|
banner=Welcome to the MINIX 3 installation CD
|
|
|
|
banner================================================================================
|
|
|
|
banner=
|
2012-02-02 12:02:34 +01:00
|
|
|
menu=Regular MINIX 3:multiboot /kernel bootcd=1 cdproberoot=1 rootdevname=ram disable=inet
|
|
|
|
menu=Drop to boot prompt:prompt
|
|
|
|
clear=1
|
|
|
|
timeout=10
|
|
|
|
default=1
|
|
|
|
load=/mod01_ds
|
|
|
|
load=/mod02_rs
|
|
|
|
load=/mod03_pm
|
|
|
|
load=/mod04_sched
|
|
|
|
load=/mod05_vfs
|
|
|
|
load=/mod06_memory
|
|
|
|
load=/mod07_log
|
|
|
|
load=/mod08_tty
|
|
|
|
load=/mod09_mfs
|
|
|
|
load=/mod10_vm
|
|
|
|
load=/mod11_pfs
|
|
|
|
load=/mod12_init
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
# This space intentionally left blank - leave to appease bootloader!
|
|
|
|
END_BOOT_CFG
|
2011-04-30 21:25:05 +02:00
|
|
|
}
|
|
|
|
|
2012-02-02 12:02:34 +01:00
|
|
|
|
2011-04-30 21:25:05 +02:00
|
|
|
hdemu_root_changes()
|
|
|
|
{
|
2012-02-02 12:02:34 +01:00
|
|
|
$RELEASEDIR/usr/sbin/installboot_nbsd $TMPDISKROOT \
|
|
|
|
$RELEASEDIR/usr/mdec/bootxx_minixfs3
|
|
|
|
|
|
|
|
cat >$RELEASEMNTDIR/boot.cfg <<END_BOOT_CFG
|
|
|
|
menu=Regular MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel bootcd=2 disable=inet bios_wini=yes bios_remap_first=1 ramimagedev=c0d7p0s0
|
|
|
|
menu=Drop to boot prompt:prompt
|
|
|
|
clear=1
|
|
|
|
timeout=10
|
|
|
|
default=1
|
|
|
|
END_BOOT_CFG
|
2011-04-30 21:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
usb_root_changes()
|
|
|
|
{
|
2012-02-02 12:02:34 +01:00
|
|
|
$RELEASEDIR/usr/sbin/installboot_nbsd $TMPDISKROOT \
|
|
|
|
$RELEASEDIR/usr/mdec/bootxx_minixfs3
|
2011-04-30 21:25:05 +02:00
|
|
|
echo \
|
2012-02-02 12:02:34 +01:00
|
|
|
cat >$RELEASEMNTDIR/boot.cfg <<END_BOOT_CFG
|
|
|
|
menu=Regular MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel bios_wini=yes bios_remap_first=1 rootdevname=c0d7p0s0
|
|
|
|
menu=Drop to boot prompt:prompt
|
|
|
|
clear=1
|
|
|
|
timeout=10
|
|
|
|
default=1
|
|
|
|
END_BOOT_CFG
|
2011-04-30 21:25:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
copy_local_packages()
|
|
|
|
{
|
|
|
|
if [ -d $PACKAGEDIR -a -f $PACKAGELIST -a $PACKAGES -ne 0 ]
|
|
|
|
then
|
|
|
|
index=pkg_summary
|
|
|
|
indexpath=$PACKAGEDIR/.index
|
|
|
|
|
|
|
|
if [ ! -d $indexpath ]
|
|
|
|
then mkdir $indexpath
|
|
|
|
fi
|
|
|
|
if [ ! -d $indexpath ]
|
|
|
|
then echo "Couldn't create $indexpath."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "" >$PACKAGEDIR/All/$index
|
|
|
|
|
|
|
|
echo " * Transfering $PACKAGEDIR to $RELEASEPACKAGE"
|
2012-02-17 15:26:46 +01:00
|
|
|
for pkgprefix in `cat $PACKAGELIST`
|
|
|
|
do realfn="`echo $PACKAGEDIR/All/${pkgprefix}*.tgz`"
|
|
|
|
if [ -f "$realfn" ]
|
2011-04-30 21:25:05 +02:00
|
|
|
then
|
|
|
|
# Copy package and create package's index
|
|
|
|
(
|
2012-02-17 15:26:46 +01:00
|
|
|
p="`basename $realfn`"
|
2011-04-30 21:25:05 +02:00
|
|
|
cd $PACKAGEDIR/All
|
2012-02-17 15:26:46 +01:00
|
|
|
cp $p $RELEASEPACKAGE/
|
2011-04-30 21:25:05 +02:00
|
|
|
|
2012-02-17 15:26:46 +01:00
|
|
|
indexname=$indexpath/$p.$index
|
|
|
|
pkg_info -X $p >$indexname
|
2011-04-30 21:25:05 +02:00
|
|
|
|
|
|
|
if [ ! -f $indexname ]
|
|
|
|
then echo Missing $indexname.
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "`wc -l $indexname`" -lt 3 ]
|
|
|
|
then $indexname is too short.
|
|
|
|
rm $indexname
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat $indexname >>$PACKAGEDIR/All/$index
|
|
|
|
)
|
|
|
|
else
|
2012-02-17 15:26:46 +01:00
|
|
|
echo "Can't find $pkgprefix Missing."
|
2011-04-30 21:25:05 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
bzip2 -f $PACKAGEDIR/All/$index
|
|
|
|
cp $PACKAGEDIR/All/$index.bz2 $RELEASEPACKAGE/
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
fitfs()
|
|
|
|
{
|
|
|
|
path="$1"
|
|
|
|
ramdisk="$2"
|
|
|
|
extra_inodes="$3"
|
|
|
|
extra_zones="$4"
|
|
|
|
mbsdefault="$5"
|
|
|
|
|
|
|
|
# Determine number of inodes
|
|
|
|
inodes=`find $path | egrep -v ^$path/usr | wc -l`
|
|
|
|
inodes="`expr $inodes + $extra_inodes`"
|
|
|
|
|
|
|
|
# Determine number of data zones
|
|
|
|
zonekbs=`du -Fs $path | cut -d' ' -f1`
|
|
|
|
zonekbsignore=0
|
|
|
|
[ ! -d $path/usr ] || zonekbsignore=`du -Fs $path/usr | cut -d" " -f1`
|
|
|
|
zones="`expr \( $zonekbs - $zonekbsignore \) / \( $BS / 1024 \) + $extra_zones`"
|
|
|
|
|
|
|
|
# Determine file system size
|
|
|
|
BSBITS="`expr $BS \* 8`"
|
|
|
|
imap_blocks="`expr \( $inodes + $BSBITS - 1 \) / $BSBITS`"
|
|
|
|
inode_blocks="`expr \( $inodes \* 64 + $BS - 1 \) / $BS`"
|
|
|
|
zmap_blocks="`expr \( $zones + $BSBITS - 1 \) / $BSBITS`"
|
|
|
|
blocks="`expr 1 + 1 + $imap_blocks + $zmap_blocks + $inode_blocks + $zones`"
|
|
|
|
kbs="`expr $blocks \* \( $BS / 1024 \)`"
|
|
|
|
|
|
|
|
# Apply default if higher
|
|
|
|
if [ -n "$mbsdefault" ]
|
|
|
|
then
|
|
|
|
kbsdefault="`expr $mbsdefault \* 1024`"
|
|
|
|
if [ "$kbs" -lt "$kbsdefault" ]
|
|
|
|
then kbs=$kbsdefault
|
|
|
|
else echo "warning: ${mbsdefault}mb is too small, using ${kbs}kb"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create a filesystem on the target ramdisk
|
|
|
|
ramdisk $kbs $ramdisk
|
|
|
|
mkfs.mfs -B $BS -i $inodes $ramdisk
|
|
|
|
}
|