diff --git a/compile.sh b/compile.sh index 3ab3fc9111177c42fb1612b52d3f4d761d92085e..dc9140f965b049e6f595d1f0bca62b50d32f8a47 100755 --- a/compile.sh +++ b/compile.sh @@ -63,12 +63,16 @@ function compile { exit 2 esac fi - - COMMIT=$(git rev-parse --short HEAD) # Find and insert current commit - if [[ "$usehash" ]]; then - file="bin/FC_pregmod_${COMMIT}.html" + + if [[ -d .git ]]; then + COMMIT=$(git rev-parse --short HEAD) # Find and insert current commit + if [[ "$usehash" ]]; then + file="bin/FC_pregmod_${COMMIT}.html" + else + sed -Ei "s/build: .releaseID/\0, commit: $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw + file="bin/FC_pregmod.html" + fi else - sed -Ei "s/build: .releaseID/\0, commit: $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw file="bin/FC_pregmod.html" fi @@ -81,7 +85,9 @@ function compile { #Make the output prettier, replacing \t with a tab and \n with a newline sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' $file - git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw # Revert AlphaDisclaimer for next compilation + if [[ -d .git ]]; then + git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw # Revert AlphaDisclaimer for next compilation + fi echoMessage "Saved to $file." } @@ -125,6 +131,10 @@ fi [ -n "$java" ] && ./sanityCheck.sh java [ -n "$python" ] && ./sanityCheck.sh +if ! [[ -d .git ]]; then + echoMessage "No git repository. Git specfific actions disabled." +fi + #compile if [[ "$dry" ]]; then echoMessage "Dry run finished."