Explorar o código

Further improvements

Daniel Gibbs %!s(int64=9) %!d(string=hai) anos
pai
achega
c5756d8e84
Modificáronse 1 ficheiros con 19 adicións e 19 borrados
  1. 19 19
      lgsm/functions/command_update_functions.sh

+ 19 - 19
lgsm/functions/command_update_functions.sh

@@ -34,26 +34,26 @@ if [ "${tmp_script_diff}" != "" ]; then
 	rm -f "${tmpdir}/linuxgsm.sh"
 	rm -f "${tmpdir}/linuxgsm.sh"
 	fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "linuxgsm.sh" "noexecutecmd" "norun" "noforce" "nomd5"
 	fn_fetch_file_github "" "linuxgsm.sh" "${tmpdir}" "linuxgsm.sh" "noexecutecmd" "norun" "noforce" "nomd5"
 	# Compare selfname against linuxgsm.sh in the tmp dir. Ignoring server specific vars.
 	# Compare selfname against linuxgsm.sh in the tmp dir. Ignoring server specific vars.
-	script_diff=$(diff <(sed '/shortname/d;/servername/d;/gamename/d' "${tmpdir}/linuxgsm.sh") <(sed '/shortname/d;/servername/d;/gamename/d' "${rootdir}/${selfname}"))
-	if [ "${script_diff}" != "" ]; then
-		echo -ne "    backup linuxgsm.sh...\c"
-		cp "${rootdir}/${selfname}" "${tmpdir}/${selfname}-$(date +"%m_%d_%Y_%M").bak"
-		if [ $? -ne 0 ]; then
-			fn_print_fail_eol_nl
-			core_exit.sh
-		else
-			fn_print_ok_eol_nl
-			echo -en "${tmpdir}/${selfname}-$(date +"%m_%d_%Y_%M").bak"
-		fi
-		copyshortname="$(grep -m 1 shortname=)" "${rootdir}/${selfname}"
-		copyservername="$(grep -m 1 servername=)" "${rootdir}/${selfname}"
-		copygamename="$(grep -m 1 gamename=)" "${rootdir}/${selfname}"
-
-		cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
-		sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
-		sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
-		sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
+fi
+script_diff=$(diff <(sed '/shortname/d;/servername/d;/gamename/d' "${tmpdir}/linuxgsm.sh") <(sed '/shortname/d;/servername/d;/gamename/d' "${rootdir}/${selfname}"))
+if [ "${script_diff}" != "" ]; then
+	echo -ne "    backup linuxgsm.sh...\c"
+	cp "${rootdir}/${selfname}" "${tmpdir}/${selfname}-$(date +"%m_%d_%Y_%M").bak"
+	if [ $? -ne 0 ]; then
+		fn_print_fail_eol_nl
+		core_exit.sh
+	else
+		fn_print_ok_eol_nl
+		echo -en "${tmpdir}/${selfname}-$(date +"%m_%d_%Y_%M").bak"
 	fi
 	fi
+	copyshortname="$(grep -m 1 shortname= "${rootdir}/${selfname}")"
+	copyservername="$(grep -m 1 servername= "${rootdir}/${selfname}")"
+	copygamename="$(grep -m 1 gamename= "${rootdir}/${selfname}")"
+
+	cp "${tmpdir}/linuxgsm.sh" "${rootdir}/${selfname}"
+	sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
+	sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
+	sed -i 's/shortname="core"/${copyshortname}/g' "${rootdir}/${selfname}"
 else
 else
 	fn_print_ok_eol_nl
 	fn_print_ok_eol_nl
 fi
 fi