mirror of https://github.com/upx/upx.git
misc: add misc/rebuild-stubs-with-podman files
This commit is contained in:
parent
e87fc60391
commit
ef547034f6
|
@ -0,0 +1,14 @@
|
|||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
||||
|
||||
# create the image from Dockerfile
|
||||
# using a rootless Podman container
|
||||
|
||||
image=upx-stubtools-20210104-v1
|
||||
|
||||
podman build -t "$image" -f "$argv0dir/Dockerfile" "$argv0dir"
|
||||
|
||||
podman image list "$image"
|
||||
podman image tree "$image"
|
|
@ -0,0 +1,35 @@
|
|||
#! /usr/bin/env bash
|
||||
## vim:set ts=4 sw=4 et:
|
||||
set -e; set -o pipefail
|
||||
argv0=$0; argv0abs="$(readlink -fn "$argv0")"; argv0dir="$(dirname "$argv0abs")"
|
||||
|
||||
# run an interactive shell in the image
|
||||
# using a rootless Podman container
|
||||
|
||||
image=upx-stubtools-20210104-v1
|
||||
|
||||
flags=( -ti --read-only --rm )
|
||||
flags+=( --cap-drop=all )
|
||||
flags+=( --network=none )
|
||||
flags+=( --user 2000 )
|
||||
# map container user 0 to 1, and map container user 2000 to current host user
|
||||
flags+=( --uidmap=0:1:1 --uidmap=2000:0:1 )
|
||||
flags+=( -w /home/upx )
|
||||
flags+=( -e TERM="$TERM" )
|
||||
# NOTE: we mount the upx top-level directory read-write under /home/upx/src/upx
|
||||
flags+=( -v "${argv0dir}/../..:/home/upx/src/upx:rw" )
|
||||
|
||||
podman run "${flags[@]}" "$image" bash -l
|
||||
|
||||
# now we can rebuild the UPX stubs:
|
||||
# cd /home/upx/src/upx/src/stub
|
||||
# # make sure that git is clean:
|
||||
# git status .
|
||||
# # remove stub files and make sure that they got deleted:
|
||||
# make clean
|
||||
# git status .
|
||||
# # rebuild
|
||||
# make all
|
||||
# # make sure that the stub files did rebuild correctly:
|
||||
# git status .
|
||||
# git diff .
|
|
@ -0,0 +1,42 @@
|
|||
FROM docker.io/library/ubuntu:22.04
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ENV LANG=C.UTF-8
|
||||
|
||||
# install system packages
|
||||
RUN dpkg --add-architecture i386 \
|
||||
&& apt-get update && apt-get upgrade -y \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
aria2 ca-certificates git less libmpc3 libncurses5 make \
|
||||
ncurses-term perl-base python2-minimal xz-utils \
|
||||
libc6:i386 zlib1g:i386 \
|
||||
&& true
|
||||
|
||||
# manually install compat libs from Ubuntu 16.04
|
||||
RUN cd /root \
|
||||
&& aria2c --checksum=sha-256=2605f43f8047fc972855bb909f1dd7af761bbfd35ae559ad689b0d55a4236d69 \
|
||||
'http://mirror.enzu.com/ubuntu/pool/main/g/gmp/libgmp10_6.1.0+dfsg-2_amd64.deb' \
|
||||
&& aria2c --checksum=sha-256=3973a97387bbe0e8a775995c22861d8478edee2a594e8117970f635de25b2c8a \
|
||||
'http://mirror.enzu.com/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.4-1_amd64.deb' \
|
||||
&& mkdir packages \
|
||||
&& for f in ./*.deb; do dpkg -x $f ./packages; done \
|
||||
&& mv -v -n ./packages/usr/lib/x86_64-linux-gnu/lib* /usr/lib/x86_64-linux-gnu/ \
|
||||
&& rm -rf ./*.deb ./packages \
|
||||
&& ldconfig \
|
||||
&& true
|
||||
|
||||
# install upx-stubtools into /usr/local/bin/bin-upx-20210104
|
||||
RUN cd /root \
|
||||
&& aria2c --checksum=sha-256=abcd8337cc656fe68d7bbb2ffe0f1e5ddce618688aa0e18c1ebcc40072843884 \
|
||||
'https://github.com/upx/upx-stubtools/releases/download/v20210104/bin-upx-20210104.tar.xz' \
|
||||
&& cd /usr/local/bin \
|
||||
&& tar -xJf /root/bin-upx-20210104.tar.xz \
|
||||
&& rm /root/bin-upx-20210104.tar.xz \
|
||||
&& true
|
||||
|
||||
# create default user upx 2000:2000
|
||||
RUN useradd upx -U --uid 2000 --shell /bin/bash -m \
|
||||
&& mkdir -p /home/upx/.local/bin /home/upx/src/upx \
|
||||
&& ln -s /usr/local/bin/bin-upx-20210104 /home/upx/.local/bin/bin-upx \
|
||||
&& chown -R upx:upx /home/upx \
|
||||
&& true
|
||||
USER upx
|
Loading…
Reference in New Issue