Skip to content

Commit

Permalink
Add option to update DockerC (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiboux authored Jun 19, 2023
1 parent 2e7638c commit bd4b2ce
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions dockerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ VERSION="1.3.3"
# Default options
PRINT_HELP=false
PRINT_VERSION=false
UPDATE=false
DRY_RUN=false
QUIET=false

Expand All @@ -37,6 +38,11 @@ while true; do
PRINT_VERSION=true
shift
;;
--update)
# Update DockerC and exit
UPDATE=true
shift
;;
-n)
# Dry run, print docker compose command without running it
DRY_RUN=true
Expand Down Expand Up @@ -65,6 +71,7 @@ if [ "$PRINT_HELP" = true ]; then
echo " options:"
echo " -h, --help Print this help and exit"
echo " -v, --version Print version and exit"
echo " --update Update DockerC and exit"
echo " -n Dry run, print docker compose command without running it"
echo " -q Quiet, do not print docker compose command"
exit 0
Expand All @@ -91,6 +98,26 @@ if [ "$PRINT_VERSION" = true ]; then
exit 0
fi

if [ "$UPDATE" = true ]; then
# Update DockerC and exit
INSTALL_DIR=$(dirname "$0")

if [ ! -d "$INSTALL_DIR" ]; then
echo "Error: Install directory does not exist."
exit 1
fi

if [ "$DRY_RUN" = false ]; then
echo "Updating DockerC..."
exec /bin/sh -c "curl -fsSL https://raw.githubusercontent.com/matiboux/dockerc/HEAD/install.sh | /bin/sh -s -- $INSTALL_DIR"
else
echo "Updating DockerC (dry run):"
echo "> curl -fsSL https://raw.githubusercontent.com/matiboux/dockerc/HEAD/install.sh | /bin/sh -s -- $INSTALL_DIR"
fi

exit 0
fi

if [ $# -gt 0 ]; then
# Get context from first parameter and shift
CONTEXT="$1"
Expand Down

0 comments on commit bd4b2ce

Please sign in to comment.