Skip to content

Commit d5efb92

Browse files
committed
Fixing the setup and run procedure
1 parent 4058506 commit d5efb92

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

install.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

run.sh

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
#! /usr/bin/env bash
2-
which deactivate
3-
rv=$?
4-
if [ $rv -eq 0 ]; then
5-
echo "venv already sourced"
1+
#!/bin/sh
2+
function usage() {
3+
echo "Usage: ./run.sh [virtual-env-directory]"
4+
echo
5+
}
6+
function error() {
7+
echo "Something went wrong when sourcing the venv. Please check your venv directory and ensure j2dx is installed correctly."
8+
usage
9+
exit 1
10+
}
11+
12+
type -t j2dx >/dev/null 2>&1
13+
if [ $? -eq 0 ]; then
14+
echo "j2dx found! running instance"
615
else
7-
source ../bin/activate
16+
if [ "$#" -eq 1 ]; then
17+
source $1/bin/activate || error
18+
19+
type -t j2dx >/dev/null 2>&1 || error
20+
21+
elif [ "$#" -eq 0 ]; then
22+
echo "Sourcing default directory from ../bin/activate"
23+
source ../bin/activate
24+
else
25+
usage
26+
exit 1
27+
fi
828
fi
929

10-
j2dx & python3 -m http.server && kill $! && deactivate
30+
j2dx & python3 -m http.server && kill $!

0 commit comments

Comments
 (0)