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

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

143 echo '/dev/gpt/swapfs none swap sw 0 0' \
144 >> ${DESTDIR}/etc/fstab
145 fi
146
147 local hostname
148 hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')"
149 echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf
150
1#!/bin/sh
2#
3# $FreeBSD$
4#
5#
6# Common functions for virtual machine image build scripts.
7#
8

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

143 echo '/dev/gpt/swapfs none swap sw 0 0' \
144 >> ${DESTDIR}/etc/fstab
145 fi
146
147 local hostname
148 hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')"
149 echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf
150
151 if ! [ -z "${QEMUSTATIC}" ]; then
152 export EMULATOR=/qemu
153 cp ${QEMUSTATIC} ${DESTDIR}/${EMULATOR}
154 fi
155
151 mkdir -p ${DESTDIR}/dev
152 mount -t devfs devfs ${DESTDIR}/dev
156 mkdir -p ${DESTDIR}/dev
157 mount -t devfs devfs ${DESTDIR}/dev
153 chroot ${DESTDIR} /usr/bin/newaliases
154 chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart
158 chroot ${DESTDIR} ${EMULATOR} /usr/bin/newaliases
159 chroot ${DESTDIR} ${EMULATOR} /bin/sh /etc/rc.d/ldconfig forcestart
155 umount_loop ${DESTDIR}/dev
156
157 cp /etc/resolv.conf ${DESTDIR}/etc/resolv.conf
158
159 return 0
160}
161
162vm_extra_install_base() {

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

183}
184
185vm_extra_install_packages() {
186 if [ -z "${VM_EXTRA_PACKAGES}" ]; then
187 return 0
188 fi
189 mkdir -p ${DESTDIR}/dev
190 mount -t devfs devfs ${DESTDIR}/dev
160 umount_loop ${DESTDIR}/dev
161
162 cp /etc/resolv.conf ${DESTDIR}/etc/resolv.conf
163
164 return 0
165}
166
167vm_extra_install_base() {

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

188}
189
190vm_extra_install_packages() {
191 if [ -z "${VM_EXTRA_PACKAGES}" ]; then
192 return 0
193 fi
194 mkdir -p ${DESTDIR}/dev
195 mount -t devfs devfs ${DESTDIR}/dev
191 chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
196 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
192 /usr/sbin/pkg bootstrap -y
197 /usr/sbin/pkg bootstrap -y
193 chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
198 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
194 /usr/sbin/pkg install -y ${VM_EXTRA_PACKAGES}
195 umount_loop ${DESTDIR}/dev
196
197 return 0
198}
199
200vm_extra_install_ports() {
201 # Prototype. When overridden, installs additional ports within the
202 # virtual machine environment.
203
204 return 0
205}
206
207vm_extra_pre_umount() {
208 # Prototype. When overridden, performs additional tasks within the
209 # virtual machine environment prior to unmounting the filesystem.
210 # Note: When overriding this function, removing resolv.conf in the
211 # disk image must be included.
212
199 /usr/sbin/pkg install -y ${VM_EXTRA_PACKAGES}
200 umount_loop ${DESTDIR}/dev
201
202 return 0
203}
204
205vm_extra_install_ports() {
206 # Prototype. When overridden, installs additional ports within the
207 # virtual machine environment.
208
209 return 0
210}
211
212vm_extra_pre_umount() {
213 # Prototype. When overridden, performs additional tasks within the
214 # virtual machine environment prior to unmounting the filesystem.
215 # Note: When overriding this function, removing resolv.conf in the
216 # disk image must be included.
217
218 if ! [ -z "${QEMUSTATIC}" ]; then
219 rm -f ${DESTDIR}/${EMULATOR}
220 fi
213 rm -f ${DESTDIR}/etc/resolv.conf
214 return 0
215}
216
217vm_extra_pkg_rmcache() {
218 if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
221 rm -f ${DESTDIR}/etc/resolv.conf
222 return 0
223}
224
225vm_extra_pkg_rmcache() {
226 if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then
219 chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \
227 chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
220 /usr/local/sbin/pkg clean -y -a
221 fi
222
223 return 0
224}
225
226umount_loop() {
227 DIR=$1

--- 30 unchanged lines hidden ---
228 /usr/local/sbin/pkg clean -y -a
229 fi
230
231 return 0
232}
233
234umount_loop() {
235 DIR=$1

--- 30 unchanged lines hidden ---