#!/bin/sh
set -x

. mkroot.lib.sh

as_root -c "umount '$tmp_root'" || true
as_root -c "$loop_ctrl -d '$loop_dev'"

dd if=/dev/zero of="$image_file" bs=1k count="$image_size"
mkfs -t 2f "$image_file"

as_root -c "$loop_ctrl -a '$loop_dev' '$image_file'"
as_root -c "mount '$loop_dev' '$tmp_root'"

# Make sure the libraries are uptodate.
(cf_cd lib/libc && amk)
(cf_cd bsd44/lib/libedit && amk)
(cf_cd lib/editline && amk)
(cf_i86_cd lib/libc && amk)
(cf_cd pkg/ack.prev/modules/src && amk)

# Clean $tmp_root
as_root -c "rm -rf $tmp_root/."

# Create .cdrom file 
as_root -c ": >$tmp_root/.cdrom"

if true
then

# create/copy the bootstrap loader to /boot
trans sys/boot boot . 555

# Sys/boot
(cd $tmp_root && as_root -c 'mkdir sys && chmod 755 sys')
(cd $tmp_root && as_root -c 'mkdir sys/boot && chmod 755 sys/boot')
trans sys/boot bootblock sys/boot 555
trans sys/boot edparams sys/boot 555
trans sys/boot installboot sys/boot 555
trans sys/boot masterboot sys/boot 555

# Compile the bootstrap loader.
(cf_cd sys/boot && amk bootblock)

# Dev
(cd $tmp_root && as_root -c 'mkdir -p dev && chmod 755 dev')
(cd $tmp_root && as_root -c '
	cd dev &&
	MAKEDEV tty &&
	MAKEDEV ttyc1 ttyc2 ttyc3 ttyc4 ttyc5 ttyc6 ttyc7 &&
	MAKEDEV tty00 tty01 tty02 tty03 ttyp &&
	MAKEDEV log &&
	MAKEDEV fd0 &&
	MAKEDEV fd0p0 &&
	MAKEDEV fd1 &&
	MAKEDEV fd1p0 &&
	MAKEDEV c0d0 &&
	MAKEDEV c0d0p0 &&
	MAKEDEV c0d0p0s0 &&
	MAKEDEV c0d1 &&
	MAKEDEV c0d1p0 &&
	MAKEDEV c0d1p0s0 &&
	MAKEDEV c0d2 &&
	MAKEDEV c0d2p0 &&
	MAKEDEV c0d2p0s0 &&
	MAKEDEV c0d3 &&
	MAKEDEV c0d3p0 &&
	MAKEDEV c0d3p0s0 &&
	MAKEDEV c0d4 &&
	MAKEDEV c0d4p0 &&
	MAKEDEV c0d4p0s0 &&
	MAKEDEV c0d5 &&
	MAKEDEV c0d5p0 &&
	MAKEDEV c0d5p0s0 &&
	MAKEDEV c0d6 &&
	MAKEDEV c0d6p0 &&
	MAKEDEV c0d6p0s0 &&
	MAKEDEV c0d7 &&
	MAKEDEV c0d7p0 &&
	MAKEDEV c0d7p0s0 &&
	MAKEDEV c1d0 &&
	MAKEDEV c0r0 &&
	MAKEDEV c0r1 &&
	MAKEDEV c0r2 &&
	MAKEDEV c0r3 &&
	MAKEDEV c0r4 &&
	MAKEDEV c0r5 &&
	MAKEDEV c0r6 &&
	MAKEDEV c0r7 &&
	MAKEDEV eth &&
	MAKEDEV ram &&
	MAKEDEV daemonlog &&
	MAKEDEV loop0 &&
	mknod nrst0 c 10 128 && chmod 666 nrst0 &&
	mknod rst0 c 10 129 && chmod 666 rst0'
)

# Minix
(cd $tmp_root && as_root -c 'mkdir -p minix && chmod 755 minix')
(cf_cd sys/boot && amk installboot)
(cf_cd sys/kernel && amk kernel && chmem =0 kernel)
(cf_cd sys/mm && amk mm)
(cf_cd sys/fs && amk fs && chmem =16772160 fs)
(cf_cd sys/task.stubs && amk init.stub)
(cf_cd . && as_root -c "pwd && ls && sys/boot/installboot -i \
	$tmp_root/minix/2.0.1 \
	sys/kernel/kernel sys/mm/mm sys/fs/fs \
	sys/task.stubs/init.stub")

# /sbin
(cd $tmp_root && as_root -c 'mkdir -p sbin && chmod 755 sbin')
trans cmd/simple init sbin 555

# /
#trans_named_src local/root dot.rhosts root/.rhosts 400

# /bin
(cd $tmp_root && as_root -c 'mkdir -p bin && chmod 755 bin')
# sh get's linked from usr/bin/sh

# /etc
(cd $tmp_root && as_root -c 'mkdir -p etc && chmod 755 etc')
trans_named_src etc fstab.cdboot etc/fstab 444
trans_src etc group etc 444
trans_src etc inetd.conf etc 444
trans_src etc motd etc 444
trans_src etc passwd etc 444
trans_src etc profile etc 444
trans_src etc protocols etc 444
trans_src etc rc etc 555
trans_src etc rc.mkvar etc 555
trans_src etc serv.access etc 444
trans_src etc services etc 444
trans_src etc shadow etc 444
trans_src etc syslog.conf etc 444
trans_src etc termcap etc 555
trans_src etc ttytab etc 444
trans_src etc timeinfo etc 555
(cd $tmp_root && as_root -c 'ln -s /var/run/utmp etc/utmp')

# /etc/ssc
(cd $tmp_root && as_root -c 'mkdir -p etc/ssc && chmod 755 etc/ssc')
trans_named_src pkg/ssc-0.4/sscserver services.proto etc/ssc/services 444

# /home
(cd $tmp_root && as_root -c 'mkdir -p home && chmod 755 home')

# /mnt
(cd $tmp_root && as_root -c 'mkdir -p mnt && chmod 755 mnt')

# /mount
(cd $tmp_root && as_root -c 'mkdir -p mount && chmod 755 mount')
(cd $tmp_root && as_root -c 'mkdir -p mount/loop0 && chmod 755 mount/loop0')

# /opt
(cd $tmp_root && as_root -c 'mkdir -p opt && chmod 755 opt')

# /opt/ack. We should actually compile this
(cd /opt && tar cf - ack) | (cd $tmp_root && as_root -c 'cd opt && tar xf -')

