-
Notifications
You must be signed in to change notification settings - Fork 19
/
rules
executable file
·120 lines (98 loc) · 5.18 KB
/
rules
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
#!/usr/bin/make -f
export DEB_BUILD_HARDENING = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DEB_DH_INSTALLINIT_ARGS = --upstart-only
SHELL := sh -e
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
PY3V := $(filter-out $(shell py3versions -vd),$(shell py3versions -vr))
%:
dh ${@} --with autotools_dev,autoreconf,python3,systemd
override_dh_auto_configure:
dh_auto_configure -- --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
--libexecdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
--with-rootfs-path=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/lxc \
--enable-python $(shell dpkg-buildflags --export=configure) \
--enable-doc --disable-rpath --enable-apparmor --enable-selinux \
--enable-lua --enable-tests --enable-deprecated --with-distro=ubuntu
override_dh_auto_build:
dh_auto_build
set -e; cd src/python-lxc && for pv in $(PY3V); do \
CFLAGS="$$(python$$pv-config --includes) -I ../../src -L../../src/lxc/" python$$pv setup.py build; \
done
# Re-build static binary without pie/fpie (causes broken binary)
rm src/lxc/init.lxc.static
make LDFLAGS="" init.lxc.static -C src/lxc/
override_dh_auto_install:
dh_auto_install
set -e; cd src/python-lxc && for pv in $(PY3V); do \
CFLAGS="$$(python$$pv-config --includes) -I ../../src -L../../src/lxc/" python$$pv setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
done
override_dh_install:
if dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" lt "13.10"; then \
sed -i "s/^\( *\)\(dbus.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/container-base; \
sed -i "s/^\( *\)\(dbus.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/start-container; \
sed -ri "s/^_(have)\>/\\1/" debian/tmp/etc/bash_completion.d/lxc; \
fi
if dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" lt "14.04"; then \
sed -i "s/^\( *\)\(signal.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/container-base; \
sed -i "s/^\( *\)\(signal.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/start-container; \
sed -i "s/^\( *\)\(ptrace.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/container-base; \
sed -i "s/^\( *\)\(ptrace.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/start-container; \
fi
if dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" lt "14.10"; then \
sed -i "s/^\( *\)\(unix.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/container-base; \
sed -i "s/^\( *\)\(unix.*,\)/\\1#\\2/g" debian/tmp/etc/apparmor.d/abstractions/lxc/start-container; \
fi
if [ -x /usr/bin/dh_apparmor ]; then \
dh_apparmor -p lxc-common --profile-name=usr.bin.lxc-start; \
fi
# cleanup .la files
find debian/tmp/ -type f -name \*.la -delete
# copy apport hook
mkdir -p debian/tmp/usr/share/apport/package-hooks
cp debian/lxc1.apport debian/tmp/usr/share/apport/package-hooks/source_lxc.py
# copy dnsmasq configuration
mkdir -p debian/tmp/etc/dnsmasq.d-available
cp debian/lxc1.dnsmasq debian/tmp/etc/dnsmasq.d-available/lxc
# move the examples
mv debian/tmp/usr/share/doc/lxc debian/tmp/usr/share/doc/lxc-common
# move the bash completion profile
mkdir -p debian/tmp/usr/share/bash-completion/completions
if [ -f debian/tmp/etc/bash_completion.d/lxc ]; then \
mv debian/tmp/etc/bash_completion.d/lxc debian/tmp/usr/share/bash-completion/completions; \
fi
mv debian/tmp/usr/share/bash-completion/completions/lxc debian/tmp/usr/share/bash-completion/completions/lxc1
grep complete debian/tmp/usr/share/bash-completion/completions/lxc1 | sed "s/.* //g" | while read cmd; do \
ln -s lxc1 debian/tmp/usr/share/bash-completion/completions/$${cmd}; \
done
dh_install --fail-missing
# move the tests
mkdir -p debian/lxc-tests/usr/bin
mv debian/lxc1/usr/bin/lxc-test-* debian/lxc-tests/usr/bin/
override_dh_fixperms:
dh_fixperms
chmod u+s debian/lxc-common/usr/lib/${DEB_HOST_MULTIARCH}/lxc/lxc-user-nic
override_dh_builddeb:
# prevent system users from using setuid-root binaries under /var/lib/lxc
chmod 700 debian/lxc1/var/lib/lxc
chmod 700 debian/lxc1/var/cache/lxc
dh_builddeb
override_dh_installinit:
cp debian/lxc1/etc/init/lxc.conf debian/lxc1.upstart
cp debian/lxc1/etc/init/lxc-instance.conf debian/lxc1.lxc-instance.upstart
cp debian/lxc1/etc/init/lxc-net.conf debian/lxc1.lxc-net.upstart
dh_installinit --no-restart-on-upgrade --name=lxc
dh_installinit --no-restart-on-upgrade --name=lxc-net
dh_installinit --no-start --no-restart-on-upgrade --name=lxc-instance
override_dh_gencontrol:
if dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" ge "14.10"; then \
dh_gencontrol -- -V'lxc:Depends=apparmor (>= 2.8.96~2652-0ubuntu1)'; \
elif dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" ge "14.04"; then \
dh_gencontrol -- -V'lxc:Depends=apparmor (>= 2.8.95~2430-0ubuntu4)'; \
elif dpkg --compare-versions "$(shell grep DISTRIB_RELEASE /etc/lsb-release | cut -d= -f2)" ge "13.10"; then \
dh_gencontrol -- -V'lxc:Depends=apparmor (>= 2.8.0-0ubuntu25)'; \
else \
dh_gencontrol -- -V'lxc:Depends=apparmor'; \
fi
override_dh_systemd_start:
dh_systemd_start --no-restart-on-upgrade