Skip to content

Instantly share code, notes, and snippets.

@TechnicianLP
Last active June 11, 2018 20:59
Show Gist options
  • Save TechnicianLP/5882de4075b6ed3700bba2bbc310e616 to your computer and use it in GitHub Desktop.
Save TechnicianLP/5882de4075b6ed3700bba2bbc310e616 to your computer and use it in GitHub Desktop.
GraveyardKeeper Linux Installer extraction scripts
This script is used to extract the windows installer and prepare an installation-folder to be used with wine
Installer does currently not run in wine, yet the game does
1. put the script and the installer into a folder
2. run "script <path to windows installer>" from that folder
3. wait for the script to finish
4. copy the contents of the directory (maybe remove installer and script first) over into the Programm Files (x86) folder of your wine instance
5. launch GraveyardKeeper.exe with wine and enjoy the game
For best experience enable the virtual desktop and always capture mouse in fullscreen in wine
For scripts that arent current version looks in the revisions of this gist
#! /bin/bash
#
# This script works for 0.677
# might not work for other version
#
if [ $# -eq 0 ]; then
echo "Usage: install <windows-installer> <args>"
echo "Paremters:"
echo " s - Skip extraction"
exit 0
fi
if ! [ -f $1 ]; then
echo "Installer not found" >&2
exit 1
fi
skipExtraction=fase
while [ "$2" != "" ]; do
case $2 in
-s )
skipExtraction=true
;;
* )
echo "Unknown parameter: $2" >&2
exit 1
;;
esac
shift
done
error=false
if ! [ -x "$(command -v wine)" ]; then
echo 'Error: wine is not installed.' >&2
error=true
fi
if ! [ -x "$(command -v 7z)" ]; then
echo 'Error: 7z is not installed.' >&2
error=true
fi
if [ "$error" = true ]; then
echo "Please install the required programms or change the script to use an equivalent" >&2
exit 1
fi
echo "Starting Installation"
if [ "$skipExtraction" = true ]; then
echo "Skipped extraction"
else
echo "Extracting installer"
wine $1 /extract
echo "Extracting contained archive"
7z x -oraw -bso0 -bsp1 -y "Graveyard Keeper Alpha1.cab"
fi
echo "Starting to sort files"
missing=()
#This are the functons that actually do the filemoving
moveFile() {
if [ -f "raw/$1" ]; then
echo "moving $2/$1"
mv "raw/$1" "$2/."
else
if [ -f "$2/$1" ]; then
echo "$2/$1 already moved"
else
missing+=("$2/$1")
echo "$2/$1 is missing"
fi
fi
}
moveFiles() {
dir="GraveyardKeeper_Data/$1"
shift
mkdir -p "$dir"
for K in $@; do
moveFile "$K" "$dir"
done
}
removeMissing() {
for (( i=0; i<${#missing[@]}; i++ )); do
if [[ ${missing[i]} == $1 ]]; then
missing=( "${missing[@]:0:$i}" "${missing[@]:$((i + 1))}" )
fi
done
}
moveFile "GraveyardKeeper.exe" "."
moveFile "UnityCrashHandler32.exe" "."
moveFile "UnityPlayer.dll" "."
#For every subdir loop through files
maindir=( "app.info" "boot.config" "globalgamemanagers" "globalgamemanagers.assets" "globalgamemanagers.assets.resS"
"level0" "level1" "level2" "level3" "level4" "level5"
"resources.assets" "resources.assets.resS" "resources.resource"
"sharedassets0.assets" "sharedassets0.assets.resS"
"sharedassets1.assets" "sharedassets1.assets.resS" "sharedassets1.resource"
"sharedassets2.assets" "sharedassets2.assets.resS"
"sharedassets3.assets" "sharedassets3.assets.resS"
"sharedassets4.assets" "sharedassets4.assets.resS" "sharedassets4.resource"
"sharedassets5.assets" )
moveFiles "" ${maindir[@]}
managed=( "AmplifyColor.dll" "AssemblyCSharp.dll" "AssemblyCSharpfirstpass.dll" "AssemblyUnityScriptfirstpass.dll"
"Boo.Lang.dll" "DOTween43.dll" "DOTween46.dll" "DOTween50.dll" "DOTween.dll" "GameAnalytics.dll" "LinqTools.dll" "LitJson.dll"
"Microsoft.Mixer.UnityEditor.CSharp.dll" "Mono.Data.Sqlite.dll" "Mono.Data.Tds.dll" "Mono.Security.dll" "mscorlib.dll"
"Newtonsoft.Json.dll" "Pathfinding.ClipperLib.dll" "Pathfinding.Ionic.Zip.Reduced.dll" "Pathfinding.Poly2Tri.dll" "Rewired_Core.dll"
"Rewired_Windows_Lib.dll" "Sirenix.OdinInspector.Attributes.dll" "SmartBearAssembly.dll" "System.Core.dll" "System.Data.dll"
"System.dll" "System.Runtime.Serialization.dll" "System.Transactions.dll" "System.Xml.dll" "System.Xml.Linq.dll"
"UnityEngine.AccessibilityModule.dll" "UnityEngine.AccessibilityModule.xml" "UnityEngine.AIModule.dll" "UnityEngine.AIModule.xml"
"UnityEngine.AnimationModule.dll" "UnityEngine.AnimationModule.xml" "UnityEngine.ARModule.dll" "UnityEngine.ARModule.xml"
"UnityEngine.AssetBundleModule.dll" "UnityEngine.AssetBundleModule.xml" "UnityEngine.AudioModule.dll" "UnityEngine.AudioModule.xml"
"UnityEngine.BaselibModule.dll" "UnityEngine.BaselibModule.xml" "UnityEngine.ClothModule.dll" "UnityEngine.ClothModule.xml"
"UnityEngine.CloudWebServicesModule.dll" "UnityEngine.CloudWebServicesModule.xml" "UnityEngine.ClusterInputModule.dll"
"UnityEngine.ClusterInputModule.xml" "UnityEngine.ClusterRendererModule.dll" "UnityEngine.ClusterRendererModule.xml"
"UnityEngine.CoreModule.dll" "UnityEngine.CoreModule.xml" "UnityEngine.CrashReportingModule.dll" "UnityEngine.CrashReportingModule.xml"
"UnityEngine.DirectorModule.dll" "UnityEngine.DirectorModule.xml" "UnityEngine.dll" "UnityEngine.FacebookModule.dll"
"UnityEngine.FacebookModule.xml" "UnityEngine.GameCenterModule.dll" "UnityEngine.GameCenterModule.xml" "UnityEngine.GridModule.dll"
"UnityEngine.GridModule.xml" "UnityEngine.HotReloadModule.dll" "UnityEngine.HotReloadModule.xml"
"UnityEngine.ImageConversionModule.dll" "UnityEngine.ImageConversionModule.xml" "UnityEngine.IMGUIModule.dll"
"UnityEngine.IMGUIModule.xml" "UnityEngine.InputModule.dll" "UnityEngine.InputModule.xml" "UnityEngine.JSONSerializeModule.dll"
"UnityEngine.JSONSerializeModule.xml" "UnityEngine.Networking.dll" "UnityEngine.ParticlesLegacyModule.dll"
"UnityEngine.ParticlesLegacyModule.xml" "UnityEngine.ParticleSystemModule.dll" "UnityEngine.ParticleSystemModule.xml"
"UnityEngine.PerformanceReportingModule.dll" "UnityEngine.PerformanceReportingModule.xml" "UnityEngine.Physics2DModule.dll"
"UnityEngine.Physics2DModule.xml" "UnityEngine.PhysicsModule.dll" "UnityEngine.PhysicsModule.xml" "UnityEngine.ScreenCaptureModule.dll"
"UnityEngine.ScreenCaptureModule.xml" "UnityEngine.SharedInternalsModule.dll" "UnityEngine.SharedInternalsModule.xml"
"UnityEngine.SpatialTracking.dll" "UnityEngine.SpatialTrackingModule.dll" "UnityEngine.SpatialTrackingModule.xml"
"UnityEngine.SpriteMaskModule.dll" "UnityEngine.SpriteMaskModule.xml" "UnityEngine.SpriteShapeModule.dll"
"UnityEngine.SpriteShapeModule.xml" "UnityEngine.StyleSheetsModule.dll" "UnityEngine.StyleSheetsModule.xml"
"UnityEngine.SubstanceModule.dll" "UnityEngine.SubstanceModule.xml" "UnityEngine.TerrainModule.dll" "UnityEngine.TerrainModule.xml"
"UnityEngine.TerrainPhysicsModule.dll" "UnityEngine.TerrainPhysicsModule.xml" "UnityEngine.TextRenderingModule.dll"
"UnityEngine.TextRenderingModule.xml" "UnityEngine.TilemapModule.dll" "UnityEngine.TilemapModule.xml" "UnityEngine.Timeline.dll"
"UnityEngine.TimelineModule.dll" "UnityEngine.TimelineModule.xml" "UnityEngine.TLSModule.dll" "UnityEngine.TLSModule.xml"
"UnityEngine.UI.dll" "UnityEngine.UIElementsModule.dll" "UnityEngine.UIElementsModule.xml" "UnityEngine.UIModule.dll"
"UnityEngine.UIModule.xml" "UnityEngine.UmbraModule.dll" "UnityEngine.UmbraModule.xml" "UnityEngine.UNETModule.dll"
"UnityEngine.UNETModule.xml" "UnityEngine.UnityAnalyticsModule.dll" "UnityEngine.UnityAnalyticsModule.xml"
"UnityEngine.UnityConnectModule.dll" "UnityEngine.UnityConnectModule.xml" "UnityEngine.UnityWebRequestAssetBundleModule.dll"
"UnityEngine.UnityWebRequestAssetBundleModule.xml" "UnityEngine.UnityWebRequestAudioModule.dll"
"UnityEngine.UnityWebRequestAudioModule.xml" "UnityEngine.UnityWebRequestModule.dll" "UnityEngine.UnityWebRequestModule.xml"
"UnityEngine.UnityWebRequestTextureModule.dll" "UnityEngine.UnityWebRequestTextureModule.xml" "UnityEngine.UnityWebRequestWWWModule.dll"
"UnityEngine.UnityWebRequestWWWModule.xml" "UnityEngine.VehiclesModule.dll" "UnityEngine.VehiclesModule.xml"
"UnityEngine.VideoModule.dll" "UnityEngine.VideoModule.xml" "UnityEngine.VRModule.dll" "UnityEngine.VRModule.xml"
"UnityEngine.WebModule.dll" "UnityEngine.WebModule.xml" "UnityEngine.WindModule.dll" "UnityEngine.WindModule.xml" "UnityEngine.xml"
"UnityEngine.XRModule.dll" "UnityEngine.XRModule.xml" "UnityScript.Lang.dll" "websocketsharp.dll" )
moveFiles "Managed" ${managed[@]}
moveFiles "../Mono/EmbedRuntime" "mono.dll" "MonoPosixHelper.dll"
moveFiles "../Mono/etc/mono" "browscap.ini" "config"
moveFiles "../Mono/etc/mono/1.0" "DefaultWsdlHelpGenerator.aspx" "machine.config"
moveFiles "../Mono/etc/mono/2.0" "DefaultWsdlHelpGenerator.aspx_1" "machine.config_1" "settings.map" "web.config"
moveFiles "../Mono/etc/mono/2.0/Browsers" "Compat.browser"
moveFiles "../Mono/etc/mono/mconfig" "config.xml"
moveFiles "Plugins" "MixerEraNativePlugin.dll" "sqlite3.dll"
moveFiles "Resources" "unity_builtin_extra" "unitydefaultresources"
moveFiles "StreamingAssets" "interactiveconfig.json"
#Fix some filenames
#TODO
declare -A fix=(
["Managed/AssemblyCSharp.dll"]="Managed/Assembly-CSharp.dll"
["Managed/AssemblyCSharpfirstpass.dll"]="Managed/Assembly-CSharp-firstpass.dll"
["Managed/AssemblyUnityScriptfirstpass.dll"]="Managed/Assembly-UnityScript-firstpass.dll"
["Managed/websocketsharp.dll"]="Managed/websocket-sharp.dll"
["../Mono/etc/mono/2.0/DefaultWsdlHelpGenerator.aspx_1"]="../Mono/etc/mono/2.0/DefaultWsdlHelpGenerator.aspx"
["../Mono/etc/mono/2.0/machine.config_1"]="../Mono/etc/mono/2.0/machine.config"
["Resources/unitydefaultresources"]="Resources/unity default resources")
for K in "${!fix[@]}"; do
F="GraveyardKeeper_Data/$K"
T="GraveyardKeeper_Data/${fix[$K]}"
echo "Fixing filename: $K"
if [ -f "$F" ]; then
echo "renaming to $T"
mv "$F" "$T"
else
if [ -f "$T" ]; then
removeMissing "$F"
echo "$K already renamed"
else
missing+=("$T")
echo "neither $K nor $T could be found" >&2
fi
fi
done
if [ ${#missing[@]} -eq 0 ]; then
if ! [ -z "$(ls -A raw)" ]; then
echo "Some files remained unmoved (wrong version?) - they will have to be sorted manually"
exit 1
else
echo "Finsihed installation; starting cleanup"
rmdir "raw"
rm "Graveyard Keeper Alpha.msi"
rm "Graveyard Keeper Alpha1.cab"
fi
else
echo "Not all files required were found" >&2
for M in "${missing[@]}"; do
echo "Missing: $M" >&2
done
exit 1
fi
@geophree
Copy link

Thanks a lot for this! It inspired me to write a python script to programmatically figure out the directory structure and filenames. It should be a little more future-proof than the way you're doing it. Hopefully it's useful to you. https://gist.github.com/geophree/5bd74882d9dcea855e1c15ca3cce93df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment