vmimage.subr (7d97075f02527bcf29318143c2fc3650be79ee07) vmimage.subr (4e7bc9f0f7b329ce952e0faa4674d143ae2568ac)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5#
6# Common functions for virtual machine image build scripts.
7#
8
9export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
10trap "cleanup" INT QUIT TRAP ABRT TERM
11
12write_partition_layout() {
1#!/bin/sh
2#
3# $FreeBSD$
4#
5#
6# Common functions for virtual machine image build scripts.
7#
8
9export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
10trap "cleanup" INT QUIT TRAP ABRT TERM
11
12write_partition_layout() {
13 if [ -z "${NOSWAP}" ]; then
14 SWAPOPT="-p freebsd-swap/swapfs::1G"
15 fi
13
14 case "${TARGET}:${TARGET_ARCH}" in
15 amd64:amd64 | i386:i386)
16 mkimg -s gpt -b /boot/pmbr \
17 -p freebsd-boot/bootfs:=/boot/gptboot \
16
17 case "${TARGET}:${TARGET_ARCH}" in
18 amd64:amd64 | i386:i386)
19 mkimg -s gpt -b /boot/pmbr \
20 -p freebsd-boot/bootfs:=/boot/gptboot \
18 -p freebsd-swap/swapfs::1G \
21 ${SWAPOPT} \
19 -p freebsd-ufs/rootfs:=${VMBASE} \
20 -o ${VMIMAGE}
21 ;;
22 powerpc:powerpc*)
23 mkimg -s apm \
24 -p apple-boot/bootfs:=/boot/boot1.hfs \
22 -p freebsd-ufs/rootfs:=${VMBASE} \
23 -o ${VMIMAGE}
24 ;;
25 powerpc:powerpc*)
26 mkimg -s apm \
27 -p apple-boot/bootfs:=/boot/boot1.hfs \
25 -p freebsd-swap/swapfs::1G \
28 ${SWAPOPT} \
26 -p freebsd-ufs/rootfs:=${VMBASE} \
27 -o ${VMIMAGE}
28 ;;
29 *)
30 # ENOTSUPP
31 return 1
32 ;;
33 esac

--- 37 unchanged lines hidden (view full) ---

71 make DESTDIR=${DESTDIR} \
72 installworld installkernel distribution || \
73 err "\n\nCannot install the base system to ${DESTDIR}."
74
75 echo '# Custom /etc/fstab for FreeBSD VM images' \
76 > ${DESTDIR}/etc/fstab
77 echo '/dev/gpt/rootfs / ufs rw 1 1' \
78 >> ${DESTDIR}/etc/fstab
29 -p freebsd-ufs/rootfs:=${VMBASE} \
30 -o ${VMIMAGE}
31 ;;
32 *)
33 # ENOTSUPP
34 return 1
35 ;;
36 esac

--- 37 unchanged lines hidden (view full) ---

74 make DESTDIR=${DESTDIR} \
75 installworld installkernel distribution || \
76 err "\n\nCannot install the base system to ${DESTDIR}."
77
78 echo '# Custom /etc/fstab for FreeBSD VM images' \
79 > ${DESTDIR}/etc/fstab
80 echo '/dev/gpt/rootfs / ufs rw 1 1' \
81 >> ${DESTDIR}/etc/fstab
79 echo '/dev/gpt/swapfs none swap sw 0 0' \
80 >> ${DESTDIR}/etc/fstab
82 if [ -z "${NOSWAP}" ]; then
83 echo '/dev/gpt/swapfs none swap sw 0 0' \
84 >> ${DESTDIR}/etc/fstab
85 fi
81
82 mkdir -p ${DESTDIR}/dev
83 mount -t devfs devfs ${DESTDIR}/dev
84 chroot ${DESTDIR} /usr/bin/newaliases
85 chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart
86 umount ${DESTDIR}/dev
87
88 cp /etc/resolv.conf ${DESTDIR}/etc/resolv.conf

--- 83 unchanged lines hidden ---
86
87 mkdir -p ${DESTDIR}/dev
88 mount -t devfs devfs ${DESTDIR}/dev
89 chroot ${DESTDIR} /usr/bin/newaliases
90 chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart
91 umount ${DESTDIR}/dev
92
93 cp /etc/resolv.conf ${DESTDIR}/etc/resolv.conf

--- 83 unchanged lines hidden ---