mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-25 20:33:35 +00:00
Skip git steps in shell scripts if not a valid git repo (#524)
* Skip git steps if no .git dir exists * Tweak message * Check for git repo in start.sh * Fix logic & cleanup * Make a different check for git repo * Make a different check for git repo * Make a different check for git repo
This commit is contained in:
parent
47282c43b9
commit
5817ca6df5
@ -222,6 +222,15 @@ function stopOldWebInterface() {
|
||||
# Checks for upstream changes to the git repo and fast-forwards changes if needed
|
||||
function updateRaScsiGit() {
|
||||
cd "$BASE" || exit 1
|
||||
|
||||
set +e
|
||||
git rev-parse --is-inside-work-tree &> /dev/null
|
||||
if [[ $? -ge 1 ]]; then
|
||||
echo "Warning: This does not seem to be a valid clone of a git repository. I will not be able to pull the latest code."
|
||||
return 0
|
||||
fi
|
||||
set -e
|
||||
|
||||
stashed=0
|
||||
if [[ $(git diff --stat) != '' ]]; then
|
||||
echo "There are local changes to the RaSCSI code; we will stash and reapply them."
|
||||
|
@ -77,28 +77,34 @@ fi
|
||||
|
||||
# Create the venv if it doesn't exist
|
||||
if ! test -e venv; then
|
||||
echo "Creating python venv for OLED Screen"
|
||||
python3 -m venv venv
|
||||
echo "Activating venv"
|
||||
source venv/bin/activate
|
||||
echo "Installing requirements.txt"
|
||||
pip3 install wheel
|
||||
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
echo "Creating python venv for OLED Screen"
|
||||
python3 -m venv venv
|
||||
echo "Activating venv"
|
||||
source venv/bin/activate
|
||||
echo "Installing requirements.txt"
|
||||
pip3 install wheel
|
||||
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
|
||||
source venv/bin/activate
|
||||
|
||||
# Detect if someone updates - we need to re-run pip3 install.
|
||||
if ! test -e current; then
|
||||
git rev-parse > current
|
||||
# Detect if someone updates the git repo - we need to re-run pip3 install.
|
||||
set +e
|
||||
git rev-parse --is-inside-work-tree &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
set -e
|
||||
if ! test -e current; then
|
||||
git rev-parse > current
|
||||
elif [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
||||
echo "New version detected, updating libraries from requirements.txt"
|
||||
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
else
|
||||
if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
||||
echo "New version detected, updating requirements.txt"
|
||||
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
echo "Warning: Not running from a valid git repository. Will not be able to update the code."
|
||||
fi
|
||||
set -e
|
||||
|
||||
# parse arguments
|
||||
while [ "$1" != "" ]; do
|
||||
|
@ -57,16 +57,22 @@ fi
|
||||
|
||||
source venv/bin/activate
|
||||
|
||||
# Detect if someone updates - we need to re-run pip3 install.
|
||||
if ! test -e current; then
|
||||
git rev-parse > current
|
||||
else
|
||||
if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
||||
echo "New version detected, updating requirements.txt"
|
||||
# Detect if someone updates the git repo - we need to re-run pip3 install.
|
||||
set +e
|
||||
git rev-parse --is-inside-work-tree &> /dev/null
|
||||
if [[ $? -eq 0 ]]; then
|
||||
set -e
|
||||
if ! test -e current; then
|
||||
git rev-parse > current
|
||||
elif [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
|
||||
echo "New version detected, updating libraries from requirements.txt"
|
||||
pip3 install -r requirements.txt
|
||||
git rev-parse HEAD > current
|
||||
fi
|
||||
else
|
||||
echo "Warning: Not running from a valid git repository. Will not be able to update the code."
|
||||
fi
|
||||
set -e
|
||||
|
||||
# parse arguments
|
||||
while [ "$1" != "" ]; do
|
||||
|
Loading…
Reference in New Issue
Block a user