From 8055e8632820ed250e95e55d44da28235317c7c2 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 19 Apr 2026 10:03:22 +0000 Subject: [PATCH 1/2] fix(install_config): replace cp -nv with explicit file existence check Newer coreutils (Ubuntu 24.04+, Debian 13+) emit a portability warning when using cp -n: 'behavior of -n is non-portable and may change in future'. Replace all cp -nv usages with an explicit [ ! -f dest ] guard, which is portable across all distros and preserves the same OK/SKIP/FAIL behaviour. --- lgsm/modules/install_config.sh | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index 41d4ad866a..888fe099a6 100755 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -34,8 +34,13 @@ fn_default_config_remote() { if [ "${config}" == "${servercfgdefault}" ]; then mkdir -p "${servercfgdir}" echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]" - changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}") - exitcode=$? + if [ ! -f "${servercfgfullpath}" ]; then + cp "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}" + exitcode=$? + [ "${exitcode}" -eq 0 ] && changes="copied" + else + exitcode=0 + fi if [ "${exitcode}" -ne 0 ]; then fn_print_fail_eol_nl fn_script_log_fail "copying config file ${servercfgfullpath}" @@ -48,7 +53,13 @@ fn_default_config_remote() { elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then mkdir -p "${servercfgdir}" echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]" - changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}") + if [ ! -f "${networkcfgfullpath}" ]; then + cp "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}" + exitcode=$? + [ "${exitcode}" -eq 0 ] && changes="copied" + else + exitcode=0 + fi if [ "${exitcode}" -ne 0 ]; then fn_print_fail_eol_nl fn_script_log_fail "copying config file ${networkcfgdefault}" @@ -60,7 +71,13 @@ fn_default_config_remote() { fi elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then echo -en "copying config file [ ${italic}${clustercfgfullpath}${default} ]" - changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}") + if [ ! -f "${clustercfgfullpath}" ]; then + cp "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}" + exitcode=$? + [ "${exitcode}" -eq 0 ] && changes="copied" + else + exitcode=0 + fi if [ "${exitcode}" -ne 0 ]; then fn_print_fail_eol_nl fn_script_log_fail "copying config file ${clustercfgfullpath}" @@ -72,7 +89,13 @@ fn_default_config_remote() { fi else echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]" - changes+=$(cp -nv "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}") + if [ ! -f "${servercfgdir}/${config}" ]; then + cp "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}" + exitcode=$? + [ "${exitcode}" -eq 0 ] && changes="copied" + else + exitcode=0 + fi if [ "${exitcode}" -ne 0 ]; then fn_print_fail_eol_nl fn_script_log_fail "copying config file ${servercfgdir}/${config}" From ad890c67019c1ee904f3860f27ca7ec0a95040c6 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 19 Apr 2026 10:14:17 +0000 Subject: [PATCH 2/2] fix(install_config): use -e and -L checks to handle broken symlinks Using only -f missed broken symlinks (-e returns false for them but -L returns true). Use both checks to match the skip behaviour of cp -n. --- lgsm/modules/install_config.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lgsm/modules/install_config.sh b/lgsm/modules/install_config.sh index 888fe099a6..ddfc13794e 100755 --- a/lgsm/modules/install_config.sh +++ b/lgsm/modules/install_config.sh @@ -34,7 +34,7 @@ fn_default_config_remote() { if [ "${config}" == "${servercfgdefault}" ]; then mkdir -p "${servercfgdir}" echo -en "copying config file [ ${italic}${servercfgfullpath}${default} ]" - if [ ! -f "${servercfgfullpath}" ]; then + if [ ! -e "${servercfgfullpath}" ] && [ ! -L "${servercfgfullpath}" ]; then cp "${lgsmdir}/config-default/config-game/${config}" "${servercfgfullpath}" exitcode=$? [ "${exitcode}" -eq 0 ] && changes="copied" @@ -53,7 +53,7 @@ fn_default_config_remote() { elif [ "${shortname}" == "arma3" ] && [ "${config}" == "${networkcfgdefault}" ]; then mkdir -p "${servercfgdir}" echo -en "copying config file [ ${italic}${networkcfgfullpath}${default} ]" - if [ ! -f "${networkcfgfullpath}" ]; then + if [ ! -e "${networkcfgfullpath}" ] && [ ! -L "${networkcfgfullpath}" ]; then cp "${lgsmdir}/config-default/config-game/${config}" "${networkcfgfullpath}" exitcode=$? [ "${exitcode}" -eq 0 ] && changes="copied" @@ -71,7 +71,7 @@ fn_default_config_remote() { fi elif [ "${shortname}" == "dst" ] && [ "${config}" == "${clustercfgdefault}" ]; then echo -en "copying config file [ ${italic}${clustercfgfullpath}${default} ]" - if [ ! -f "${clustercfgfullpath}" ]; then + if [ ! -e "${clustercfgfullpath}" ] && [ ! -L "${clustercfgfullpath}" ]; then cp "${lgsmdir}/config-default/config-game/${clustercfgdefault}" "${clustercfgfullpath}" exitcode=$? [ "${exitcode}" -eq 0 ] && changes="copied" @@ -89,7 +89,7 @@ fn_default_config_remote() { fi else echo -en "copying config file [ ${italic}${servercfgdir}/${config}${default} ]" - if [ ! -f "${servercfgdir}/${config}" ]; then + if [ ! -e "${servercfgdir}/${config}" ] && [ ! -L "${servercfgdir}/${config}" ]; then cp "${lgsmdir}/config-default/config-game/${config}" "${servercfgdir}/${config}" exitcode=$? [ "${exitcode}" -eq 0 ] && changes="copied"