-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile.am
116 lines (97 loc) · 4.15 KB
/
Makefile.am
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright (C) 2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at http://www.gnu.org/copyleft/gpl.html.
SQUASHFSFILENAME = @IMAGENAME@.squashfs.img
RPMMANIFESTNAME = @IMAGENAME@.manifest-rpm
RPMUNSIGNEDNAME = @IMAGENAME@.unsigned-rpms
DISTRO = @DISTRO@
LMC_CPUS = 2
LMC_MEM = 4096
DISTCLEANFILES = \
aclocal.m4 \
configure \
install-sh \
livemedia.log \
Makefile.in \
missing \
*.log
CURLOPTS=-L4
debug-ks: data/@IMAGENAME@.ks
sed -i 's/^poweroff/#poweroff/' $<
# Building a "LiveOS" vm for debugging ks issues
debug-squashfs: LMCOPTS=--vnc vnc=127.0.0.1:5
debug-squashfs: | debug-ks $(SQUASHFSFILENAME)
@echo debug-squashfs $(SQUASHFSFILENAME)
squashfs: $(SQUASHFSFILENAME) $(RPMMANIFESTNAME) $(RPMUNSIGNEDNAME)
@echo squashfs: $(SQUASHFSFILENAME)
@echo squashfs rpm-manifest: $(RPMMANIFESTNAME)
@echo squashfs rpm-unsigned: $(RPMUNSIGNEDNAME)
product.img:
ISFINAL=@FINALBUILD@ bash scripts/create-product-img.sh $@
offline-installation-iso: product.img
PRODUCTIMG=$(PWD)/product.img \
BOOTISO=$(BOOTISO) \
SQUASHFS=$(SQUASHFSFILENAME) \
VERSION=$(PACKAGE_VERSION) \
DERVICEBOOTISOSCRIPT=scripts/derive-boot-iso.sh \
bash scripts/create-nightly-boot-iso.sh
iso: product.img @BOOTISO@ $(SQUASHFSFILENAME)
scripts/derive-boot-iso.sh $(BOOTISO) $(SQUASHFSFILENAME) "ovirt-node-ng-installer-$(PACKAGE_VERSION)-`date +%Y%m%d%H``rpm --eval %{dist}`.iso"
@BOOTISO@:
curl $(CURLOPTS) -O $(BOOTISOURL)
data/%.ks: data/%.j2
scripts/renderks.py $(DISTRO) > "$@"
LMC ?= livemedia-creator
%.squashfs.img: data/%.ks @BOOTISO@
$(LMC) $(LMCOPTS) --vcpus=$(LMC_CPUS) --ram=$(LMC_MEM) --kernel-args="ipv6.disable=1" --make-pxe-live --nomacboot --iso @BOOTISO@ --ks $< --resultdir build --tmp @TMPDIR@
mv -v build/*squash* "$@"
ls -l *squash*
file *squash*
# Short TMPDIR otherwise we run into trouble with guestfish < 1.33.27-1.fc24
# # -x -v to be more verbose
IN_ROOTFS=LIBGUESTFS_TMPDIR=/var/tmp guestfish -x -v --ro -a $(SQUASHFSFILENAME) run : mount /dev/sda / : mount-loop /LiveOS/rootfs.img / : sh
$(RPMMANIFESTNAME): $(SQUASHFSFILENAME)
$(IN_ROOTFS) "rpm -qa|sort" > $@
$(RPMUNSIGNEDNAME): $(SQUASHFSFILENAME)
$(IN_ROOTFS) "rpm -qa --qf '%{name}-%{version}-%{release}.%{arch} (%{SIGPGP:pgpsig})\n'" | grep -v "Key ID" > $@
ovirt-node-ng.spec: PLACEHOLDER_RPM=ovirt-node-ng-image-update-placeholder
ovirt-node-ng.spec: PLACEHOLDER_RPM_VERSION=$(shell $(IN_ROOTFS) "rpm -q --qf %{version} $(PLACEHOLDER_RPM)")
ovirt-node-ng.spec: PLACEHOLDER_RPM_RELEASE=$(shell $(IN_ROOTFS) "rpm -q --qf %{release} $(PLACEHOLDER_RPM)")
ovirt-node-ng.spec: ovirt-node-ng.spec.in
sed \
-e "s/\@IMAGENAME\@/$(IMAGENAME)/" \
-e "s/\@PACKAGE_VERSION\@/$(PACKAGE_VERSION)/" \
-e "s/\@PACKAGE_NAME\@/$(PACKAGE_NAME)/" \
-e "s/\@PACKAGE_RPM_VERSION\@/$(PACKAGE_RPM_VERSION)/" \
-e "s/\@PACKAGE_RPM_RELEASE\@/$(PACKAGE_RPM_RELEASE)/" \
-e "s/\@PLACEHOLDER_RPM_VERSION\@/$(PLACEHOLDER_RPM_VERSION)/" \
-e "s/\@PLACEHOLDER_RPM_RELEASE\@/$(PLACEHOLDER_RPM_RELEASE)/" \
$< > $@
RPMBUILD = rpmbuild
TMPREPOS = tmp.repos
rpm srpm: ovirt-node-ng.spec $(RPMMANIFESTNAME) $(RPMUNSIGNEDNAME) $(SQUASHFSFILENAME) product.img
rm -fr "$(TMPREPOS)"
mkdir -p $(TMPREPOS)/{SPECS,RPMS,SRPMS,SOURCES}
make dist
$(RPMBUILD) \
--define="_topdir `pwd`/$(TMPREPOS)" \
--define "_sourcedir `pwd`" \
-ba ovirt-node-ng.spec
@echo
@echo "srpm and rpm(s) available at '$(TMPREPOS)'"
@echo
clean-local:
-rm -vrf $(SQUASHFSFILENAME) $(RPMMANIFESTNAME) $(RPMUNSIGNEDNAME) $(INSTALLEDIMAGEFILE) ovirt-node-ng.spec build