# /opt/gnu. We should actually compile this
(cd /opt && tar cf - gnu) | (cd $tmp_root && as_root -c 'cd opt && tar xf -')

# /root
(cd $tmp_root && as_root -c 'mkdir -p root && chmod 755 root')

# /tmp
(cd $tmp_root && as_root -c 'mkdir -p tmp && chmod 1777 tmp')

# /usr
(cd $tmp_root && as_root -c 'mkdir -p usr && chmod 755 usr')

# /usr/adm
(cd $tmp_root && as_root -c 'ln -s /var/adm usr/adm')

# Libraries
(cf_cd pkg/libressl && do_do_configure)
mk_pkg pkg/libressl

# /usr/bin
(cd $tmp_root && as_root -c 'mkdir -p usr/bin && chmod 755 usr/bin')

# bsd44/bin -> /usr/bin
trans bsd44/bin/pax pax usr/bin 555
trans bsd44/bin/rcp rcp usr/bin 555
trans bsd44/bin/sh sh usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/sh bin/sh')
(cf_cd bsd44/bin/sh && PATH=$PATH:. amk -DEDITLINE=%true -DLIBEDIT=%true )
transfer_res bsd44/bin/sh ash usr/bin ash 555 bin

# bsd44/libexec -> /usr/bin
trans bsd44/libexec/fingerd fingerd usr/bin 555

# bsd44/sbin -> /usr/bin
trans bsd44/sbin/ping ping usr/bin 555

# bsd44/usr.bin -> /usr/bin
trans bsd44/usr.bin/ar ar usr/bin 555
trans bsd44/usr.bin/nm bnm usr/bin 555
trans bsd44/usr.bin/compress compress usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/compress usr/bin/uncompress')
(cd $tmp_root && as_root -c 'ln -f usr/bin/compress usr/bin/zcat')
trans bsd44/usr.bin/cut cut usr/bin 555
trans bsd44/usr.bin/finger finger usr/bin 555
trans bsd44/usr.bin/fmt fmt usr/bin 555
trans bsd44/usr.bin/make make usr/bin 555
trans bsd44/usr.bin/more more usr/bin 555
trans bsd44/usr.bin/nice nice usr/bin 555
trans bsd44/usr.bin/printf printf usr/bin 555
trans bsd44/usr.bin/ranlib ranlib usr/bin 555
trans bsd44/usr.bin/rlogin rlogin usr/bin 555
trans bsd44/usr.bin/rsh rsh usr/bin 555
trans bsd44/usr.bin/sed sed usr/bin 555
trans bsd44/usr.bin/tftp tftp usr/bin 555
trans bsd44/usr.bin/tip tip usr/bin 555
trans bsd44/usr.bin/tr tr usr/bin 555
trans bsd44/usr.bin/whois whois usr/bin 555
trans bsd44/usr.bin/xargs xargs usr/bin 555
trans bsd44/usr.bin/yacc yacc usr/bin 555

# bsd44/usr.sbin -> /usr/bin
trans bsd44/usr.sbin/inetd inetd usr/bin 555
trans bsd44/usr.sbin/lpr lpc usr/bin 555
trans bsd44/usr.sbin/lpr lpd usr/bin 555
trans bsd44/usr.sbin/lpr lpf usr/bin 555
trans bsd44/usr.sbin/lpr lpq usr/bin 555
trans bsd44/usr.sbin/lpr lpr usr/bin 555
trans bsd44/usr.sbin/lpr lprm usr/bin 555
trans bsd44/usr.sbin/lpr lptest usr/bin 555
trans bsd44/usr.sbin/lpr pac usr/bin 555
trans bsd44/usr.sbin/syslogd syslogd usr/bin 555

# cmd/ibm -> /usr/bin
trans cmd/ibm readclock usr/bin 555
trans cmd/ibm simix usr/bin 555

# cmd/simple -> /usr/bin
trans cmd/simple at usr/bin 555
trans cmd/simple banner usr/bin 555
trans cmd/simple basename usr/bin 555
trans cmd/simple cal usr/bin 555
trans cmd/simple cat usr/bin 555
trans cmd/simple chmem usr/bin 555
trans cmd/simple chmod usr/bin 555
trans cmd/simple chown usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/chown usr/bin/chgrp')
trans cmd/simple cksum usr/bin 555
trans cmd/simple comm usr/bin 555
trans cmd/simple crc usr/bin 555
trans cmd/simple date usr/bin 555
trans cmd/simple dd usr/bin 555
trans cmd/simple dhrystone usr/bin 555
trans cmd/simple du usr/bin 555
trans cmd/simple ed usr/bin 555
trans cmd/simple expand usr/bin 555
trans cmd/simple factor usr/bin 555
trans cmd/simple file usr/bin 555
trans cmd/simple find usr/bin 555
trans cmd/simple fold usr/bin 555
trans cmd/simple fortune usr/bin 555
trans cmd/simple getty usr/bin 555
trans cmd/simple gomoku usr/bin 555
trans cmd/simple head usr/bin 555
trans cmd/simple id usr/bin 555
trans cmd/simple ifdef usr/bin 555
trans cmd/simple isoread usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/isoread usr/bin/isodir')
trans cmd/simple kill usr/bin 555
trans cmd/simple last usr/bin 555
trans cmd/simple life usr/bin 555
trans cmd/simple login usr/bin 555
trans cmd/simple mesg usr/bin 555
trans cmd/simple mkdir usr/bin 555
trans cmd/simple mkfifo usr/bin 555
trans cmd/simple mknod usr/bin 555
trans cmd/simple mkproto usr/bin 555
trans cmd/simple od usr/bin 555
trans cmd/simple passwd usr/bin 555
trans cmd/simple paste usr/bin 555
trans cmd/simple pr usr/bin 555
trans cmd/simple prep usr/bin 555
trans cmd/simple proto usr/bin 555
trans cmd/simple pwd usr/bin 555
trans cmd/simple readall usr/bin 555
trans cmd/simple shar usr/bin 555
trans cmd/simple size usr/bin 555
trans cmd/simple sort usr/bin 555
trans cmd/simple split usr/bin 555
trans cmd/simple strings usr/bin 555
trans cmd/simple strip usr/bin 555
trans cmd/simple stty usr/bin 555
trans cmd/simple su usr/bin 4555
trans cmd/simple sum usr/bin 555
trans cmd/simple sync usr/bin 555
trans cmd/simple tail usr/bin 555
trans cmd/simple tee usr/bin 555
trans cmd/simple term usr/bin 555
trans cmd/simple time usr/bin 555
trans cmd/simple touch usr/bin 555
trans cmd/simple tsort usr/bin 555
trans cmd/simple tty usr/bin 555
trans cmd/simple unexpand usr/bin 555
trans cmd/simple uniq usr/bin 555
trans cmd/simple update usr/bin 555
trans cmd/simple uudecode usr/bin 555
trans cmd/simple uuencode usr/bin 555
trans cmd/simple vol usr/bin 555
trans cmd/simple wc usr/bin 555
trans cmd/simple whoami usr/bin 555
trans cmd/simple write usr/bin 555
trans cmd/simple writeisofs usr/bin 555

