Skip to content

Commit

Permalink
Support podman in make dev-tor
Browse files Browse the repository at this point in the history
Unfortunately `podman volume` and `docker volume` are not identical,
podman will (sensibly) error if you try to create a volume that already
exists unless you pass `--ignore`, which docker doesn't support and is
only in podman 4.4+.

So we check with `$DOCKER_BIN inspect` first and only create the volume
if necessary.

And apply the same changes to `make clean` as well.

Co-authored-by: deeplow <[email protected]>
  • Loading branch information
legoktm and deeplow committed Sep 23, 2024
1 parent 139591a commit 58705e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions devops/clean
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
set -e
set -u

USE_PODMAN="${USE_PODMAN:-}"

# Allow opting into using podman with USE_PODMAN=1
if [[ -n "${USE_PODMAN}" ]]; then
DOCKER_BIN="podman"
else
DOCKER_BIN="docker"
fi

function remove_unwanted_files() {

Expand Down Expand Up @@ -37,8 +45,8 @@ function remove_unwanted_files() {
build/*.deb

# Remove any Onion URL from make dev-tor
if docker volume inspect sd-onion-services > /dev/null; then
docker volume remove sd-onion-services
if $DOCKER_BIN volume inspect sd-onion-services > /dev/null; then
$DOCKER_BIN volume remove sd-onion-services
fi

# Remove extraneous copies of the git repos, pulled in
Expand Down
2 changes: 1 addition & 1 deletion securedrop/bin/dev-shell
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function docker_run() {

if [ -n "${USE_TOR:-}" ]; then
# Mount persistent onion services
docker volume create sd-onion-services
$DOCKER_BIN volume inspect sd-onion-services -f " " || $DOCKER_BIN volume create sd-onion-services
DOCKER_RUN_ARGUMENTS="${DOCKER_RUN_ARGUMENTS} --volume sd-onion-services:/var/lib/tor/services"
fi

Expand Down

0 comments on commit 58705e4

Please sign in to comment.