Skip to content

Commit

Permalink
docker_ifexgen: Update wrapper to run "containerized" ifexgen
Browse files Browse the repository at this point in the history
This is a wrapper that the user can invoke instead of ifexgen
to execute the tool in the container installation instead of a local
installation.  The usage should be identical, hopefully.
(It existed before but is now matching the updated container setup)

EDIT: Add similar support for D-Bus generator

Signed-off-by: Gunnar Andersson <gunnar_dev@[email protected]>
  • Loading branch information
Gunnar Andersson authored and gunnarx committed Aug 15, 2023
1 parent 3319990 commit 13e7fdf
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 28 deletions.
41 changes: 41 additions & 0 deletions scripts/docker_ifexgen
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh -e

# SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of IFEX project
# ---------------------------------------------------------------------------

IMAGE_NAME=ifex_local/ifex_alpine
CTR_NAME=ifex-docker

# Normalize directory location
cd "$(dirname "$0")" # (the directory this script is in)
cd ..

command="$(basename "$0")"
case $command in
docker_ifexgen)
runcmd=ifexgen ;;
docker_ifexgen_dbus)
runcmd=ifexgen_dbus ;;
*)
echo FAIL && exit 1 ;;
esac

if ! docker images | grep -F -q "$IMAGE_NAME"; then
echo Image never built from Dockerfile -- building...
cd docker && make build
fi

if docker ps -a | grep -F -q "$CTR_NAME"; then
echo Removing old container $CTR_NAME
docker rm "$CTR_NAME"
fi

# SELINUX required flag
fgrep -Fq redhat /etc/os-release && ZFLAG=:z || ZFLAG=

set -x
docker run --rm -ti -v $PWD:/work${ZFLAG} --name "$CTR_NAME" "$IMAGE_NAME" /ifex/venv/bin/$runcmd "$@"

28 changes: 0 additions & 28 deletions scripts/docker_ifexgen.sh

This file was deleted.

1 change: 1 addition & 0 deletions scripts/docker_ifexgen_dbus

0 comments on commit 13e7fdf

Please sign in to comment.