# gnu/cmd -> /usr/bin
(cf_cd gnu/cmd/gawk && do_configure)
mk_trans gnu/cmd/gawk gawk usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/gawk usr/bin/awk')
(cf_cd gnu/cmd/bison && do_configure)
mk_trans gnu/cmd/bison bison usr/bin 555
(cf_cd gnu/cmd/cpio && do_configure)
mk_trans gnu/cmd/cpio cpio usr/bin 555
(cf_cd gnu/cmd/diffutils && do_configure)
mk_trans gnu/cmd/diffutils diff usr/bin 555
(cf_cd gnu/cmd/grep && do_configure)
mk_trans gnu/cmd/grep grep usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/grep usr/bin/egrep')
trans gnu/cmd/gzip gzip usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/gzip usr/bin/gzcat')
(cf_cd gnu/cmd/joe && do_configure)
mk_trans gnu/cmd/joe joe usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/joe usr/bin/jmacs')
(cd $tmp_root && as_root -c 'ln -f usr/bin/joe usr/bin/jpico')
(cd $tmp_root && as_root -c 'ln -f usr/bin/joe usr/bin/jstar')
(cd $tmp_root && as_root -c 'ln -f usr/bin/joe usr/bin/rjoe')
trans gnu/cmd/mtools mtools usr/bin 555
(cf_cd gnu/cmd/patch && do_configure)
mk_trans gnu/cmd/patch patch usr/bin 555
(cf_cd gnu/cmd/rcs && do_configure)
mk_pkg gnu/cmd/rcs 
mk_trans gnu/cmd/rcs/src ci usr/bin 555
mk_trans gnu/cmd/rcs/src co usr/bin 555
mk_trans gnu/cmd/rcs/src ident usr/bin 555
mk_trans gnu/cmd/rcs/src merge usr/bin 555
mk_trans gnu/cmd/rcs/src rcs usr/bin 555
mk_trans gnu/cmd/rcs/src rcsdiff usr/bin 555
mk_trans gnu/cmd/rcs/src rcsmerge usr/bin 555
mk_trans gnu/cmd/rcs/src rlog usr/bin 555
trans gnu/cmd/screen screen usr/bin 555

(cd $tmp_root && as_root -c 'mkdir -p usr/bin && chmod 755 usr/bin')

# pkg libraries
(cf_cd pkg/libpcap && do_do_configure)
mk_pkg pkg/libpcap

# pkg -> /usr/bin
gmk_pkg pkg/acme-client-portable
transfer_res pkg/acme-client-portable acme-client usr/bin acme-client 755 root
mk_pkg pkg/bind
mk_trans pkg/bind/dnsquery dnsquery usr/bin 555
mk_trans pkg/bind/host host usr/bin 555
mk_trans pkg/bind/named named usr/bin 555
mk_trans pkg/bind/named-xfer named-xfer usr/bin 555
mk_trans pkg/bind/restart named.restart usr/bin 555
mk_trans pkg/bind/ndc ndc usr/bin 555
trans pkg/chat chat usr/bin 555
trans pkg/freebsd-mixer mixer usr/bin 555
mk_trans pkg/flex flex usr/bin 555
(cf_cd pkg/openssl && sh -c 'if expr ! -f Makefile.bak; then ./do_configure; fi')
mk_pkg pkg/openssl
transfer_res pkg/openssl/apps openssl usr/bin openssl 555 bin
#mk_trans pkg/nntpclnt inews usr/bin 555
mk_pkg pkg/nvi/PORT/minixVM
mk_trans pkg/nvi/PORT/minixVM nvi usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/nvi usr/bin/vi')
mk_pkg pkg/smail
mk_trans pkg/smail/src smail usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/smail usr/bin/mailq')
(cd $tmp_root && as_root -c 'ln -f usr/bin/smail usr/bin/runq')
mk_pkg pkg/ssc
transfer_res pkg/ssc/util rsagen usr/bin rsagen 755 root
transfer_res pkg/ssc/sscclient sscclient usr/bin sscclient 755 root
transfer_res pkg/ssc/sscrcp sscrcp usr/bin sscrcp 755 root
transfer_res pkg/ssc/sscrsh sscrsh usr/bin sscrsh 755 root
transfer_res pkg/ssc/ssctelnet ssctelnet usr/bin ssctelnet 755 root
(cf_cd pkg/tcpdump && do_do_configure)
mk_trans pkg/tcpdump tcpdump usr/bin 555
(cf_cd pkg/top && do_do_configure)
mk_trans pkg/top top usr/bin 555
(cf_cd pkg/traceroute && do_do_configure)
mk_trans pkg/traceroute traceroute usr/bin 555
trans pkg/tzcode1999g zic usr/bin 555

# sys/cmd -> /usr/bin
trans sys/cmd/de de usr/bin 555
trans sys/cmd/trace trace usr/bin 555

# sys/cmd/simple -> /usr/bin
trans sys/cmd/simple badblocks usr/bin 555
trans sys/cmd/simple df usr/bin 555
trans sys/cmd/simple fsck usr/bin 555
trans sys/cmd/simple fsck1 usr/bin 555
trans sys/cmd/simple fsck1f usr/bin 555
trans sys/cmd/simple fsck2 usr/bin 555
trans sys/cmd/simple fsck2f usr/bin 555
trans sys/cmd/simple fsck3 usr/bin 555
trans sys/cmd/simple fsck_sof usr/bin 555
trans sys/cmd/simple ip6addrs usr/bin 555
trans sys/cmd/simple ip6dc usr/bin 555
trans sys/cmd/simple ip6nc usr/bin 555
trans sys/cmd/simple keymap usr/bin 555
trans sys/cmd/simple mkfs usr/bin 555
trans sys/cmd/simple mkfs1 usr/bin 555
trans sys/cmd/simple mkfs1f usr/bin 555
trans sys/cmd/simple mkfs2 usr/bin 555
trans sys/cmd/simple mkfs2f usr/bin 555
trans sys/cmd/simple mkfs_sof usr/bin 555
trans sys/cmd/simple ps usr/bin 4555
trans sys/cmd/simple readfs usr/bin 555
trans sys/cmd/simple svrctl usr/bin 555
trans sys/cmd/simple tcpstat usr/bin 555
trans sys/cmd/simple udpstat usr/bin 555

