forked from QubesOS/qubes-builder-debian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-legacy.debian
69 lines (60 loc) · 3.08 KB
/
Makefile-legacy.debian
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
# This file is included from Makefile.debian if USE_DIST_BUILD_TOOLS is not set
dist-prepare-chroot: $(CHROOT_DIR)/home/user/.prepared_base
# Make sure repo directory exists
${Q}if ! [ -d "$(BUILDER_REPO_DIR)/dists" ]; then\
mkdir -p "$(BUILDER_REPO_DIR)/dists";\
fi
${Q}if [ $(VERBOSE) -gt 0 ]; then \
echo "-> dist-prepare-chroot for $(DIST)"; \
echo "-> sudo mount --bind $(BUILDER_REPO_DIR) $(CHROOT_DIR)/tmp/qubes-deb;"; \
fi
${Q}if [ ! -r $(CHROOT_DIR)/proc/cpuinfo ]; then\
sudo mount -t proc proc $(CHROOT_DIR)/proc;\
fi
${Q}if ! [ -d $(CHROOT_DIR)/tmp/qubes-deb/deb ]; then\
mkdir -p $(CHROOT_DIR)/tmp/qubes-deb;\
sudo mount --bind $(BUILDER_REPO_DIR) $(CHROOT_DIR)/tmp/qubes-deb;\
fi
${Q}if [ "$(shell stat -f -c '%T' ${CHROOT_DIR}/dev/shm 2>/dev/null)" != tmpfs ]; then\
sudo mkdir -p "$(CHROOT_DIR)/dev/shm";\
sudo mount -t tmpfs shm "$(CHROOT_DIR)/dev/shm";\
sudo chmod 1777 "$(CHROOT_DIR)/dev/shm";\
fi
${Q}sudo cp -f /etc/resolv.conf $(CHROOT_DIR)/etc/resolv.conf
$(CHROOT_DIR)/home/user/.prepared_base: $(DEBIAN_PLUGIN_DIR)/prepare-chroot-$(DISTRIBUTION)
@echo "-> Preparing $(DIST) build environment"
${Q}sudo -E $(DEBIAN_PLUGIN_DIR)/prepare-chroot-$(DISTRIBUTION) $(CHROOT_DIR) $(DIST)
${Q}touch $(CHROOT_DIR)/home/user/.prepared_base
dist-prep: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog)
dist-prep:
${Q}rm -f "$(CHROOT_DIR)/$(DIST_SRC)/../$(release_name)"*
dist-build-dep:
${Q}if ! [ -d "$(BUILDER_REPO_DIR)/dists" ]; then\
mkdir -p "$(BUILDER_REPO_DIR)/dists";\
fi
$(DEBIAN_PLUGIN_DIR)/update-local-repo.sh $(DIST)
sudo chroot $(CHROOT_DIR) apt-get ${APT_GET_OPTIONS} update
# check for CVE-2016-1252 - directly after debootstrap, still vulnerable
# apt is installed
wc -L "$(CHROOT_DIR)/var/lib/apt/lists/"*InRelease | awk '$$1 > 1024 {print; exit 1}'
# update the base system inside
sudo chroot $(CHROOT_DIR) apt-get $(APT_GET_OPTIONS) dist-upgrade -y
# install build dependencies
LC_ALL=C sudo chroot $(CHROOT_DIR) mk-build-deps -i -r -t "apt-get --no-install-recommends -y" $(DIST_SRC_DEBIAN_DIR)/control
ifneq (,$(DEBIAN_BUILD_DIRS))
dist-package: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(ORIG_SRC)/$(DEBIAN_BUILD_DIRS)/changelog)
endif
dist-package: debian-prepare-dist-src
sudo $(CHROOT_ENV) chroot $(CHROOT_DIR) su $(RUN_AS_USER) -c 'cd $(DIST_SRC_DEBIAN_DIR)/..; export LC_ALL=C; dpkg-buildpackage -sa -uc -us'
ifneq (,$(DEBIAN_BUILD_DIRS))
dist-copy-out: release_name = $(shell $(DEBIAN_PARSER) changelog --package-release-name $(CHROOT_DEBIAN_DIR)/changelog)
endif
dist-copy-out:
mkdir -p $(BUILDER_REPO_DIR)/deb
mkdir -p $(ORIG_SRC)/$(OUTPUT_DIR)
cd $(CHROOT_DEBIAN_DIR)/../..; \
cp -t $(BUILDER_REPO_DIR)/deb `$(listfiles) $(release_name)*.changes`
cp -t $(BUILDER_REPO_DIR)/deb/ $(CHROOT_DEBIAN_DIR)/../../$(release_name)*.changes
cd $(CHROOT_DEBIAN_DIR)/../..; \
mv -t $(PWD)/$(ORIG_SRC)/$(OUTPUT_DIR) `$(listfiles) $(release_name)*.changes`
mv -t $(PWD)/$(ORIG_SRC)/$(OUTPUT_DIR) $(CHROOT_DEBIAN_DIR)/../../$(release_name)*.changes