Skip to content

Commit bb5c741

Browse files
authored
Add support for PBS v3.2.7 (#52)
* Add support for PBS v3.2.7 * fix: paths must not contain interior null bytes
1 parent 99ffabc commit bb5c741

20 files changed

+505
-6
lines changed

PROCESS.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
```bash
66
# Fork the build
7-
make fork-version NEW_VERSION=2.3.2 NEW_SHA=e6120a8f6ff36f627a4da3a1a51a1e47231f5cc8
7+
make fork-version NEW_VERSION=3.2.7 NEW_SHA=cb3d41e838dec0e1002aaf5ee4c0e6cd28284c74
88

99
# Try to naively apply patches
1010
# Fix patches until it succeeds
1111
make tmp-env
1212
make tmp-env-client
1313

1414
# Try to naively compile first
15-
cd tmp/v2.3.2/proxmox-backup
15+
cd tmp/v3.2.7/proxmox-backup
1616
cargo build
1717

1818
# Try to run dev build first
@@ -31,7 +31,7 @@ make github-latest-release
3131

3232
## Build on your own
3333

34-
Refer to [PROESS.md](PROCESS.md).
34+
Refer to [PROCESS.md](PROCESS.md).
3535

3636
```bash
3737
make dev-build
@@ -54,4 +54,4 @@ make dev-run
5454
```
5555

5656
You might as well pull the `*.deb` from within the image
57-
and install on Debian Bullseye.
57+
and install on Debian Bookworm.

scripts/strip-cargo.bash

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ for package in *; do
88
while read cargo_config; do
99
echo -n > "$cargo_config"
1010
git -C "$package" add "$(realpath "$cargo_config")"
11-
done < <(find "$package" -wholename '*/.cargo/config')
11+
done < <(find "$package" -wholename '*/.cargo/config' -o -wholename '*/.cargo/config.toml')
1212

1313
while read cargo_config; do
1414
echo -n > "$cargo_config"
1515
git -C "$package" add "$(realpath "$cargo_config")"
16-
done < <(find "$package" -wholename '*/debian/cargo_home/config')
16+
done < <(find "$package" -wholename '*/debian/cargo_home/config' -o -wholename '*/debian/cargo_home/config.toml')
1717

1818
while read debian_control; do
1919
echo "Stripping '$debian_control'..."

versions/v3.2.7/Dockerfile

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
ARG ARCH=
2+
FROM ${ARCH}debian:bookworm AS toolchain
3+
4+
RUN apt-get -y update && \
5+
apt-get -y install \
6+
build-essential git-core \
7+
lintian pkg-config quilt patch cargo \
8+
nodejs node-colors node-commander \
9+
libudev-dev libapt-pkg-dev \
10+
libacl1-dev libpam0g-dev libfuse3-dev \
11+
libsystemd-dev uuid-dev libssl-dev \
12+
libclang-dev libjson-perl libcurl4-openssl-dev \
13+
dh-exec dh-nodejs wget
14+
15+
RUN wget https://static.rust-lang.org/rustup/rustup-init.sh && \
16+
chmod +x rustup-init.sh && \
17+
./rustup-init.sh -y --default-toolchain stable
18+
19+
ENV RUSTUP_TOOLCHAIN=stable
20+
21+
WORKDIR /src
22+
23+
RUN for tool in /root/.cargo/bin/*; do ln -vsf $tool /usr/bin/; done
24+
RUN /usr/bin/rustc --version
25+
RUN git config --global user.email "[email protected]" && \
26+
git config --global user.name "Docker Compile"
27+
28+
FROM toolchain as builder
29+
30+
# Clone all sources
31+
ARG VERSION=master
32+
ADD /versions/${VERSION}/ /patches/
33+
RUN /patches/clone.bash
34+
35+
# Apply all patches
36+
ADD /scripts/ /scripts/
37+
RUN /scripts/apply-patches.bash /patches/server/*.patch
38+
RUN /scripts/strip-cargo.bash
39+
RUN /scripts/resolve-dependencies.bash
40+
41+
# A first required dep
42+
RUN apt-get -y build-dep $PWD/pve-eslint
43+
RUN cd pve-eslint/ && make dinstall
44+
45+
# A proxmox-perl-rs required deps
46+
RUN apt-get -y build-dep $PWD/perlmod/perlmod $PWD/perlmod/perlmod-bin $PWD/perlmod/perlmod-macro
47+
RUN cd perlmod/perlmod-bin && dpkg-buildpackage -us -uc -b && dpkg -i ../perlmod-bin*.deb
48+
49+
# A pve-common required deps
50+
RUN apt-get -y build-dep $PWD/proxmox-perl-rs/pve-rs
51+
RUN cd proxmox-perl-rs/pve-rs && make dinstall
52+
RUN cd proxmox-perl-rs/common/pkg && make deb && dpkg -i *.deb
53+
RUN apt-get -y build-dep $PWD/pve-common
54+
RUN cd pve-common/ && ( make dinstall || apt-get -f -y install && make dinstall )
55+
56+
# Install dev dependencies of widget toolkit
57+
RUN apt-get -y build-dep $PWD/proxmox-widget-toolkit
58+
RUN cd proxmox-widget-toolkit/ && make deb && dpkg -i proxmox-widget-toolkit-dev*.deb
59+
60+
# Deps for all rest
61+
RUN apt-get -y build-dep $PWD/proxmox-acme
62+
RUN apt-get -y build-dep $PWD/proxmox-backup
63+
RUN apt-get -y build-dep $PWD/proxmox-mini-journalreader
64+
RUN apt-get -y build-dep $PWD/extjs
65+
RUN apt-get -y build-dep $PWD/proxmox-i18n
66+
RUN apt-get -y build-dep $PWD/pve-xtermjs/termproxy
67+
RUN apt-get -y build-dep $PWD/pve-xtermjs/xterm.js
68+
RUN apt-get -y build-dep $PWD/libjs-qrcodejs
69+
70+
# Compile ALL
71+
RUN cd proxmox-backup/ && make deb
72+
RUN cd extjs/ && make deb
73+
RUN cd proxmox-i18n/ && make deb
74+
RUN cd pve-xtermjs/termproxy/ && make deb
75+
RUN cd pve-xtermjs/xterm.js/ && make deb
76+
RUN cd proxmox-mini-journalreader/ && make deb
77+
RUN cd libjs-qrcodejs/ && make deb
78+
RUN cd proxmox-acme/ && make deb
79+
80+
# Copy all debian packages
81+
RUN mkdir -p /deb && \
82+
find /src/ -name '*.deb' -exec cp -av {} /deb/ \;
83+
84+
#=================================
85+
86+
FROM ${ARCH}debian:bookworm
87+
COPY --from=builder /deb/ /deb/
88+
89+
# Install all packages
90+
RUN export DEBIAN_FRONTEND=noninteractive && \
91+
apt-get -y update && \
92+
apt install -y runit ssmtp /deb/*.deb
93+
94+
# Add default configs
95+
ADD /pbs/ /etc/proxmox-backup-default/
96+
97+
VOLUME /etc/proxmox-backup
98+
VOLUME /var/log/proxmox-backup
99+
VOLUME /var/lib/proxmox-backup
100+
101+
ADD runit/ /runit/
102+
CMD ["runsvdir", "/runit"]

versions/v3.2.7/Dockerfile.client

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
ARG DOCKER_ARCH
2+
FROM ${DOCKER_ARCH}/debian:bookworm AS builder
3+
4+
RUN apt-get -y update && \
5+
apt-get -y install \
6+
build-essential git-core \
7+
lintian pkg-config quilt patch cargo \
8+
nodejs node-colors node-commander \
9+
libudev-dev libapt-pkg-dev \
10+
libacl1-dev libpam0g-dev libfuse3-dev \
11+
libsystemd-dev uuid-dev libssl-dev \
12+
libclang-dev libjson-perl libcurl4-openssl-dev \
13+
dh-exec wget
14+
15+
WORKDIR /src
16+
17+
RUN /usr/bin/rustc --version
18+
RUN git config --global user.email "[email protected]" && \
19+
git config --global user.name "Docker Compile"
20+
21+
# Clone all sources
22+
ARG VERSION=master
23+
ADD /versions/${VERSION}/ /patches/
24+
RUN /patches/clone.bash
25+
26+
# Install valid rust toolchain
27+
ARG DOCKER_ARCH
28+
RUN \
29+
if [ "${DOCKER_ARCH}" != "arm32v7" ]; then \
30+
wget https://static.rust-lang.org/rustup/rustup-init.sh && \
31+
chmod +x rustup-init.sh && \
32+
./rustup-init.sh -y --default-toolchain nightly && \
33+
for tool in /root/.cargo/bin/*; do ln -vsf $tool /usr/bin/; done; \
34+
fi
35+
36+
# Apply all patches
37+
ADD /scripts/ /scripts/
38+
RUN /scripts/apply-patches.bash /patches/server/*.patch /patches/client/*.patch /patches/client-${DOCKER_ARCH}/*.patch
39+
RUN /scripts/strip-cargo.bash
40+
RUN /scripts/experimental-cargo.bash
41+
RUN /scripts/resolve-dependencies.bash
42+
43+
# Build
44+
RUN \
45+
. /root/.cargo/env; \
46+
cargo build --manifest-path proxmox-backup/proxmox-backup-client/Cargo.toml --release && \
47+
cargo build --manifest-path proxmox-backup/pxar-bin/Cargo.toml --release
48+
49+
# Bundle client
50+
RUN /scripts/bundle-client.bash

versions/v3.2.7/clone.bash

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
5+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
7+
if [[ "$1" == "show-sha" ]]; then
8+
VERSION="${2:-master}"
9+
VERSION_DATE=""
10+
11+
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
12+
cd "$tmp_dir/"
13+
trap 'cd ; rm -rf $tmp_dir' EXIT
14+
15+
perform() {
16+
git clone "git://git.proxmox.com/git/$1.git" 2>/dev/null
17+
if [[ -z "$VERSION_TIMESTAMP" ]]; then
18+
REVISION=$(git -C "$1" rev-parse "$VERSION")
19+
VERSION_TIMESTAMP=$(git -C "$1" log -1 --format=%ct "$VERSION")
20+
else
21+
while read TIMESTAMP REVISION; do
22+
if [[ $TIMESTAMP -le $VERSION_TIMESTAMP ]]; then
23+
break
24+
fi
25+
done < <(git -C "$1" log --format="%ct %H")
26+
fi
27+
28+
CHANGE_TIME=$(git -C "$1" log -1 --format="%cd" $REVISION)
29+
30+
echo "$1 $REVISION # $CHANGE_TIME"
31+
}
32+
else
33+
if [[ -n "$1" ]]; then
34+
cd "$1"
35+
fi
36+
37+
perform() {
38+
if [[ ! -d "$1" ]]; then
39+
git clone "git://git.proxmox.com/git/$1.git"
40+
else
41+
git -C "$1" fetch
42+
fi
43+
git -C "$1" checkout "$2" -f
44+
git -C "$1" clean -fdx
45+
}
46+
fi
47+
48+
if [[ ! -e "$SCRIPT_DIR/versions" ]]; then
49+
echo "Missing 'versions' file."
50+
exit 1
51+
fi
52+
53+
while read REPO COMMIT_SHA REST; do
54+
echo "$REPO $COMMIT_SHA..." 1>&2
55+
perform "$REPO" "$COMMIT_SHA"
56+
done < "$SCRIPT_DIR/versions"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/Makefile b/Makefile
2+
index dfbaacab..d7620d73 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -42,6 +42,7 @@ COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
6+
else
7+
COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/debug
8+
endif
9+
+CARGO_BUILD_ARGS += --target-dir target/$(DEB_HOST_RUST_TYPE)
10+
11+
ifeq ($(valgrind), yes)
12+
CARGO_BUILD_ARGS += --features valgrind
13+
diff --git a/debian/rules b/debian/rules
14+
index fa94743d..675fd445 100755
15+
--- a/debian/rules
16+
+++ b/debian/rules
17+
@@ -9,7 +9,7 @@ include /usr/share/rustc/architecture.mk
18+
19+
export BUILD_MODE=release
20+
21+
-export CARGO=/usr/share/cargo/bin/cargo
22+
+export CARGO=/usr/bin/cargo
23+
24+
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
25+
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js
2+
index 9d741e45..5196f64b 100644
3+
--- a/www/panel/NodeInfo.js
4+
+++ b/www/panel/NodeInfo.js
5+
@@ -150,7 +150,7 @@ Ext.define('PBS.NodeInfoPanel', {
6+
return data.kversion;
7+
}
8+
let kernel = data['current-kernel'];
9+
- let buildDate = kernel.version.match(/\((.+)\)\s*$/)?.[1] ?? 'unknown';
10+
+ let buildDate = kernel.version;
11+
return `${kernel.sysname} ${kernel.release} (${buildDate})`;
12+
},
13+
value: '',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
2+
index a5ea390f..2853fe10 100644
3+
--- a/www/NavigationTree.js
4+
+++ b/www/NavigationTree.js
5+
@@ -89,12 +89,6 @@ Ext.define('PBS.store.NavigationStore', {
6+
expanded: true,
7+
leaf: false,
8+
children: [
9+
- {
10+
- text: gettext('Shell'),
11+
- iconCls: 'fa fa-terminal',
12+
- path: 'pbsXtermJsConsole',
13+
- leaf: true,
14+
- },
15+
{
16+
text: gettext('Storage / Disks'),
17+
iconCls: 'fa fa-hdd-o',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
diff --git a/debian/proxmox-backup-file-restore.install b/debian/proxmox-backup-file-restore.install
2+
old mode 100644
3+
new mode 100755
4+
index 409988a3..8b4034bd
5+
--- a/debian/proxmox-backup-file-restore.install
6+
+++ b/debian/proxmox-backup-file-restore.install
7+
@@ -1,4 +1,5 @@
8+
+#! /usr/bin/dh-exec
9+
usr/bin/proxmox-file-restore
10+
-usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore/proxmox-restore-daemon
11+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/file-restore/proxmox-restore-daemon
12+
usr/share/man/man1/proxmox-file-restore.1
13+
usr/share/zsh/vendor-completions/_proxmox-file-restore
14+
diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install
15+
old mode 100644
16+
new mode 100755
17+
index ef1e9ba1..29b6b234
18+
--- a/debian/proxmox-backup-server.install
19+
+++ b/debian/proxmox-backup-server.install
20+
@@ -1,3 +1,4 @@
21+
+#! /usr/bin/dh-exec
22+
etc/pbs-enterprise.list /etc/apt/sources.list.d/
23+
etc/proxmox-backup-banner.service /lib/systemd/system/
24+
etc/proxmox-backup-daily-update.service /lib/systemd/system/
25+
@@ -7,11 +8,11 @@ etc/proxmox-backup.service /lib/systemd/system/
26+
usr/bin/pmt
27+
usr/bin/pmtx
28+
usr/bin/proxmox-tape
29+
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api
30+
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner
31+
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy
32+
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update
33+
-usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd
34+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-api
35+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-banner
36+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-proxy
37+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-daily-update
38+
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/sg-tape-cmd
39+
usr/sbin/pbs2to3
40+
usr/sbin/proxmox-backup-debug
41+
usr/sbin/proxmox-backup-manager
42+
diff --git a/debian/rules b/debian/rules
43+
index a82c3e12..92fd6e90 100755
44+
--- a/debian/rules
45+
+++ b/debian/rules
46+
@@ -2,6 +2,7 @@
47+
# See debhelper(7) (uncomment to enable)
48+
# output every command that modifies files on the build system.
49+
DH_VERBOSE = 1
50+
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
51+
52+
include /usr/share/dpkg/pkg-info.mk
53+
include /usr/share/rustc/architecture.mk
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/debian/rules b/debian/rules
2+
index 92fd6e90..fa94743d 100755
3+
--- a/debian/rules
4+
+++ b/debian/rules
5+
@@ -28,7 +28,7 @@ endif
6+
override_dh_auto_configure:
7+
@perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
8+
die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
9+
- $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
10+
+ #$(CARGO) prepare-debian --help $(CURDIR)/debian/cargo_registry --link-from-system
11+
dh_auto_configure
12+
13+
override_dh_auto_build:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/Makefile b/src/Makefile
2+
index 449004f..eeee305 100644
3+
--- a/src/Makefile
4+
+++ b/src/Makefile
5+
@@ -5,7 +5,7 @@ BIN_DIR ?= $(DESTDIR)/usr/bin
6+
MAN1_DIR ?= $(DESTDIR)/usr/share/man/man1
7+
8+
LIBS := libsystemd
9+
-CFLAGS += -Werror -Wall -Wextra -Wl,-z,relro -g -O2 --std=gnu11
10+
+CFLAGS += -Wall -Wextra -Wl,-z,relro -g -O2 --std=gnu11
11+
CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=2
12+
CFLAGS += $(shell pkg-config --cflags $(LIBS))
13+
LDFLAGS += $(shell pkg-config --libs $(LIBS))

0 commit comments

Comments
 (0)