# vmd/cmd -> /usr/bin/
transfer vmd/cmd/amake Amake usr/bin amake 555 root
trans vmd/cmd/asmconv asmconv usr/bin 555
trans vmd/cmd/cawf bsfilt usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/bsfilt usr/bin/colcrt')
trans vmd/cmd/cawf cawf usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/cawf usr/bin/nroff')
trans vmd/cmd/cron cron usr/bin 555
trans vmd/cmd/cron crontab usr/bin 555
trans vmd/cmd/dhcpd dhcpd usr/bin 555
trans vmd/cmd/dis386 dis386 usr/bin 555
trans vmd/cmd/ftpd ftpd usr/bin 555
trans vmd/cmd/ibm format usr/bin 555
trans vmd/cmd/ibm loadfont usr/bin 555
trans vmd/cmd/ibm part usr/bin 555
trans vmd/cmd/ibm partition usr/bin 555
trans vmd/cmd/ibm patchdos usr/bin 555
trans vmd/cmd/nm nm usr/bin 555
trans vmd/cmd/patchtree patchtree usr/bin 555
trans vmd/cmd/pdtar-nov87 tar usr/bin 555
trans vmd/cmd/pnp pnpconfig usr/bin 555
trans vmd/cmd/pnp pnpdump usr/bin 555
trans vmd/cmd/profile profile usr/bin 555
trans vmd/cmd/profile profstop usr/bin 555
trans vmd/cmd/reboot halt usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/halt usr/bin/reboot')
trans vmd/cmd/reboot shutdown usr/bin 555
trans vmd/cmd/rip rip usr/bin 555
trans vmd/cmd/tsd tsd usr/bin 555
trans vmd/cmd/tsd calcmos usr/bin 555
trans vmd/cmd/telnet telnet usr/bin 555
trans vmd/cmd/yap yap usr/bin 555

# vmd/cmd/simple -> /usr/bin
trans_named_src vmd/cmd/simple DESCRIBE.sh usr/bin/DESCRIBE 555
trans_named_src vmd/cmd/simple MAKEDEV.sh usr/bin/MAKEDEV 555
trans vmd/cmd/simple acd usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/acd usr/bin/cc')
(cd $tmp_root && as_root -c 'ln -f usr/bin/acd usr/bin/gcc')
trans vmd/cmd/simple add_route usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/add_route usr/bin/del_route')
trans vmd/cmd/simple arp usr/bin 555
trans vmd/cmd/simple arx usr/bin 555
trans vmd/cmd/simple ata_identify usr/bin 555
trans_named_src vmd/cmd/simple cd.sh usr/bin/cd 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/cd usr/bin/[')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cd usr/bin/echo')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cd usr/bin/false')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cd usr/bin/true')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cd usr/bin/wait')
trans_named_src vmd/cmd/simple cdsetup.sh usr/bin/cdsetup 555
trans vmd/cmd/simple cleantmp usr/bin 555
trans_named_src vmd/cmd/simple clear.sh usr/bin/clear 555
trans vmd/cmd/simple cmp usr/bin 555
trans vmd/cmd/simple cp usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/cp usr/bin/clone')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cp usr/bin/cpdir')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cp usr/bin/ln')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cp usr/bin/mv')
(cd $tmp_root && as_root -c 'ln -f usr/bin/cp usr/bin/rm')
trans vmd/cmd/simple dcore usr/bin 555
trans vmd/cmd/simple dirname usr/bin 555
trans vmd/cmd/simple eject usr/bin 555
trans vmd/cmd/simple env usr/bin 555
trans vmd/cmd/simple fsync usr/bin 555
trans vmd/cmd/simple gcc_gcv usr/bin 555
trans vmd/cmd/simple hostaddr usr/bin 555
trans vmd/cmd/simple httpget usr/bin 555
trans vmd/cmd/simple ifconfig usr/bin 555
trans vmd/cmd/simple ifconfig6 usr/bin 555
trans vmd/cmd/simple in.rshd usr/bin 555
trans vmd/cmd/simple in.telnetd usr/bin 555
trans vmd/cmd/simple install usr/bin 555
trans vmd/cmd/simple intr usr/bin 555
trans vmd/cmd/simple irdpd usr/bin 555
trans vmd/cmd/simple look usr/bin 555
trans_named_src vmd/cmd/simple lp.sh usr/bin/lp 555
trans vmd/cmd/simple ls usr/bin 555
trans vmd/cmd/simple mail usr/bin 555
trans_named_src vmd/cmd/simple makewhatis.sh usr/bin/makewhatis 555
trans vmd/cmd/simple man usr/bin 555
trans vmd/cmd/simple md5 usr/bin 555
trans_named_src vmd/cmd/simple mkdep.sh usr/bin/mkdep 555
trans vmd/cmd/simple mkswap usr/bin 555
trans vmd/cmd/simple mount usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/mount usr/bin/umount')
trans vmd/cmd/simple mt usr/bin 555
trans vmd/cmd/simple nonamed usr/bin 555
trans_named_src vmd/cmd/simple pkgadd.sh usr/bin/pkgadd 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/pkgadd usr/bin/pkginfo')
trans vmd/cmd/simple pr_routes usr/bin 555
trans vmd/cmd/simple pwdauth usr/bin 555
trans vmd/cmd/simple rarpd usr/bin 555
trans vmd/cmd/simple rawspeed usr/bin 555
trans vmd/cmd/simple rdate usr/bin 555
trans vmd/cmd/simple remsync usr/bin 555
trans vmd/cmd/simple rget usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/rget usr/bin/rput')
trans vmd/cmd/simple rijntunnel usr/bin 555
trans vmd/cmd/simple rmdir usr/bin 555
trans vmd/cmd/simple scsiprobe usr/bin 555
trans vmd/cmd/simple sleep usr/bin 555
trans vmd/cmd/simple slip usr/bin 555
trans vmd/cmd/simple stat usr/bin 555
trans vmd/cmd/simple synctree usr/bin 555
trans vmd/cmd/simple sysenv usr/bin 555
trans vmd/cmd/simple tangle usr/bin 555
trans vmd/cmd/simple tget usr/bin 555
trans vmd/cmd/simple uname usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/uname usr/bin/arch')
(cd $tmp_root && as_root -c 'ln -f usr/bin/uname usr/bin/hostname')
trans vmd/cmd/simple uptime usr/bin 555
trans vmd/cmd/simple utime usr/bin 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/utime usr/bin/stime')
trans vmd/cmd/simple vdisk_ctrl usr/bin 555
trans vmd/cmd/simple vmstat usr/bin 555
trans_named_src vmd/cmd/simple whatis.sh usr/bin/whatis 555
(cd $tmp_root && as_root -c 'ln -f usr/bin/whatis usr/bin/apropos')
trans vmd/cmd/simple which usr/bin 555
trans vmd/cmd/simple who usr/bin 555
trans vmd/cmd/simple yes usr/bin 555
trans vmd/cmd/simple zexec usr/bin 555

