add some new options to docker-run for use with CUPs

This commit is contained in:
Michael Becker 2025-03-01 22:49:44 -05:00
parent 1586e460d0
commit 2e44f70931
2 changed files with 39 additions and 1 deletions

View File

@ -26,13 +26,27 @@ done
if [ "$REBUILD" == "true" ]; then
pushd ../mocha-dotnet/mocha-dotnet/src/app/Mocha.Oms.Server
dotnet build
Q=$?
popd
if [ $Q -ne 0 ]; then
echo "Build failed!"
exit $Q
fi
# build the libraries
pushd mocha-common/mocha-common
./build
Q=$?
popd
if [ $Q -ne 0 ]; then
echo "Build failed!"
exit $Q
fi
fi
if [ ! -d ./mocha-suv/docker/fs/usr/lib/mocha/oms ]; then

View File

@ -1,8 +1,9 @@
#!/bin/bash
USE_SSL=false
AUTO_LAUNCH=true
vars=$(getopt -o p:sr --long port:,enable-ssh,rebuild -- "$@")
vars=$(getopt -o p:sr --long 'port:,enable-ssh,rebuild,export-vars' -- "$@")
if [ $? -ne 0 ]; then
echo "usage: docker-run [-r, --rebuild] [-p, --port PORTFORWARD] [-s, --enable-ssh]"
@ -14,6 +15,7 @@ eval set -- "$vars"
PORT_FORWARD=""
ENABLE_SSH=""
BUILD_OPTS=""
EXPORT_VARS=0
for opt; do
@ -30,6 +32,10 @@ for opt; do
BUILD_OPTS+=" --rebuild"
shift
;;
--export-vars)
EXPORT_VARS=1
shift
;;
esac
done
@ -113,4 +119,22 @@ if [ "$ENABLE_SSH" == "true" ]; then
docker container exec $SUV_NAME /usr/lib/mocha/create_suv_users
docker container exec $SUV_NAME service ssh start
docker container exec $SUV_NAME cat /etc/mocha/passwd
fi
if [ $EXPORT_VARS -eq 1 ]; then
export MOCHA_NEW_SUV_NAME=$SUV_NAME
if [ "$ENABLE_SSH" == "true" ]; then
export MOCHA_NEW_SUV_PASSWORD_WEBMASTER=$(docker container exec $SUV_NAME cat /etc/mocha/passwd | grep 'webmaster: ' | sed -e 's/webmaster: //g')
fi
fi
if [ "$AUTO_LAUNCH" == "true" ]; then
xdg-open https://$SUV_NAME$SUV_DOMAINNAME
fi