Skip to content

Commit 79cbabd

Browse files
authored
Update installUpgradeFunctions.sh: Check for files downloaded
1 parent b73adaf commit 79cbabd

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

scripts/installUpgradeFunctions.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,6 +1996,7 @@ function update_repo_files()
19961996
function update_allsky_common()
19971997
{
19981998
local MAKE_IF_NEEDED="${1:-false}"
1999+
local FILES_DOWNLOADED_FILE="${2}"
19992000
local TMP="/tmp/x.${RANDOM}"
20002001
local DOT_H="${ALLSKY_HOME}/src/include/allsky_common.h"
20012002

@@ -2013,7 +2014,26 @@ function update_allsky_common()
20132014
"${DOT_H}.repo" \
20142015
> "${TMP}"
20152016

2016-
# TODO: FIX: need to run "make" if any .cpp file changed.
2017+
# See if any source files changed. If so, re-run make if told to.
2018+
if [[ -n ${FILES_DOWNLOADED_FILE} && ${MAKE_IF_NEEDED} == "true" ]] && \
2019+
grep --silent -E "^src/.*\.cpp|^src/.*\.c|^src/.*\.h" "${FILES_DOWNLOADED_FILE}" ; then
2020+
2021+
# At least one file in the "src" directory changed, so re-run make.
2022+
local X="$(
2023+
cd "${ALLSKY_HOME}" &&
2024+
sudo make -C src deps &&
2025+
make -C src all &&
2026+
sudo make install
2027+
)"
2028+
if [[ $? -ne 0 ]]; then
2029+
echo "'make' failed: ${X}" >&2
2030+
return 1
2031+
fi
2032+
fi
2033+
2034+
if true; then # XXXXXXXXXXXX TODO REMOVE
2035+
cp "${TMP}" "${DOT_H}" && rm -f "${TMP}" # Change "> $TMP" above to "> DOT_H".
2036+
else
20172037

20182038
# If the new file is the same as the old, don't do anything.
20192039
if ! cmp --silent "${TMP}" "${DOT_H}" ; then
@@ -2031,8 +2051,8 @@ function update_allsky_common()
20312051
fi
20322052
fi
20332053
fi
2034-
20352054
rm -f "${TMP}"
2055+
fi
20362056
return 0
20372057
}
20382058

0 commit comments

Comments
 (0)