# Misc in /usr/bin
(cd $tmp_root && as_root -c 'ln -s /opt/ack/bin/aal usr/bin/aal')

# /usr/etc
(cd $tmp_root && as_root -c 'mkdir -p usr/etc && chmod 755 usr/etc')
trans_src usr.etc daily usr/etc 555
trans_src usr.etc rc usr/etc 555

# /usr/lib
(cd $tmp_root && as_root -c 'mkdir -p usr/lib && chmod 755 usr/lib')
(cd $tmp_root && as_root -c 'ln -f usr/bin/asmconv usr/lib/asmconv')
trans vmd/cmd/simple pwdauth usr/lib 555

# /usr/lib/ack
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/ack &&
	chmod 755 usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/cpp usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/cpp.ansi usr/lib/ack')
trans pkg/ack.prev/mach/minix.i386/cv cv usr/lib/ack 555
trans_src usr.lib.ack descr usr/lib/ack 444
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/ego usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_cemcom.ansi usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_decode usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_ego usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_encode usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_led usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_m2 usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_opt usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_opt2 usr/lib/ack')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/em_pc usr/lib/ack')
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/ack/i386 &&
	chmod 755 usr/lib/ack/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/i386/as usr/lib/ack/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/i386/cg usr/lib/ack/i386')
(
	target_conf_root="/usr/conf/minix/i386.ack"
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/lib/libc/crtso.o usr/lib/ack/i386")
	# dummy.o
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/lib/libc/end.a usr/lib/ack/i386")
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/bsd44/lib/libbsd44.a usr/lib/ack/i386/libbsd.a")
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/lib/libc/libc.a usr/lib/ack/i386")
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/pkg/flex/libfl.a usr/lib/ack/i386")
	(cd $tmp_root &&
	as_root -c "ln -s libfl.a usr/lib/ack/i386/libl.a")
	# libm.a
	# libnofp.a
	# libtermcap.a
)
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/ack/i86 &&
	chmod 755 usr/lib/ack/i86')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/i86/as usr/lib/ack/i86')
(cd $tmp_root && as_root -c 'ln -s /opt/ack/lib.bin/i86/cg usr/lib/ack/i86')

(cd $tmp_root/usr/lib && as_root -c 'ln -s ack cc')

# /usr/lib/cawf
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/cawf &&
	chmod 755 usr/lib/cawf')
trans_src vmd/cmd/cawf common usr/lib/cawf 444
trans_src vmd/cmd/cawf device.cf usr/lib/cawf 444
trans_src vmd/cmd/cawf dumb.dev usr/lib/cawf 444
trans_src vmd/cmd/cawf man.mac usr/lib/cawf 444
trans_src vmd/cmd/cawf me.mac usr/lib/cawf 444
trans_src vmd/cmd/cawf mnx.mac usr/lib/cawf 444
trans_src vmd/cmd/cawf ms.mac usr/lib/cawf 444

# /usr/lib/gnu
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/gnu &&
	chmod 755 usr/lib/gnu')
(cd $tmp_root && as_root -c 'ln -s /opt/gnu/bin/cpp usr/lib/gnu')
trans_src usr.lib.gnu descr usr/lib/gnu 444
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/gnu/i386 &&
	chmod 755 usr/lib/gnu/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/gnu/lib.bin/i386/as usr/lib/gnu/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/gnu/lib.bin/i386/cc1 usr/lib/gnu/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/gnu/lib.bin/i386/ld usr/lib/gnu/i386')
(cd $tmp_root && as_root -c 'ln -s /opt/gnu/lib/i386/libgcc.a usr/lib/gnu/i386')
(cd $tmp_root && as_root -c 'ln -s /usr/bin/gcc_gcv usr/lib/gnu/i386/gcv')
(
	target_conf_root="/usr/conf/minix/i386.gcc"
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/lib/libc/crtso.o usr/lib/gnu/i386")
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/lib/libc/libc.a usr/lib/gnu/i386")
	(cd $tmp_root &&
	as_root -c "ln -s $target_conf_root/bsd44/lib//libbsd44.a usr/lib/gnu/i386/libbsd.a")
)

(cd $tmp_root/usr/lib && as_root -c 'ln -s gnu gcc')

