forked from fabiand/image-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mk
40 lines (33 loc) · 1.42 KB
/
build.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
# This makefile includes functionality related to building and
# testing the images which can be created usign the kickstart
# files
#
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
DISTRO=
RELEASEVER=
noop:
@echo Please select a specific target
@echo make rootfs.qcow2
@echo This expects rootfs.ks to exist
# Direct for virt-sparsify: http://libguestfs.org/guestfs.3.html#backend
export LIBGUESTFS_BACKEND=direct
# Workaround nest problem: https://bugzilla.redhat.com/show_bug.cgi?id=1195278
export LIBGUESTFS_BACKEND_SETTINGS=force_tcg
export TMPDIR=/var/tmp/
%.qcow2: SPARSE=1
%.qcow2: %.ks
bash $(mkfile_dir)/anaconda_install $(DISTRO) $(RELEASEVER) $< $@ $(DISK_SIZE)
-[[ -n "$(SPARSE)" ]] && [[ "$$(virt-sparsify --help)" =~ --in-place ]] && ( virt-sparsify --in-place $@ ; ln $@ $@.sparse ; )
-[[ -n "$(SPARSE)" ]] && [[ ! -f $@.sparse ]] && [[ "$$(virt-sparsify --help)" =~ --check-tempdir ]] && virt-sparsify --check-tmpdir=continue $@ $@.sparse
-[[ -n "$(SPARSE)" ]] && [[ ! -f $@.sparse ]] && virt-sparsify $@ $@.sparse
-[[ -f $@.sparse ]] && ( mv -v $@.sparse $@ ; rm -f $@.sparse ; )
%.raw: %.qcow2
qemu-img convert -p -S 1M -O raw $< $@
%.squashfs.img: %.raw
[[ $$(guestfish --ro -i -a $< is-dir /boot) = "true" ]]
bash $(mkfile_dir)/image_to_squashfs $< $@
%.tar.xz: %.qcow2
guestfish --ro -i -a $< tar-out / $@ compress:xz
%-manifest-rpm: %.qcow2
guestfish --ro -i -a $< sh 'rpm -qa | sort -u' > $@