This repository has been archived by the owner on Jul 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
101 lines (83 loc) · 3.25 KB
/
Makefile
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
VERSION=0.8.10
INSTALL=install -p
SED=sed
LIBEXECDIR=/usr/libexec
DRACUTMODDIR=/usr/lib/dracut/modules.d
dracut_DIR = $(DRACUTMODDIR)/90system-upgrade
dracut_SCRIPTS = 90system-upgrade/module-setup.sh \
90system-upgrade/upgrade-init.sh \
90system-upgrade/upgrade-pre-pivot.sh \
90system-upgrade/upgrade-pre.sh \
90system-upgrade/upgrade.sh \
90system-upgrade/upgrade-post.sh \
90system-upgrade/initrd-system-upgrade-generator
dracut_DATA = 90system-upgrade/README.txt \
90system-upgrade/upgrade.target \
90system-upgrade/upgrade-pre.service \
90system-upgrade/upgrade.service \
90system-upgrade/upgrade-post.service \
90system-upgrade/system-upgrade-shell.service
upgrade_DIR = $(DRACUTMODDIR)/85system-upgrade-redhat
upgrade_BIN = system-upgrade-redhat
upgrade_SCRIPTS = 85system-upgrade-redhat/module-setup.sh \
85system-upgrade-redhat/keep-initramfs.sh \
85system-upgrade-redhat/prepare-rootfs.sh \
85system-upgrade-redhat/do-upgrade.sh \
85system-upgrade-redhat/upgrade-cleanup.sh \
85system-upgrade-redhat/save-journal.sh \
85system-upgrade-redhat/preupgrade-postupgrade.sh
THEMENAME=redhat-upgrade-tool
THEMESDIR=$(shell pkg-config ply-splash-graphics --variable=themesdir)
plymouth_DIR = $(THEMESDIR)$(THEMENAME)
plymouth_DATA = plymouth/*.png
plymouth_THEME = plymouth/redhat-upgrade-tool.plymouth
GENFILES = 85system-upgrade-redhat/module-setup.sh redhat-upgrade-dracut.spec
SCRIPTS = $(dracut_SCRIPTS) $(upgrade_SCRIPTS)
DATA = $(dracut_DATA) $(plymouth_DATA) $(plymouth_THEME)
BIN = $(upgrade_BIN)
all: $(SCRIPTS) $(DATA) $(BIN)
PACKAGES=glib-2.0 rpm ply-boot-client
$(BIN): %: %.c
$(CC) $(shell pkg-config $(PACKAGES) --cflags --libs) $(CFLAGS) $< -o $@
$(GENFILES): %: %.in
$(SED) -e 's,@LIBEXECDIR@,$(LIBEXECDIR),g' \
-e 's,@VERSION@,$(VERSION),g' \
$< > $@
clean:
rm -f $(BIN) $(GENFILES) $(ARCHIVE) upgrade.img
rm -rf rpm
install: $(BIN) $(SCRIPTS) $(DATA)
$(INSTALL) -d $(DESTDIR)$(LIBEXECDIR)
$(INSTALL) $(BIN) $(DESTDIR)$(LIBEXECDIR)
$(INSTALL) -d $(DESTDIR)$(dracut_DIR)
$(INSTALL) $(dracut_SCRIPTS) $(DESTDIR)$(dracut_DIR)
$(INSTALL) -m644 $(dracut_DATA) $(DESTDIR)$(dracut_DIR)
$(INSTALL) -d $(DESTDIR)$(upgrade_DIR)
$(INSTALL) $(upgrade_SCRIPTS) $(DESTDIR)$(upgrade_DIR)
$(INSTALL) -d $(DESTDIR)$(plymouth_DIR)
$(INSTALL) -m644 $(plymouth_DATA) $(DESTDIR)$(plymouth_DIR)
$(INSTALL) -m644 $(plymouth_THEME) \
$(DESTDIR)$(plymouth_DIR)/$(THEMENAME).plymouth
ARCHIVE = redhat-upgrade-dracut-$(VERSION).tar.xz
archive: $(ARCHIVE)
$(ARCHIVE):
git archive --format=tar --prefix=redhat-upgrade-dracut-$(VERSION)/ HEAD \
| xz -c > $@ || rm $@
rpm: $(ARCHIVE) redhat-upgrade-dracut.spec
mkdir -p rpm/build
rpmbuild -ba redhat-upgrade-dracut.spec \
--define '_specdir $(PWD)' \
--define '_sourcedir $(PWD)' \
--define '_specdir $(PWD)' \
--define '_srcrpmdir $(PWD)/rpm' \
--define '_rpmdir $(PWD)/rpm' \
--define '_builddir $(PWD)/rpm/build'
repo: make-redhat-upgrade-repo
mkdir repo
./make-redhat-upgrade-repo repo || rm -rf repo
upgrade.img:
PLYMOUTH_THEME_NAME=$(THEMENAME) \
dracut --conf /dev/null --confdir /var/empty --add "system-upgrade" \
--no-hostonly --nolvmconf --nomdadmconf --force --verbose \
upgrade.img
.PHONY: all clean archive install