# /usr/lib/keymaps
(cd $tmp_root && as_root -c 'mkdir -p usr/lib/keymaps &&
	chmod 755 usr/lib/keymaps')
trans_src sys/kernel/ibm/keymaps french.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps german.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps italian.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps japanese.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps latin-am.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps spanish.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps uk.kbd usr/lib/keymaps 444
trans_src sys/kernel/ibm/keymaps us-std.kbd usr/lib/keymaps 444

# /usr/preserve
(cd $tmp_root && as_root -c 'ln -s /var/preserve usr/preserve')

# /usr/mdec
(cd $tmp_root && as_root -c 'mkdir -p usr/mdec && chmod 755 usr/mdec')
trans sys/boot boot usr/mdec 444
trans sys/boot bootblock usr/mdec 444
trans sys/boot dosboot.com usr/mdec 444
trans sys/boot edparams usr/mdec 555
trans sys/boot installboot usr/mdec 555
trans sys/boot jumpboot usr/mdec 444
trans sys/boot masterboot usr/mdec 444

# /usr/spool
(cd $tmp_root && as_root -c 'ln -s /var/spool usr/spool')

# /usr/tmp
(cd $tmp_root && as_root -c 'mkdir -p usr/tmp && chmod 1777 usr/tmp')

# /usr/run
(cd $tmp_root && as_root -c 'ln -s /var/run usr/run')

# /usr/sbin
(cd $tmp_root && as_root -c 'mkdir -p usr/sbin && chmod 755 usr/sbin')
trans sys/inet inet usr/sbin 555
trans bsd44/usr.sbin/inetd inetd usr/sbin 555
mk_pkg pkg/ssc
transfer_res pkg/ssc/sscrcpd sscrcpd usr/sbin sscrcpd 755 root
transfer_res pkg/ssc/sscrshd sscrshd usr/sbin sscrshd 755 root
transfer_res pkg/ssc/sscserver sscserver usr/sbin sscserver 755 root
transfer_res pkg/ssc/ssctelnetd ssctelnetd usr/sbin ssctelnetd 755 root
transfer_res pkg/ssc/util ssc_runas usr/sbin ssc_runas 755 root
transfer vmd/cmd/rlogind rlogind usr/sbin in.rlogind 555 root
trans vmd/cmd/simple in.rshd usr/sbin 555
trans vmd/cmd/simple loop_ctrl usr/sbin 555
trans vmd/cmd/simple nonamed usr/sbin 555
trans vmd/cmd/simple rarpd usr/sbin 555
trans_named_src vmd/cmd/simple setup.sh usr/sbin/setup 555

# /usr/share
(cd $tmp_root && as_root -c 'mkdir -p usr/share && chmod 755 usr/share')
(cd $tmp_root && as_root -c 'mkdir -p usr/share/mk && chmod 755 usr/share/mk')
for f in bsd.README bsd.doc.mk bsd.lib.mk bsd.man.mk bsd.prog.mk bsd.subdir.mk sys.mk
do
	trans_named_src bsd44/share/mk $f usr/share/mk 444
done

# /usr/local/share
(cd $tmp_root && as_root -c 'mkdir -p usr/local/share && chmod 755 usr/local/share')
trans_src gnu/cmd/bison-1.25 bison.hairy usr/local/share 444
trans_src gnu/cmd/bison-1.25 bison.simple usr/local/share 444

# /usr/include
(cd $tmp_root && as_root -c 'ln -s /usr/src/include usr/include')

fi

# vmd/cmd/simple -> usr/man
#./@build.8
#./adduser.8
#./build.8
#./catman.1
#./checkhier.8
#./rdate.8
(cd $tmp_root && as_root -c 'mkdir -p usr/man/man1 && chmod 755 usr/man/man1')
trans_src vmd/cmd/simple acd.1 usr/man/man1 444
trans_src vmd/cmd/simple arx.1 usr/man/man1 444
trans_src vmd/cmd/simple clear.1 usr/man/man1 444
trans_src vmd/cmd/simple cmp.1 usr/man/man1 444
trans_src vmd/cmd/simple cp.1 usr/man/man1 444
trans_src vmd/cmd/simple eject.1 usr/man/man1 444
trans_src vmd/cmd/simple env.1 usr/man/man1 444
trans_src vmd/cmd/simple hostaddr.1 usr/man/man1 444
trans_src vmd/cmd/simple httpget.1 usr/man/man1 444
trans_src vmd/cmd/simple install.1 usr/man/man1 444
trans_src vmd/cmd/simple look.1 usr/man/man1 444
trans_src vmd/cmd/simple ls.1 usr/man/man1 444
trans_src vmd/cmd/simple mail.1 usr/man/man1 444
trans_src vmd/cmd/simple makewhatis.1 usr/man/man1 444
trans_src vmd/cmd/simple man.1 usr/man/man1 444
trans_src vmd/cmd/simple mount.1 usr/man/man1 444
trans_src vmd/cmd/simple mt.1 usr/man/man1 444
trans_src vmd/cmd/simple pkginfo.1 usr/man/man1 444
trans_src vmd/cmd/simple remsync.1 usr/man/man1 444
trans_src vmd/cmd/simple rget.1 usr/man/man1 444
trans_src vmd/cmd/simple rmdir.1 usr/man/man1 444
trans_src vmd/cmd/simple sleep.1 usr/man/man1 444
trans_src vmd/cmd/simple spell.1 usr/man/man1 444
trans_src vmd/cmd/simple stat.1 usr/man/man1 444
trans_src vmd/cmd/simple synctree.1 usr/man/man1 444
trans_src vmd/cmd/simple sysenv.1 usr/man/man1 444
trans_src vmd/cmd/simple tget.1 usr/man/man1 444
trans_src vmd/cmd/simple uname.1 usr/man/man1 444
trans_src vmd/cmd/simple utime.1 usr/man/man1 444
trans_src vmd/cmd/simple whatis.1 usr/man/man1 444
trans_src vmd/cmd/simple which.1 usr/man/man1 444
trans_src vmd/cmd/simple yes.1 usr/man/man1 444
trans_src vmd/cmd/simple zexec.1 usr/man/man1 444
(cd $tmp_root && as_root -c 'mkdir -p usr/man/man8 && chmod 755 usr/man/man8')
trans_src vmd/cmd/simple MAKEDEV.8 usr/man/man8 444
trans_src vmd/cmd/simple cleantmp.8 usr/man/man8 444
trans_src vmd/cmd/simple ifconfig.8 usr/man/man8 444
trans_src vmd/cmd/simple ifconfig6.8 usr/man/man8 444
trans_src vmd/cmd/simple intr.8 usr/man/man8 444
trans_src vmd/cmd/simple irdpd.8 usr/man/man8 444
trans_src vmd/cmd/simple loop_ctrl.8 usr/man/man8 444
trans_src vmd/cmd/simple nonamed.8 usr/man/man8 444
trans_src vmd/cmd/simple pkgadd.8 usr/man/man8 444
trans_src vmd/cmd/simple pwdauth.8 usr/man/man8 444
trans_src vmd/cmd/simple rarpd.8 usr/man/man8 444
trans_src vmd/cmd/simple rijntunnel.8 usr/man/man8 444
trans_src vmd/cmd/simple rshd.8 usr/man/man8 444
trans_src vmd/cmd/simple slip.8 usr/man/man8 444
trans_src vmd/cmd/simple stf.8 usr/man/man8 444
trans_src vmd/cmd/simple vdisk_ctrl.8 usr/man/man8 444

# /usr/man/whatis
(cd $tmp_root && as_root -c 'makewhatis usr/man')

# /usr/src
(cd $tmp_root && as_root -c 'mkdir -p usr/src && chmod 755 usr/src')
trans_src_dir scripts usr/src/scripts a+rX,a-w,u-s
trans_src_dir etc usr/src/etc a+rX,a-w,u-s
trans_src_dir usr.etc usr/src/usr.etc a+rX,a-w,u-s
trans_src_dir usr.lib.ack usr/src/usr.lib.ack a+rX,a-w,u-s
trans_src_dir usr.lib.gnu usr/src/usr.lib.gnu a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/bin &&
	chmod 755 usr/src/bsd44/bin')
trans_src_dir bsd44/bin/sh usr/src/bsd44/bin/sh a+rX,a-w,u-s
trans_src_dir bsd44/bin/pax usr/src/bsd44/bin/pax a+rX,a-w,u-s
trans_src_dir bsd44/bin/rcp usr/src/bsd44/bin/rcp a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/sbin &&
	chmod 755 usr/src/bsd44/sbin')
trans_src_dir bsd44/sbin/ping usr/src/bsd44/sbin/ping a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/usr.bin &&
	chmod 755 usr/src/bsd44/usr.bin')
trans_src_dir bsd44/usr.bin/ar usr/src/bsd44/usr.bin/ar a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/nm usr/src/bsd44/usr.bin/nm a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/compress usr/src/bsd44/usr.bin/compress a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/cut usr/src/bsd44/usr.bin/cut a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/finger usr/src/bsd44/usr.bin/finger a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/fmt usr/src/bsd44/usr.bin/fmt a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/make usr/src/bsd44/usr.bin/make a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/more usr/src/bsd44/usr.bin/more a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/nice usr/src/bsd44/usr.bin/nice a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/ranlib usr/src/bsd44/usr.bin/ranlib a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/rlogin usr/src/bsd44/usr.bin/rlogin a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/rsh usr/src/bsd44/usr.bin/rsh a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/sed usr/src/bsd44/usr.bin/sed a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/tftp usr/src/bsd44/usr.bin/tftp a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/tip usr/src/bsd44/usr.bin/tip a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/tr usr/src/bsd44/usr.bin/tr a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/whois usr/src/bsd44/usr.bin/whois a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/xargs usr/src/bsd44/usr.bin/xargs a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/yacc usr/src/bsd44/usr.bin/yacc a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/mail usr/src/bsd44/usr.bin/mail a+rX,a-w,u-s
trans_src_dir bsd44/usr.bin/wall usr/src/bsd44/usr.bin/wall a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/usr.sbin &&
	chmod 755 usr/src/bsd44/usr.sbin')
trans_src_dir bsd44/usr.sbin/inetd usr/src/bsd44/usr.sbin/inetd a+rX,a-w,u-s
trans_src_dir bsd44/usr.sbin/lpr usr/src/bsd44/usr.sbin/lpr a+rX,a-w,u-s
trans_src_dir bsd44/usr.sbin/syslogd usr/src/bsd44/usr.sbin/syslogd a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/lib &&
	chmod 755 usr/src/bsd44/lib')
trans_src bsd44/lib Amake.cmds usr/src/bsd44/lib 444
trans_src bsd44/lib Amake.srclist usr/src/bsd44/lib 444
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/lib/libc &&
	chmod 755 usr/src/bsd44/lib/libc')
trans_src bsd44/lib/libc Amake.srclist usr/src/bsd44/lib/libc 444
trans_src_dir bsd44/lib/libc/include usr/src/bsd44/lib/libc/include a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/compat-43 usr/src/bsd44/lib/libc/compat-43 a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/db usr/src/bsd44/lib/libc/db a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/gen usr/src/bsd44/lib/libc/gen a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/i386 usr/src/bsd44/lib/libc/i386 a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/locale usr/src/bsd44/lib/libc/locale a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/minix usr/src/bsd44/lib/libc/minix a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/net usr/src/bsd44/lib/libc/net a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/regex usr/src/bsd44/lib/libc/regex a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/stdio usr/src/bsd44/lib/libc/stdio a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/stdlib usr/src/bsd44/lib/libc/stdlib a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/stdtime usr/src/bsd44/lib/libc/stdtime a+rX,a-w,u-s
trans_src_dir bsd44/lib/libc/string usr/src/bsd44/lib/libc/string a+rX,a-w,u-s
trans_src_dir bsd44/lib/libterm usr/src/bsd44/lib/libterm a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/lib/librpc &&
	chmod 755 usr/src/bsd44/lib/librpc')
trans_src_dir bsd44/lib/librpc/rpc usr/src/bsd44/lib/librpc/rpc a+rX,a-w,u-s
trans_src_dir bsd44/lib/libutil usr/src/bsd44/lib/libutil a+rX,a-w,u-s
trans_src_dir bsd44/lib/libedit usr/src/bsd44/lib/libedit a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/libexec &&
	chmod 755 usr/src/bsd44/libexec')
trans_src_dir bsd44/libexec/fingerd usr/src/bsd44/libexec/fingerd a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/bsd44/share &&
	chmod 755 usr/src/bsd44/share')
trans_src_dir bsd44/share/mk usr/src/bsd44/share/mk a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/cmd &&
	chmod 755 usr/src/cmd')
trans_src_dir cmd/simple usr/src/cmd/simple a+rX,a-w,u-s
trans_src_dir cmd/ibm usr/src/cmd/ibm a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/gnu/cmd &&
	chmod 755 usr/src/gnu/cmd')
trans_src_dir gnu/cmd/bison-1.25 usr/src/gnu/cmd/bison-1.25 a+rX,a-w,u-s
trans_src_dir gnu/cmd/grep-2.0 usr/src/gnu/cmd/grep-2.0 a+rX,a-w,u-s
trans_src_dir gnu/cmd/gawk-3.0.6 usr/src/gnu/cmd/gawk-3.0.6 a+rX,a-w,u-s
trans_src_dir gnu/cmd/cpio-2.4.2 usr/src/gnu/cmd/cpio-2.4.2 a+rX,a-w,u-s
trans_src_dir gnu/cmd/diffutils-2.7 usr/src/gnu/cmd/diffutils-2.7 a+rX,a-w,u-s
trans_src_dir gnu/cmd/gzip-1.2.4 usr/src/gnu/cmd/gzip-1.2.4 a+rX,a-w,u-s
trans_src_dir gnu/cmd/joe-2.8 usr/src/gnu/cmd/joe-2.8 a+rX,a-w,u-s
trans_src_dir gnu/cmd/mtools-3.9.7 usr/src/gnu/cmd/mtools-3.9.7 a+rX,a-w,u-s
trans_src_dir gnu/cmd/patch-2.5.4 usr/src/gnu/cmd/patch-2.5.4 a+rX,a-w,u-s
trans_src_dir gnu/cmd/rcs5.6.0.1 usr/src/gnu/cmd/rcs5.6.0.1 a+rX,a-w,u-s
trans_src_dir gnu/cmd/screen-3.2b usr/src/gnu/cmd/screen-3.2b a+rX,a-w,u-s
trans_src_dir Amakelib usr/src/Amakelib a+rX,a-w,u-s
trans_src_dir include usr/src/include a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/lib &&
	chmod 755 usr/src/lib')
trans_src_dir lib/libc usr/src/lib/libc a+rX,a-w,u-s
trans_src_dir lib/gcc usr/src/lib/gcc a+rX,a-w,u-s
trans_src_dir lib/crypto usr/src/lib/crypto a+rX,a-w,u-s
trans_src_dir lib/curses usr/src/lib/curses a+rX,a-w,u-s
trans_src_dir lib/ieee_float usr/src/lib/ieee_float a+rX,a-w,u-s
trans_src_dir lib/ip usr/src/lib/ip a+rX,a-w,u-s
trans_src_dir lib/libasyn usr/src/lib/libasyn a+rX,a-w,u-s
trans_src_dir lib/libm usr/src/lib/libm a+rX,a-w,u-s
trans_src_dir lib/libnbio usr/src/lib/libnbio a+rX,a-w,u-s
trans_src_dir lib/mach usr/src/lib/mach a+rX,a-w,u-s
trans_src_dir lib/misc usr/src/lib/misc a+rX,a-w,u-s
trans_src_dir lib/os usr/src/lib/os a+rX,a-w,u-s
trans_src_dir lib/ack usr/src/lib/ack a+rX,a-w,u-s
trans_src_dir lib/editline usr/src/lib/editline a+rX,a-w,u-s
trans_src_dir sys usr/src/sys a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/pkg &&
	chmod 755 usr/src/pkg')
trans_src_dir pkg/ack usr/src/pkg/ack a+rX,a-w,u-s
trans_src_dir pkg/ack.prev usr/src/pkg/ack.prev a+rX,a-w,u-s
trans_src_dir pkg/libpcap-1.1 usr/src/pkg/libpcap-1.1 a+rX,a-w,u-s
trans_src_dir pkg/chat usr/src/pkg/chat a+rX,a-w,u-s
trans_src_dir pkg/bind-4.9.7-obsd usr/src/pkg/bind-4.9.7-obsd a+rX,a-w,u-s
trans_src_dir pkg/freebsd-mixer usr/src/pkg/freebsd-mixer a+rX,a-w,u-s
trans_src_dir pkg/flex-2.5.4 usr/src/pkg/flex-2.5.4 a+rX,a-w,u-s
trans_src_dir pkg/nntpclnt-1.6.1 usr/src/pkg/nntpclnt-1.6.1 a+rX,a-w,u-s
trans_src_dir pkg/nvi.1.34 usr/src/pkg/nvi.1.34 a+rX,a-w,u-s
trans_src_dir pkg/smail-3.1.28 usr/src/pkg/smail-3.1.28 a+rX,a-w,u-s
trans_src_dir pkg/ssc-0.4 usr/src/pkg/ssc-4 a+rX,a-w,u-s
trans_src_dir pkg/tcpdump-4.1 usr/src/pkg/tcpdump-4.1 a+rX,a-w,u-s
trans_src_dir pkg/traceroute-1.2 usr/src/pkg/traceroute-1.2 a+rX,a-w,u-s
trans_src_dir pkg/tzcode1999g usr/src/pkg/tzcode1999g a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/vmd &&
	chmod 755 usr/src/vmd')
trans_src_dir vmd/mnximg usr/src/vmd/mnximg a+rX,a-w,u-s
(cd $tmp_root && as_root -c 'mkdir -p usr/src/vmd/cmd &&
	chmod 755 usr/src/vmd/cmd')
trans_src_dir vmd/cmd/reboot usr/src/vmd/cmd/reboot a+rX,a-w,u-s
trans_src_dir vmd/cmd/simple usr/src/vmd/cmd/simple a+rX,a-w,u-s
trans_src_dir vmd/cmd/amake usr/src/vmd/cmd/amake a+rX,a-w,u-s
trans_src_dir vmd/cmd/asmconv usr/src/vmd/cmd/asmconv a+rX,a-w,u-s
trans_src_dir vmd/cmd/cawf usr/src/vmd/cmd/cawf a+rX,a-w,u-s
trans_src_dir vmd/cmd/cron usr/src/vmd/cmd/cron a+rX,a-w,u-s
trans_src_dir vmd/cmd/dhcpd usr/src/vmd/cmd/dhcpd a+rX,a-w,u-s
trans_src_dir vmd/cmd/dis386 usr/src/vmd/cmd/dis386 a+rX,a-w,u-s
trans_src_dir vmd/cmd/ftpd usr/src/vmd/cmd/ftpd a+rX,a-w,u-s
trans_src_dir vmd/cmd/ibm usr/src/vmd/cmd/ibm a+rX,a-w,u-s
trans_src_dir vmd/cmd/nm usr/src/vmd/cmd/nm a+rX,a-w,u-s
trans_src_dir vmd/cmd/patchtree usr/src/vmd/cmd/patchtree a+rX,a-w,u-s
trans_src_dir vmd/cmd/pdtar-nov87 usr/src/vmd/cmd/pdtar-nov87 a+rX,a-w,u-s
trans_src_dir vmd/cmd/pnp usr/src/vmd/cmd/pnp a+rX,a-w,u-s
trans_src_dir vmd/cmd/profile usr/src/vmd/cmd/profile a+rX,a-w,u-s
trans_src_dir vmd/cmd/rip usr/src/vmd/cmd/rip a+rX,a-w,u-s
trans_src_dir vmd/cmd/tsd usr/src/vmd/cmd/tsd a+rX,a-w,u-s
trans_src_dir vmd/cmd/telnet usr/src/vmd/cmd/telnet a+rX,a-w,u-s
trans_src_dir vmd/cmd/yap usr/src/vmd/cmd/yap a+rX,a-w,u-s
trans_src_dir vmd/cmd/rlogind usr/src/vmd/cmd/rlogind a+rX,a-w,u-s

(cd $tmp_root/usr/src && ls -lR)

# /var
(cd $tmp_root && as_root -c 'mkdir -p var && chmod 755 var')

as_root -c "umount '$tmp_root'"
as_root -c "$loop_ctrl -d '$loop_dev'"
