Skip to content

Commit 7c45682

Browse files
authored
btop, tilde: Change file ownership with Docker (#188)
Originally only tested with Podman it was of course writing files as root with Docker which couldn't then be moved/deleted. Add a check for Docker vs Podman to do a chown in the container as last step when needed. ## How to use ## Testing done Tested on Flatcar with Docker and on Fedora with Podman
2 parents 34e4b08 + 5274047 commit 7c45682

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

btop.sysext/create.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function populate_sysext_root() {
2121
local img_arch="$(arch_transform 'x86-64' 'amd64' "$arch")"
2222
img_arch="$(arch_transform 'arm64' 'arm64/v8' "$img_arch")"
2323

24+
local sysextname=btop
2425
docker run --rm \
2526
-i \
2627
-v "${scriptroot}/tools/":/tools \
@@ -29,7 +30,7 @@ function populate_sysext_root() {
2930
--pull always \
3031
--network host \
3132
docker.io/alpine:latest \
32-
sh -c "apk add -U btop bash coreutils grep && cd /install_root && ETCMAP=chroot /tools/flatwrap.sh / btop /usr/bin/btop"
33+
sh -c "apk add -U btop bash coreutils grep && cd /install_root && ETCMAP=chroot /tools/flatwrap.sh / $sysextname /usr/bin/btop && OWNER=\$(stat -c '%u:%g' /install_root) && if [ \"\$OWNER\" != \"\$(id -u):\$(id -g)\" ]; then chown -R \"\$OWNER\" /install_root/$sysextname; fi"
3334
# Alpine has /etc/terminfo instead of /usr/terminfo,
3435
# so above we need to skip mapping the host /etc into the flatwrap env
3536
mv "${sysextroot}"/btop/usr "${sysextroot}"/usr

tilde.sysext/create.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function populate_sysext_root() {
2525
lib_arch="$(arch_transform 'x86-64' 'x86_64' "$lib_arch")"
2626
lib_arch="$(arch_transform 'arm64' 'aarch64' "$lib_arch")"
2727

28+
local sysextname=tilde
2829
docker run --rm \
2930
-i \
3031
-v "${scriptroot}/tools/":/tools \
@@ -33,7 +34,7 @@ function populate_sysext_root() {
3334
--pull always \
3435
--network host \
3536
docker.io/debian:bookworm-slim \
36-
sh -c "apt update && apt install -y tilde patchelf && cd /install_root && /tools/flix.sh / tilde /usr/bin/tilde /usr/lib/${lib_arch}-linux-gnu/transcript1 /usr/lib/${lib_arch}-linux-gnu/libt3widget"
37+
sh -c "apt update && apt install -y tilde patchelf && cd /install_root && /tools/flix.sh / $sysextname /usr/bin/tilde /usr/lib/${lib_arch}-linux-gnu/transcript1 /usr/lib/${lib_arch}-linux-gnu/libt3widget && OWNER=\$(stat -c '%u:%g' /install_root) && if [ \"\$OWNER\" != \"\$(id -u):\$(id -g)\" ]; then chown -R \"\$OWNER\" /install_root/$sysextname; fi"
3738
# We ship /usr/lib/...-linux-gnu/{transcript1,libt3widget} host folders.
3839
# But we assume that the host has /usr/share/terminfo around
3940
# otherwise we would need to add it as last argument above.

0 commit comments

Comments
 (0)