From a54afeeace23ff70e3527e4b1043b6fb5efe31b3 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Fri, 20 Mar 2015 21:00:33 -0400 Subject: [PATCH 1/6] Update distro_fixes.sh Add a possible Debian LD_LIBRARY_PATH fix --- pack/df_linux/distro_fixes.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pack/df_linux/distro_fixes.sh b/pack/df_linux/distro_fixes.sh index 960c587..8771988 100755 --- a/pack/df_linux/distro_fixes.sh +++ b/pack/df_linux/distro_fixes.sh @@ -58,24 +58,27 @@ dlog "INFO" "DF_BIN_LOCATION: $DF_BIN_LOCATION" # but I haven't found this necessary if LD_PRELOAD is properly set (on fedora). if [ x"$DF_ARCH" == x'32-bit' ] && [ x"$ARCH" == x'x86_64' ]; then - + dlog "INFO" "32 bit df on $OS/64bit detected" # Fedora 21/64-bit is tested if [ x"$OS" == x'Fedora' ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib/libz.so.1"; - dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...." + dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" # Gentoo 2.2 elif [ x"$OS" == x'Gentoo' ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/lib32/libz.so.1"; - dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...." + dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" elif [ x"$OS" == x'Arch' ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so"; - dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...." + dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB...." + elif [ x"$OS" == x'Debian' ]; then + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/mesa-diverted/i386-linux-gnu" + dlog "INFO" "Setting LD_LIBRARY_PATH to $LD_LIBRARY_PATH" # Add your distro here... # elif [ x"$OS" == x'MyFooDistro' ]; then # export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}"; # dlog "INFO" "32 bit df on $OS/64bit detected. Will set LD_PRELOAD to $PRELOAD_LIB...." else - dlog "WARN" "32bit 'Dwarf_Fortress' on 64bit OS detected. If you get 'missing file' errors, please open an issue on Github." + dlog "WARN" "32bit 'Dwarf_Fortress' on unhandled 64bit OS detected. If you get 'missing file' errors, please open an issue on Github: https://github.com/Lazy-Newb-Pack/Lazy-Newb-Pack-Linux/issues." fi fi From 305a6a1cf7e7e1a66145456928d5f3c85c175163 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Fri, 20 Mar 2015 21:27:21 -0400 Subject: [PATCH 2/6] Use /bin/bash --- pack/df_linux/dfhack | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pack/df_linux/dfhack b/pack/df_linux/dfhack index 05797c2..5c6bde5 100755 --- a/pack/df_linux/dfhack +++ b/pack/df_linux/dfhack @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # NOTE: This is dfhack's modification of the normal invocation script, # changed to properly set LD_PRELOAD so as to run DFHACK. @@ -85,4 +85,4 @@ if [ -n "$DF_POST_CMD" ]; then eval $DF_POST_CMD fi -exit $ret \ No newline at end of file +exit $ret From f2ba22c016c29f35bf43eb8f3919a97c2f364282 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Fri, 20 Mar 2015 21:27:34 -0400 Subject: [PATCH 3/6] Use /bin/bash --- pack/df_linux/distro_fixes.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/df_linux/distro_fixes.sh b/pack/df_linux/distro_fixes.sh index 8771988..467364e 100755 --- a/pack/df_linux/distro_fixes.sh +++ b/pack/df_linux/distro_fixes.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # This script checks the system for ARCH and disto details # and sets up env variables as workaround for use by the From a2b126748a8fa7fa0ca820a808fff202799803e0 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Fri, 20 Mar 2015 21:43:43 -0400 Subject: [PATCH 4/6] Locate a 32-bit zlib on Debian --- pack/df_linux/distro_fixes.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pack/df_linux/distro_fixes.sh b/pack/df_linux/distro_fixes.sh index 467364e..3b88c9d 100755 --- a/pack/df_linux/distro_fixes.sh +++ b/pack/df_linux/distro_fixes.sh @@ -69,9 +69,20 @@ if [ x"$DF_ARCH" == x'32-bit' ] && [ x"$ARCH" == x'x86_64' ]; then dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" elif [ x"$OS" == x'Arch' ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so"; - dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB...." + dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" elif [ x"$OS" == x'Debian' ]; then export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/mesa-diverted/i386-linux-gnu" + if [ -f "/usr/lib32/libz.so" ]; then + export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so" + else + zlib32=$(ls /usr/lib32/libz.so.* | head -n1) + if [ -f "$zlib32" ]; then + export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}$zlib32" + else + dlog "WARN" "Could not find a 32-bit zlib" + fi + fi + dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" dlog "INFO" "Setting LD_LIBRARY_PATH to $LD_LIBRARY_PATH" # Add your distro here... # elif [ x"$OS" == x'MyFooDistro' ]; then From b97e14e96c012b1097f61a0143e7894b1a6697be Mon Sep 17 00:00:00 2001 From: Lethosor Date: Sun, 22 Mar 2015 22:37:10 -0400 Subject: [PATCH 5/6] Update distro_fixes.sh --- pack/df_linux/distro_fixes.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pack/df_linux/distro_fixes.sh b/pack/df_linux/distro_fixes.sh index 3b88c9d..5086628 100755 --- a/pack/df_linux/distro_fixes.sh +++ b/pack/df_linux/distro_fixes.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!/bin/sh # This script checks the system for ARCH and disto details # and sets up env variables as workaround for use by the # df/dfhack scripts. -function dlog() { +dlog() { echo -e "\033[0;32m[distro_fixes]\033[0;00m $1 $2" } @@ -71,7 +71,7 @@ if [ x"$DF_ARCH" == x'32-bit' ] && [ x"$ARCH" == x'x86_64' ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so"; dlog "INFO" "Setting LD_PRELOAD to $PRELOAD_LIB" elif [ x"$OS" == x'Debian' ]; then - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/mesa-diverted/i386-linux-gnu" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}/usr/lib/mesa-diverted/i386-linux-gnu" if [ -f "/usr/lib32/libz.so" ]; then export PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}/usr/lib32/libz.so" else From 6dfef261ab72a42f2e18d7d9b2618741228b4aa2 Mon Sep 17 00:00:00 2001 From: Lethosor Date: Sun, 22 Mar 2015 22:38:09 -0400 Subject: [PATCH 6/6] Revert "Use /bin/bash" dash handles distro_fixes.sh with a few minor changes --- pack/df_linux/dfhack | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pack/df_linux/dfhack b/pack/df_linux/dfhack index 5c6bde5..2609736 100755 --- a/pack/df_linux/dfhack +++ b/pack/df_linux/dfhack @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # NOTE: This is dfhack's modification of the normal invocation script, # changed to properly set LD_PRELOAD so as to run DFHACK.