summaryrefslogtreecommitdiffstats
path: root/build/change-user.sh
diff options
context:
space:
mode:
authorMatin Dehghani <matin@ipecompute4.ands.kit.edu>2022-06-26 01:07:34 +0200
committerMatin Dehghani <matin@ipecompute4.ands.kit.edu>2022-06-26 01:07:34 +0200
commitf33bcbf3c0839c6bebb63141ff3d520b41084183 (patch)
tree6b373e8e123607755940b6ae3cc8076f5977a145 /build/change-user.sh
parentd4f8c2c238342bf3adfa236c49ff43eecd018201 (diff)
downloadccpi-f33bcbf3c0839c6bebb63141ff3d520b41084183.tar.gz
ccpi-f33bcbf3c0839c6bebb63141ff3d520b41084183.tar.bz2
ccpi-f33bcbf3c0839c6bebb63141ff3d520b41084183.tar.xz
ccpi-f33bcbf3c0839c6bebb63141ff3d520b41084183.zip
More fine-grained image management (e.g. allow to get prebuilt images from other user and adapt ids inside with change-user.sh script)
Diffstat (limited to 'build/change-user.sh')
-rw-r--r--build/change-user.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/build/change-user.sh b/build/change-user.sh
new file mode 100644
index 0000000..cb13141
--- /dev/null
+++ b/build/change-user.sh
@@ -0,0 +1,15 @@
+#! /usr/bin/env bash
+
+set -o errexit
+
+image="$1"
+[ -n "$image" ] || image="docker.io/chsa/tomo-remote:evelina"
+
+container=$(buildah from "$image")
+buildah run $container sh -c "echo '$(id -ng):x:$(id -g):' >> /etc/group"
+#buildah run $container sh -c "echo '$(id -nu):x:$(id -u):$(id -g):$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd"
+buildah run $container sh -c "echo '$(id -nu):x:0:0:$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd"
+buildah run $container sh -c "echo '$(id -nu):test' | chpasswd"
+buildah commit --format docker $container tomo-remote:latest
+
+echo "$container build from ${image} and saved as tomo-remote:latest"