Browse Source

feat(dev): add nocache if dev-debug is enabled (#4597)

pull/4739/head
Daniel Gibbs 8 months ago
committed by GitHub
parent
commit
e060865aef
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 43
      lgsm/modules/command_update_linuxgsm.sh

43
lgsm/modules/command_update_linuxgsm.sh

@ -15,14 +15,21 @@ check.sh
info_distro.sh info_distro.sh
info_game.sh info_game.sh
# Prevent github from using a cached version of the file if dev-debug is enabled.
if [ -f "${rootdir}/.dev-debug" ]; then
nocache="-H \"Cache-Control: no-cache\" -H \"Pragma: no-cache\""
fi
fn_script_log_info "Updating LinuxGSM" fn_script_log_info "Updating LinuxGSM"
fn_print_dots "Selecting repo" fn_print_dots "Selecting repo"
fn_script_log_info "Selecting repo" fn_script_log_info "Selecting repo"
# Select remotereponame # Select remotereponame
curl --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
if [ $? != "0" ]; then if [ $? != "0" ]; then
curl --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
if [ $? != "0" ]; then if [ $? != "0" ]; then
fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_print_fail_nl "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
fn_script_log_fail "Selecting repo: Unable to to access GitHub or Bitbucket repositories" fn_script_log_fail "Selecting repo: Unable to to access GitHub or Bitbucket repositories"
@ -39,9 +46,9 @@ fi
# Check linuxsm.sh # Check linuxsm.sh
echo -en "checking ${remotereponame} linuxgsm.sh...\c" echo -en "checking ${remotereponame} linuxgsm.sh...\c"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh" 1> /dev/null
else else
curl --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh" 1> /dev/null
fi fi
if [ $? != "0" ]; then if [ $? != "0" ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
@ -51,9 +58,9 @@ if [ $? != "0" ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh")) tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/linuxgsm.sh"))
else else
tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh")) tmp_script_diff=$(diff "${tmpdir}/linuxgsm.sh" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/linuxgsm.sh"))
fi fi
if [ "${tmp_script_diff}" != "" ]; then if [ "${tmp_script_diff}" != "" ]; then
@ -119,9 +126,9 @@ fi
echo -en "checking ${remotereponame} config _default.cfg...\c" echo -en "checking ${remotereponame} config _default.cfg...\c"
fn_script_log_info "Checking ${remotereponame} config _default.cfg" fn_script_log_info "Checking ${remotereponame} config _default.cfg"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
else else
curl --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg" 1> /dev/null
fi fi
if [ $? != "0" ]; then if [ $? != "0" ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
@ -131,9 +138,9 @@ if [ $? != "0" ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
else else
config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg")) config_file_diff=$(diff "${configdirdefault}/config-lgsm/${gameservername}/_default.cfg" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/config-default/config-lgsm/${gameservername}/_default.cfg"))
fi fi
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
@ -153,9 +160,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c" echo -en "checking ${remotereponame} config ${distroid}-${distroversioncsv}.csv...\c"
fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv" fn_script_log_info "Checking ${remotereponame} ${distroid}-${distroversioncsv}.csv"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
else else
curl --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv" 1> /dev/null
fi fi
if [ $? != "0" ]; then if [ $? != "0" ]; then
fn_print_fail_eol_nl fn_print_fail_eol_nl
@ -165,9 +172,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
fi fi
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
else else
config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv")) config_file_diff=$(diff "${datadir}/${distroid}-${distroversioncsv}.csv" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/lgsm/data/${distroid}-${distroversioncsv}.csv"))
fi fi
if [ "${config_file_diff}" != "" ]; then if [ "${config_file_diff}" != "" ]; then
@ -191,9 +198,9 @@ if [ -n "${modulesdir}" ]; then
echo -en "checking ${remotereponame} module ${modulefile}...\c" echo -en "checking ${remotereponame} module ${modulefile}...\c"
github_file_url_dir="lgsm/modules" github_file_url_dir="lgsm/modules"
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
curl --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
else else
curl --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null curl ${nocache} --connect-timeout 3 -IsfL "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}" 1> /dev/null
fi fi
if [ $? != 0 ]; then if [ $? != 0 ]; then
fn_print_error_eol_nl fn_print_error_eol_nl
@ -210,9 +217,9 @@ if [ -n "${modulesdir}" ]; then
else else
# compare file # compare file
if [ "${remotereponame}" == "GitHub" ]; then if [ "${remotereponame}" == "GitHub" ]; then
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}")) module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl ${nocache} --connect-timeout 3 -s "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${modulefile}"))
else else
module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}")) module_file_diff=$(diff "${modulesdir}/${modulefile}" <(curl ${nocache} --connect-timeout 3 -s "https://bitbucket.org/${githubuser}/${githubrepo}/raw/${githubbranch}/${github_file_url_dir}/${modulefile}"))
fi fi
# results # results

Loading…
Cancel
Save