Prechádzať zdrojové kódy

refactor: improve readability and consistency in code

- Updated the echo statement to include formatting for script name
- Added bold formatting to EULA acceptance message
- Removed unnecessary line breaks and added italic formatting to EULA URL
- Refactored code to remove duplicate calls to install_eula.sh
Daniel Gibbs 2 rokov pred
rodič
commit
46d004c744

+ 1 - 1
lgsm/modules/command_update_linuxgsm.sh

@@ -68,7 +68,7 @@ fi
 # Check gameserver.sh
 # Check gameserver.sh
 # Compare gameserver.sh against linuxgsm.sh in the tmp dir.
 # Compare gameserver.sh against linuxgsm.sh in the tmp dir.
 # Ignoring server specific vars.
 # Ignoring server specific vars.
-echo -en "checking script [ ${selfname} ]\c"
+echo -en "checking script [ ${italic}${selfname}${default} ]\c"
 fn_script_log_info "Checking ${selfname}"
 fn_script_log_info "Checking ${selfname}"
 script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
 script_diff=$(diff <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${tmpdir}/linuxgsm.sh") <(sed '\/shortname/d;\/gameservername/d;\/gamename/d;\/githubuser/d;\/githubrepo/d;\/githubbranch/d' "${rootdir}/${selfname}"))
 if [ "${script_diff}" != "" ]; then
 if [ "${script_diff}" != "" ]; then

+ 4 - 3
lgsm/modules/install_eula.sh

@@ -16,11 +16,12 @@ elif [ "${shortname}" == "ut" ]; then
 fi
 fi
 
 
 echo -e ""
 echo -e ""
-echo -e "${lightyellow}Accept ${gamename} EULA${default}"
-echo -e "================================="
+echo -e "${bold}${lightyellow}Accept ${gamename} EULA${default}"
+echo -e "${bold}=================================${default}"
 fn_sleep_time
 fn_sleep_time
 echo -e "You are required to accept the EULA:"
 echo -e "You are required to accept the EULA:"
-echo -e "${eulaurl}"
+echo -e ""
+echo -e "${italic}${eulaurl}${default}"
 echo -e ""
 echo -e ""
 if [ -z "${autoinstall}" ]; then
 if [ -z "${autoinstall}" ]; then
 	echo -e "By continuing you are indicating your agreement to the EULA."
 	echo -e "By continuing you are indicating your agreement to the EULA."

+ 4 - 5
lgsm/modules/install_server_files.sh

@@ -205,6 +205,10 @@ fn_install_server_files() {
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"
 	fn_dl_extract "${local_filedir}" "${local_filename}" "${serverfiles}"
 }
 }
 
 
+if [ "${shortname}" == "mc" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "ut" ]; then
+	install_eula.sh
+fi
+
 echo -e ""
 echo -e ""
 echo -e "${lightyellow}Installing ${gamename} Server${default}"
 echo -e "${lightyellow}Installing ${gamename} Server${default}"
 echo -e "================================="
 echo -e "================================="
@@ -220,12 +224,10 @@ fi
 if [ "${shortname}" == "ts3" ]; then
 if [ "${shortname}" == "ts3" ]; then
 	update_ts3.sh
 	update_ts3.sh
 elif [ "${shortname}" == "mc" ]; then
 elif [ "${shortname}" == "mc" ]; then
-	install_eula.sh
 	update_mc.sh
 	update_mc.sh
 elif [ "${shortname}" == "mcb" ]; then
 elif [ "${shortname}" == "mcb" ]; then
 	update_mcb.sh
 	update_mcb.sh
 elif [ "${shortname}" == "pmc" ]; then
 elif [ "${shortname}" == "pmc" ]; then
-	install_eula.sh
 	update_pmc.sh
 	update_pmc.sh
 elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then
 elif [ "${shortname}" == "wmc" ] || [ "${shortname}" == "vpmc" ]; then
 	update_pmc.sh
 	update_pmc.sh
@@ -242,9 +244,6 @@ elif [ "${shortname}" == "ut99" ]; then
 	fn_install_server_files
 	fn_install_server_files
 	update_ut99.sh
 	update_ut99.sh
 elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then
 elif [ -z "${appid}" ] || [ "${shortname}" == "ahl" ] || [ "${shortname}" == "bb" ] || [ "${shortname}" == "ns" ] || [ "${shortname}" == "sfc" ] || [ "${shortname}" == "ts" ] || [ "${shortname}" == "vs" ] || [ "${shortname}" == "zmr" ]; then
-	if [ "${shortname}" == "ut" ]; then
-		install_eula.sh
-	fi
 	fn_install_server_files
 	fn_install_server_files
 fi
 fi