File tree Expand file tree Collapse file tree 3 files changed +40
-6
lines changed Expand file tree Collapse file tree 3 files changed +40
-6
lines changed Original file line number Diff line number Diff line change 7
7
# { "builder": {"Entitlements": {"security-insecure": true }} }
8
8
# ```
9
9
# ```
10
- # DOCKER_BUILDKIT=1 docker build --allow security.insecure -t IMAGE_NAME /path/to/pgpm
10
+ # DOCKER_BUILDKIT=1 docker build --allow security.insecure -t IMAGE_NAME .
11
11
# ```
12
12
13
13
# This Dockerfile is used to build a Debian image, which includes pbuilder and
21
21
VOLUME /proc
22
22
ARG DEBIAN_FRONTEND=noninteractive
23
23
RUN apt update
24
- RUN apt install -y build-essential pbuilder fakeroot fakechroot
24
+ RUN apt install -y build-essential pbuilder fakeroot fakechroot vim ripgrep
25
25
RUN echo 'MIRRORSITE=http://deb.debian.org/debian' > /etc/pbuilderrc
26
26
RUN echo 'AUTO_DEBSIGN=${AUTO_DEBSIGN:-no}' > /root/.pbuilderrc
27
27
RUN echo 'HOOKDIR=/var/cache/pbuilder/hooks' >> /root/.pbuilderrc
28
- RUN --security=insecure pbuilder create
28
+ COPY scripts/faketar /usr/bin/
29
+ RUN chmod +x /usr/bin/faketar
30
+ RUN sed -E -i "s/local TAR=tar/local TAR=faketar/" /usr/lib/pbuilder/pbuilder-modules
31
+ RUN sed -E -i "s/if [!] tar -c --use-compress-program/if ! faketar -c --use-compress-program/" /usr/lib/pbuilder/pbuilder-modules
32
+ RUN --security=insecure fakeroot pbuilder create
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ def initialize(spec)
14
14
def build
15
15
prepare_image
16
16
start_container
17
- patch_pbuilder
18
17
19
18
prepare_versioned_source
20
19
generate_deb_src_files ( :versioned )
@@ -127,9 +126,12 @@ def prepare_image
127
126
128
127
def build_local_image
129
128
puts " Building local #{ image_name } ..."
130
- system ( "podman create -it --privileged --tmpfs /tmp --name pgpm-deb-tmp #{ base_image_name } " )
129
+ container_opts = "-it --privileged --tmpfs /tmp --name pgpm-deb-tmp"
130
+ system ( "podman create #{ container_opts } #{ base_image_name } " )
131
131
system ( "podman start pgpm-deb-tmp" )
132
132
133
+ patch_pbuilder
134
+
133
135
# Generate pbuilder_install script.sh, copy it inside the image
134
136
pbuild_install_script_path = "#{ @pgpm_dir } /pbuilder_install_script.sh"
135
137
puts " Generating #{ pbuild_install_script_path } ..."
@@ -194,7 +196,9 @@ def start_container
194
196
# a result.
195
197
def patch_pbuilder
196
198
cmd = "sed -E -i \" s/(^function clean_subdirectories.*$)/\\ 1\\ n return/g\" /usr/lib/pbuilder/pbuilder-modules"
197
- system ( "podman exec #{ @container_name } /bin/bash -c '#{ cmd } '" )
199
+ system ( "podman exec pgpm-deb-tmp /bin/bash -c '#{ cmd } '" )
200
+ cmd = "sed -E -i \" s/if [[] [!] -f [\\ \" ]([$]BASETGZ)/if [ ! -d \\ \" \\ 1/\" /usr/lib/pbuilder/pbuilder-modules"
201
+ system ( "podman exec pgpm-deb-tmp /bin/bash -c '#{ cmd } '" )
198
202
end
199
203
200
204
def run_build ( pkg_type = :versioned )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ ARGS=" $@ "
4
+ echo " faketar ${ARGS[@]} "
5
+
6
+ if [[ " ${ARGS[*]} " =~ [[:space:]]-x[[:space:]] ]]; then # compress
7
+ # Replacing this command:
8
+ # tar -x -p -f "$BASETGZ"
9
+ src=" $4 "
10
+ echo " Copying $src /* to $( pwd) "
11
+ cp -pur $src /* ./
12
+ elif [[ " ${ARGS[*]} " =~ [[:space:]]-c[[:space:]] ]]; then # extract
13
+ # Replacing this command:
14
+ # tar -c --use-compress-program "$COMPRESSPROG" -f "${BASETGZ}.tmp" ./*
15
+ target=" $5 "
16
+ src=" ."
17
+ mkdir $target
18
+ echo " Moving $src /* to $target /"
19
+ mv $src /* $target /
20
+ # Remove existing directory into which we move the contents.
21
+ # Otherwise, pbuilder (when it calls `mv`) will move $target inside it,
22
+ # instead of copying $target/* into it.
23
+ if [[ -d " ${target% " .tmp" } " ]]; then
24
+ rm -rf " ${target% " .tmp" } "
25
+ fi
26
+ fi
You can’t perform that action at this time.
0 commit comments