Преглед изворни кода

fix(mods): BepInEx Valheim install fix (rebased from #4938) (#4939)

* fix: exclude Wine prefix from serverfiles ownership check

SteamCMD creates a Wine prefix at serverfiles/steamapps/compatdata/
containing a z: symlink pointing to /. Without excluding this path,
`find "${serverfiles}"` traverses the entire filesystem, causing
check_permissions.sh to hang indefinitely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(vh): correct BepInEx mod extraction and env vars

- mods_list: set modsubdirs="BepInExPack_Valheim" so only the pack
  contents (not loose Thunderstore metadata) are installed to serverfiles
- mods_core: implement modsubdirs subfolder isolation in fn_mod_install_files;
  when modsubdirs is not "0", the named subfolder becomes the extract root
- fix_vh: update BepInEx env vars to match current start_server_bepinex.sh
  (DOORSTOP_ENABLED/DOORSTOP_TARGET_ASSEMBLY replacing old names,
  remove defunct DOORSTOP_CORLIB_OVERRIDE_PATH)
- mods_list: update modsubdirs field comment to reflect its actual semantics

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: yourfate <2371889-youRFate@users.noreply.gitlab.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Daniel Gibbs пре 2 дана
родитељ
комит
bbcca49d31
4 измењених фајлова са 15 додато и 7 уклоњено
  1. 2 2
      lgsm/modules/check_permissions.sh
  2. 2 3
      lgsm/modules/fix_vh.sh
  3. 9 0
      lgsm/modules/mods_core.sh
  4. 2 2
      lgsm/modules/mods_list.sh

+ 2 - 2
lgsm/modules/check_permissions.sh

@@ -24,7 +24,7 @@ fn_check_ownership() {
 		fi
 		fi
 	fi
 	fi
 	if [ -d "${serverfiles}" ]; then
 	if [ -d "${serverfiles}" ]; then
-		if [ "$(find "${serverfiles}" -not -name '*.swp' -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
+		if [ "$(find "${serverfiles}" -not -path "*/steamapps/compatdata/*" -not -name '*.swp' -not -user "$(whoami)" | wc -l)" -ne "0" ]; then
 			filesownissue=1
 			filesownissue=1
 		fi
 		fi
 	fi
 	fi
@@ -42,7 +42,7 @@ fn_check_ownership() {
 				find "${lgsmdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
 				find "${lgsmdir}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
 			fi
 			fi
 			if [ "${filesownissue}" == "1" ]; then
 			if [ "${filesownissue}" == "1" ]; then
-				find "${serverfiles}" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
+				find "${serverfiles}" -not -path "*/steamapps/compatdata/*" -not -user "$(whoami)" -printf "%u\t%g\t%p\n"
 			fi
 			fi
 
 
 		} | column -s $'\t' -t | tee -a "${lgsmlog}"
 		} | column -s $'\t' -t | tee -a "${lgsmlog}"

+ 2 - 3
lgsm/modules/fix_vh.sh

@@ -29,9 +29,8 @@ if [ -f "${modsinstalledlistfullpath}" ]; then
 		fn_print_info_nl "BepInEx install detected, applying start exports"
 		fn_print_info_nl "BepInEx install detected, applying start exports"
 		fn_script_log_info "BepInEx install detected, applying start exports"
 		fn_script_log_info "BepInEx install detected, applying start exports"
 		# exports for BepInEx framework from script start_server_bepinex.sh
 		# exports for BepInEx framework from script start_server_bepinex.sh
-		export DOORSTOP_ENABLE=TRUE
-		export DOORSTOP_INVOKE_DLL_PATH=./BepInEx/core/BepInEx.Preloader.dll
-		export DOORSTOP_CORLIB_OVERRIDE_PATH=./unstripped_corlib
+		export DOORSTOP_ENABLED=1
+		export DOORSTOP_TARGET_ASSEMBLY=./BepInEx/core/BepInEx.Preloader.dll
 
 
 		export LD_LIBRARY_PATH="./doorstop_libs:${LD_LIBRARY_PATH}"
 		export LD_LIBRARY_PATH="./doorstop_libs:${LD_LIBRARY_PATH}"
 		export LD_PRELOAD="libdoorstop_x64.so:${LD_PRELOAD}"
 		export LD_PRELOAD="libdoorstop_x64.so:${LD_PRELOAD}"

+ 9 - 0
lgsm/modules/mods_core.sh

@@ -29,6 +29,15 @@ fn_mod_install_files() {
 		mkdir -p "${extractdest}"
 		mkdir -p "${extractdest}"
 	fi
 	fi
 	fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdest}"
 	fn_dl_extract "${modstmpdir}" "${modfilename}" "${extractdest}"
+	# If modsubdirs names a specific subfolder, use its contents as the install root.
+	if [ "${modsubdirs}" != "0" ] && [ -d "${extractdest}/${modsubdirs}" ]; then
+		local tmpsubdir
+		tmpsubdir=$(mktemp -d)
+		mv "${extractdest}/${modsubdirs}" "${tmpsubdir}/"
+		rm -rf "${extractdest}"
+		mv "${tmpsubdir}/${modsubdirs}" "${extractdest}"
+		rm -rf "${tmpsubdir}"
+	fi
 }
 }
 
 
 # Convert mod files to lowercase if needed.
 # Convert mod files to lowercase if needed.

+ 2 - 2
lgsm/modules/mods_list.sh

@@ -122,7 +122,7 @@ modseparator="MOD"
 # [2] 	| "Pretty Name": the common name people use to call the mod that will be displayed to the user
 # [2] 	| "Pretty Name": the common name people use to call the mod that will be displayed to the user
 # [3] 	| "URL": link to the mod archive file; can be a variable previously defined while scraping a URL
 # [3] 	| "URL": link to the mod archive file; can be a variable previously defined while scraping a URL
 # [4] 	| "filename": the output filename
 # [4] 	| "filename": the output filename
-# [5]	| "modsubdirs": in how many subdirectories is the mod (none is 0) (not used at release, but could be in the future)
+# [5]	| "modsubdirs": name of a subfolder within the archive to extract as the install root (use "0" to extract all contents)
 # [6]	| "LowercaseOn/Off": LowercaseOff or LowercaseOn: enable/disable converting extracted files and directories to lowercase (some games require it)
 # [6]	| "LowercaseOn/Off": LowercaseOff or LowercaseOn: enable/disable converting extracted files and directories to lowercase (some games require it)
 # [7] 	| "modinstalldir": the directory in which to install the mode (use LGSM dir variables such as ${systemdir})
 # [7] 	| "modinstalldir": the directory in which to install the mode (use LGSM dir variables such as ${systemdir})
 # [8]	| "/files/to/keep;", files & directories that should not be overwritten upon update, separated and ended with a semicolon; you can also use "OVERWRITE" value to ignore the value or "NOUPDATE" to disallow updating; for files to keep upon uninstall, see fn_mod_tidy_files_list from mods_core.sh
 # [8]	| "/files/to/keep;", files & directories that should not be overwritten upon update, separated and ended with a semicolon; you can also use "OVERWRITE" value to ignore the value or "NOUPDATE" to disallow updating; for files to keep upon uninstall, see fn_mod_tidy_files_list from mods_core.sh
@@ -208,7 +208,7 @@ mod_info_sdtdoxide=(MOD "sdtdoxide" "Oxide for 7 Days To Die" "${oxidesdtdlatest
 mod_info_valheimplus=(MOD "valheimplus" "Valheim PLUS" "${valheimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/Grantapher/ValheimPlus.git" "Mod to improve Valheim gameplay")
 mod_info_valheimplus=(MOD "valheimplus" "Valheim PLUS" "${valheimpluslatestlink}" "ValheimPlus.tar.gz" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://github.com/Grantapher/ValheimPlus.git" "Mod to improve Valheim gameplay")
 
 
 # BepInEx Valheim
 # BepInEx Valheim
-mod_info_bepinexvh=(MOD "bepinexvh" "BepInEx Valheim" "${bepinexvhlatestlink}" "denikson-BepInExPack_Valheim.zip" "0" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/" "Unity / XNA game patcher and plugin framework")
+mod_info_bepinexvh=(MOD "bepinexvh" "BepInEx Valheim" "${bepinexvhlatestlink}" "denikson-BepInExPack_Valheim.zip" "BepInExPack_Valheim" "LowercaseOff" "${systemdir}" "OVERWRITE" "ENGINES" "Valheim;" "NOTGAMES" "https://valheim.thunderstore.io/package/denikson/BepInExPack_Valheim/" "Unity / XNA game patcher and plugin framework")
 
 
 # REQUIRED: Set all mods info into the global array
 # REQUIRED: Set all mods info into the global array
 mods_global_array=("${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustcarbon[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}" "${mod_info_bepinexvh[@]}")
 mods_global_array=("${mod_info_metamod[@]}" "${mod_info_base_amxx[@]}" "${mod_info_cs_amxx[@]}" "${mod_info_dod_amxx[@]}" "${mod_info_tfc_amxx[@]}" "${mod_info_ns_amxx[@]}" "${mod_info_ts_amxx[@]}" "${mod_info_metamodsource[@]}" "${mod_info_sourcemod[@]}" "${mod_info_steamworks[@]}" "${mod_info_gokz[@]}" "${mod_info_ttt[@]}" "${mod_info_get5[@]}" "${mod_info_prac[@]}" "${mod_info_pug[@]}" "${mod_info_dhook[@]}" "${mod_info_movement[@]}" "${mod_info_cleaner[@]}" "${mod_info_ulib[@]}" "${mod_info_ulx[@]}" "${mod_info_utime[@]}" "${mod_info_uclip[@]}" "${mod_info_acf[@]}" "${mod_info_acf_missiles[@]}" "${mod_info_acf_sweps[@]}" "${mod_info_advdupe2[@]}" "${mod_info_pac3[@]}" "${mod_info_wiremod[@]}" "${mod_info_wiremodextras[@]}" "${mod_info_darkrp[@]}" "${mod_info_darkrpmodification[@]}" "${mod_info_rustcarbon[@]}" "${mod_info_rustoxide[@]}" "${mod_info_hwoxide[@]}" "${mod_info_sdtdoxide[@]}" "${mod_info_advduplicator[@]}" "${mod_info_trackassemblytool[@]}" "${mod_info_physpropertiesadv[@]}" "${mod_info_controlsystemse2[@]}" "${mod_info_e2pistontiming[@]}" "${mod_info_propcannontool[@]}" "${mod_info_gearassemblytool[@]}" "${mod_info_spinnertool[@]}" "${mod_info_surfacefrictiontool[@]}" "${mod_info_magneticdipole[@]}" "${mod_info_environmentorganizer[@]}" "${mod_info_precision_alignment[@]}" "${mod_info_improved_stacker[@]}" "${mod_info_improved_weight[@]}" "${mod_info_improved_antinoclip[@]}" "${mod_info_laserstool[@]}" "${mod_info_valheimplus[@]}" "${mod_info_bepinexvh[@]}")