summaryrefslogtreecommitdiff
path: root/run.sh
diff options
context:
space:
mode:
authorEdward <ed@itsed.com>2021-08-19 09:45:07 -0400
committerEdward <ed@itsed.com>2021-08-19 09:45:07 -0400
commit092c1ec1d91728c3292011f060c2fe5a163998df (patch)
treec821a00cc5337110aa4af47649c714c5cd50668a /run.sh
parent9da33c963556a1f84c6ed3e4375f78507ebe8bf6 (diff)
added a 'build' command
also removed check for a command argument; just let an empty command fall through to the default case
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/run.sh b/run.sh
index 998e81d..2e07595 100755
--- a/run.sh
+++ b/run.sh
@@ -11,7 +11,9 @@ IMAGE_TAG="dactyl-keyboard"
REBUILD=false;
# get the command the user would like to run
-COMMAND=${1:?A command is required. Try \'run help\'}
+COMMAND=${1}
+
+
case $COMMAND in
help)
@@ -20,6 +22,7 @@ case $COMMAND in
echo ""
echo "Available Commands:"
echo " help show this help"
+ echo " build rebuild the docker image"
echo " generate output the keyboard files to the 'things' directory"
echo " configure "
echo " release "
@@ -29,6 +32,10 @@ case $COMMAND in
echo " -i the tag that should be applied to the docker image"
exit 0
;;
+ build)
+ docker build -t ${IMAGE_TAG} -f docker/Dockerfile .
+ exit 0
+ ;;
generate)
SCRIPT=dactyl_manuform.py
;;
@@ -43,8 +50,6 @@ case $COMMAND in
exit 1
esac
-
-
# check for command line flags
while getopts 'ri:' flag; do
case "${flag}" in
@@ -53,6 +58,8 @@ while getopts 'ri:' flag; do
esac
done
+
+
# get the image ID, and save the return code so we'll know if the image exists
IMAGE_ID=$(docker inspect --type=image --format={{.Id}} ${IMAGE_TAG})
INSPECT_RETURN_CODE=$?
@@ -64,12 +71,9 @@ fi
-
# run the command in a temporary container
docker run --name dm-run -d --rm -v "`pwd`/src:/app/src" -v "`pwd`/things:/app/things" ${IMAGE_TAG} python3 -i $SCRIPT > /dev/null 2>&1
-
-
# show progress indicator while until dm-run container completes
while $(docker inspect --format={{.Id}} dm-run > /dev/null 2>&1); do
echo -n "."