Skip to content

Commit

Permalink
remove shopt&alias to make it work on powershell
Browse files Browse the repository at this point in the history
syntax:  bash geopython-workshop-ctl.sh start
  • Loading branch information
Genuchten committed Jun 21, 2023
1 parent 1f1a37b commit fa0fc91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Docker-Volume-mounted. There is no need to build the Docker Image yourself (see

All services are started using a [Docker Compose file](https://github.com/geopython/geopython-workshop/blob/master/workshop/docker-compose.yml).

Windows users; use [powershell](https://en.wikipedia.org/wiki/PowerShell) or [Linux Subsystem](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) to run below commands.
Windows users; use [powershell](https://en.wikipedia.org/wiki/PowerShell) or [Linux Subsystem](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux) to run below commands. On powershell call the shell script by prepending `bash`, eg. `bash ./geopython-workshop-ctl.sh start`.

```bash
cd workshop
Expand Down
26 changes: 3 additions & 23 deletions workshop/geopython-workshop-ctl.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

shopt -s expand_aliases

PROGRAM_NAME=$(basename $0)

USAGE="Usage: $PROGRAM_NAME <start|stop|url|update|clean>"
Expand All @@ -11,31 +9,13 @@ if [ "$#" -ne 1 ]; then
exit 1
fi

# Sniff which Docker Compose variant is installed
# and set an alias.
# See https://github.com/geopython/geopython-workshop/issues/82
if command docker-compose --version &> /dev/null
then
alias dockercompose='docker-compose'
echo "Using docker-compose"
else
if !command docker compose version &> /dev/null
then
echo "Neither docker-compose nor docker compose is available"
echo "Check your Docker Installation"
exit 1
fi
alias dockercompose='docker compose'
echo "Using docker compose"
fi

# Test for the command
if [ $1 == "start" ]; then
$0 stop
dockercompose up -d
docker compose up -d
elif [ $1 == "stop" ]; then
dockercompose stop
dockercompose rm --force
docker compose stop
docker compose rm --force
elif [ $1 == "url" ]; then
# try to open the Jupyter Notebook in Browser
platform="$(uname | tr '[:upper:]' '[:lower:]')"
Expand Down

0 comments on commit fa0fc91

Please sign in to comment.