-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobsigo.sh
executable file
·43 lines (33 loc) · 1.02 KB
/
obsigo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# alias obsigo='/path to where you have the obsigo repo/obsigo/obsigo.sh'
script_path=$(dirname "$(realpath "$0")")
echo "The script is located at: $script_path"
# Display current working directory
echo "Current working directory: $(pwd)"
# Activate python venv
source $script_path/venv/bin/activate
# Run the python script and pass any arguments
python $script_path/obsigo.py "$@"
# Store the exit code
exit_code=$?
# Check if python script failed
if [ $exit_code -ne 0 ]; then
echo "Error: obsigo.py failed with exit code $exit_code"
deactivate # Make sure to deactivate venv before exiting
exit $exit_code
fi
# Deactivate python venv
deactivate
# check if any of the params is '-i' for imagego:
if [[ "$@" == *"-i"* ]]; then
echo
OBSIGO_DEST=$(cat ./obsigo_dest.txt)
echo "Running imagego on $OBSIGO_DEST"
$script_path/imagego.sh "$OBSIGO_DEST"
fi
# check if any of the params is '-lhs'
if [[ "$@" == *"-lhs"* ]]; then
echo
echo "Starting local hugo server..."
./hugo134-3 server
fi