-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
124 lines (104 loc) · 4.9 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Debian packaging Makefile
OS = $(shell uname -s)
OS : sh = uname -s
SHELL=/bin/bash
PKGNAME=gandi-hosting-vm2
RPMBUILDROOT=./rpm/
DESTDIR=./debian/$(PKGNAME)
VERSION = $(shell head -1 debian/changelog | egrep -o '\(.*\)' | sed -e 's/[()]//g')
VERSION_MAJOR = $(shell echo $(VERSION) | cut -d'-' -f1)
default:
@echo "Nothing."
install:
install -d $(DESTDIR)/etc/gandi
install -m 0750 ./manage_data_disk.py $(DESTDIR)/etc/gandi/
install -m 0750 ./manage_data_disk.sh $(DESTDIR)/etc/gandi/
install -m 0750 ./manage_iface.sh $(DESTDIR)/etc/gandi/
install -d -m 0750 $(DESTDIR)/etc/gandi/plugins.d
install -m 0750 ./gandi-config/plugins.d/* $(DESTDIR)/etc/gandi/plugins.d/
install -m 0640 ./sysctl.conf $(DESTDIR)/etc/gandi/
install -m 0640 ./gandi-config/plugins-lib $(DESTDIR)/etc/gandi/
install -d -m 0750 $(DESTDIR)/usr/share/gandi/bootstrap.d
install -m 0750 ./gandi-config/bootstrap.d/* $(DESTDIR)/usr/share/gandi/bootstrap.d/
install -m 0750 ./get_json.py $(DESTDIR)/usr/share/gandi/
install -d -m 0750 $(DESTDIR)/etc/gandi/hooks
install -m 0750 ./hooks/* $(DESTDIR)/etc/gandi/hooks/
ifeq ($(OS),Linux)
# XXX this is obsolete and should be removed soon
mkdir -p $(DESTDIR)/etc/udev/rules.d
install -m 0640 ./udev/gandi.rules $(DESTDIR)/etc/udev/rules.d/86-gandi.rules
#
#install -m 0640 ./udev/gandi.rules $(DESTDIR)/lib/udev/rules.d/86-gandi.rules
#
install -d -m 0755 $(DESTDIR)/lib/udev/rules.d
install -m 0755 ./udev/cpu_online.script $(DESTDIR)/lib/udev/cpu_online
install -m 0755 ./udev/manage_memory.script $(DESTDIR)/lib/udev/manage_memory
install -m 0755 ./udev/fake_blkid.script $(DESTDIR)/lib/udev/fake_blkid
install -d -m 0755 $(DESTDIR)/etc/apt/trusted.gpg.d
install -m 0644 ./keys/gandi-archive.gpg $(DESTDIR)/etc/apt/trusted.gpg.d/
# we copy the systemd files in the debian packages. If systemd is not
# installed, these files are useless
install -d -m 0755 $(DESTDIR)/usr/share/gandi/systemd
for elt in ./systemd/system/*.service; do \
install -m 0644 $$elt $(DESTDIR)/usr/share/gandi/systemd/; \
done
install -m 0750 kvm_to_xen_migration.sh $(DESTDIR)/usr/share/gandi/
install -d -m 0750 $(DESTDIR)/etc/auto.master.d
install -m 0640 autofs/auto.master.d/gandi.autofs $(DESTDIR)/etc/auto.master.d/
install -m 0750 autofs/auto.gandi $(DESTDIR)/etc/
install -d ${DESTDIR}/etc/kernel/postinst.d
install -m 0750 ./etc/kernel/postinst.d/gandi-decompress-kernel ${DESTDIR}/etc/kernel/postinst.d/
install -m 0750 ./decompress-kernel ${DESTDIR}/usr/share/gandi/
install -m 0750 ./extract-vmlinux ${DESTDIR}/usr/share/gandi/
endif
install -d -m 0755 $(DESTDIR)/etc/default
install -m 0644 ./gandi-config/gandi-config.default $(DESTDIR)/etc/default/gandi
install -d -m 0755 $(DESTDIR)/etc/init.d
install -m 0755 ./gandi-config/gandi-config $(DESTDIR)/etc/init.d
install -m 0755 ./gandi-mount/gandi-mount $(DESTDIR)/etc/init.d
install -m 0755 ./gandi-config/gandi-postboot $(DESTDIR)/etc/init.d
install -m 0755 ./gandi-config/gandi-bootstrap $(DESTDIR)/etc/init.d
deb:
debuild -us -uc -b || dpkg-buildpackage -rfakeroot -uc -b
dist: deb
# prepare files from deb build process
rm -rf debian/$(PKGNAME)-$(VERSION_MAJOR)
mkdir debian/$(PKGNAME)-$(VERSION_MAJOR)
cp -rf debian/$(PKGNAME)/* debian/$(PKGNAME)-$(VERSION_MAJOR)/
mv -f debian/$(PKGNAME)-$(VERSION_MAJOR)/etc/default \
debian/$(PKGNAME)-$(VERSION_MAJOR)/etc/sysconfig
install -m 0644 debian/changelog debian/$(PKGNAME)-$(VERSION_MAJOR)/
#
rm -rf debian/$(PKGNAME)-$(VERSION_MAJOR)/etc/apt/trusted.gpg.d
install -d -m 0755 debian/$(PKGNAME)-$(VERSION_MAJOR)/etc/pki/rpm-gpg/
install -m 0644 ./keys/RPM-GPG-KEY-Gandi \
debian/$(PKGNAME)-$(VERSION_MAJOR)/etc/pki/rpm-gpg/
install -d -m 0755 debian/$(PKGNAME)-$(VERSION_MAJOR)/usr/lib/sysctl.d/
install -m 0644 sysctl_systemd.conf \
debian/$(PKGNAME)-$(VERSION_MAJOR)/usr/lib/sysctl.d/90-gandi.conf
#
# create the tarball used during the rpm build process
gzip -9 debian/$(PKGNAME)-$(VERSION_MAJOR)/changelog
cd debian && tar cjf $(PKGNAME)-$(VERSION).tar.bz2 \
$(PKGNAME)-$(VERSION_MAJOR)
rpm: dist rpm_prepare
rpmbuild -bb ${RPMBUILDROOT}/SPECS/$(PKGNAME).spec
rpm_prepare:
mkdir -p ${RPMBUILDROOT}/{RPMS,SRPMS,SPECS,BUILD,TMP,SOURCES}
cp debian/$(PKGNAME)-$(VERSION).tar.bz2 ${RPMBUILDROOT}/SOURCES/
# prepare the spec file for the build of the current version
sed -e "s/\(%changelog\)/\1\n* $(shell LANG=C date +"%a %b %d %Y") Gandi Maintainer <[email protected]> $(VERSION)gnd\n- Bug fixing for packaging and scripts. See \/usr\/share\/doc\/$(PKGNAME)\/changelog.gz.\n/" \
-e "s/^\(%define version \).*/\1$(VERSION_MAJOR)/" \
rpm/$(PKGNAME).spec > $(RPMBUILDROOT)/SPECS/$(PKGNAME).spec
complete-clean: clean
for ext in deb changes tar.gz; do \
rm -vf ../$(PKGNAME)*.$$ext ; \
done
clean:
@echo "Cleaning ..."
@rm -rf debian/$(PKGNAME)
@rm -rf debian/$(PKGNAME).other
@rm -rf debian/$(PKGNAME)-1*
@rm -rf debian/$(PKGNAME).tar
@dh_clean
sinclude Makefile.specific