vmimage.subr (9f3d45b6d45423c3e992be6f9575fe76cc032c3c) vmimage.subr (25c11557710ac95084a775bf3a5bdd97dff70c1e)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5#
6# Common functions for virtual machine image build scripts.
7#
8

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

62 truncate -s ${VMSIZE} ${VMBASE}
63 mddev=$(mdconfig -f ${VMBASE})
64 newfs -j /dev/${mddev}
65 mount /dev/${mddev} ${DESTDIR}
66
67 return 0
68}
69
1#!/bin/sh
2#
3# $FreeBSD$
4#
5#
6# Common functions for virtual machine image build scripts.
7#
8

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

62 truncate -s ${VMSIZE} ${VMBASE}
63 mddev=$(mdconfig -f ${VMBASE})
64 newfs -j /dev/${mddev}
65 mount /dev/${mddev} ${DESTDIR}
66
67 return 0
68}
69
70vm_copy_base() {
71 # Creates a new UFS root filesystem and copies the contents of the
72 # current root filesystem into it. This produces a "clean" disk
73 # image without any remnants of files which were created temporarily
74 # during image-creation and have since been deleted (e.g., downloaded
75 # package archives).
76
77 mkdir -p ${DESTDIR}/old
78 mdold=$(mdconfig -f ${VMBASE})
79 mount /dev/${mdold} ${DESTDIR}/old
80
81 truncate -s ${VMSIZE} ${VMBASE}.tmp
82 mkdir -p ${DESTDIR}/new
83 mdnew=$(mdconfig -f ${VMBASE}.tmp)
84 newfs -j /dev/${mdnew}
85 mount /dev/${mdnew} ${DESTDIR}/new
86
87 tar -cf- -C ${DESTDIR}/old . | tar -xf- -C ${DESTDIR}/new
88
89 umount /dev/${mdold}
90 rmdir ${DESTDIR}/old
91 mdconfig -d -u ${mdold}
92
93 umount /dev/${mdnew}
94 rmdir ${DESTDIR}/new
95 mdconfig -d -u ${mdnew}
96 mv ${VMBASE}.tmp ${VMBASE}
97}
98
70vm_install_base() {
71 # Installs the FreeBSD userland/kernel to the virtual machine disk.
72
73 cd ${WORLDDIR} && \
74 make DESTDIR=${DESTDIR} \
75 installworld installkernel distribution || \
76 err "\n\nCannot install the base system to ${DESTDIR}."
77

--- 108 unchanged lines hidden ---
99vm_install_base() {
100 # Installs the FreeBSD userland/kernel to the virtual machine disk.
101
102 cd ${WORLDDIR} && \
103 make DESTDIR=${DESTDIR} \
104 installworld installkernel distribution || \
105 err "\n\nCannot install the base system to ${DESTDIR}."
106

--- 108 unchanged lines hidden ---