Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4

Author Topic: [linux] Install script  (Read 12467 times)

yaymeh

  • Bay Watcher
    • View Profile
[linux] Install script
« on: March 03, 2014, 10:55:58 am »

Accidentally tried to write an install script... parts of it works, but it's a MESS and probably sort of a little bit glitchy-breaky :3

Also, I don't know what to do about therapist. Was looking for a way to upload it, but then I realized that it has to be run as root (or did I just do something wrong?), so it should probably be compiled + uploaded by someone who's already maintaining some binary packages somewhere and can sign it properly & everything. :/ (Someone poke all the devs that maintain the DF packages for every distribution until they maintain therapist! :D)

Anyway, here's the script... maybe someone can clean it up a little or something, I suck at that sort of stuff :/.

(careful! This might set your hard-drive on fire or reformat your cat to vfat ;) )

edit: THIS IS OLD. NEWEST AT THE END OF THE THREAD ;).
Code: [Select]
#!/bin/zsh
### Might not work in bash. Will definitely not work in sh.
# choose a nice install dir
installdir="$HOME/DF_Masterwork"
# direct download links (Couldn't find one for the official masterwork release)
downloads=('https://github.com/pjf/masterwork-dwarf-fortress/archive/beta.zip'
'http://www.bay12games.com/dwarves/df_34_11_linux.tar.bz2'
'https://dl.dropboxusercontent.com/u/60111839/template.lng'
'http://dffd.wimbli.com/download.php?id=8067&f=dfhack-0.34.11-r4-Linux.7z');
# masterword df subdirectory
masterpath=./masterwork-dwarf-fortress-beta

# check if exists || create new
[ -d  "$installdir" ] || mkdir "$installdir"
cd $installdir || exit 0

# check if we have all programs installed & complain/quit
for dependancy in wget wine winetricks unzip zsh tar 7z;
do
[ -f "/usr/bin/$dependancy" ] || { echo "please install $dependancy, p.e.: 'sudo apt-get install $dependancy'"; exit 1; }
done;

#get and extract downloads
for download in $downloads
do
filename=$(basename "$download");
[ -f $filename ] || wget "$download";
case $filename in
*.tar.bz2) tar xvjf "$filename" ;;
*.zip) unzip "$filename" ;;
*.7z) 7z x $filename ;;
esac

done;

# "unfuck" (see link) the linux download a little bit. Would probably be better to do the whole https://github.com/svenstaro/dwarf_fortress_unfuck thing but... eeeh... uhm... NOPE.
IFS=$(echo -en "\n\b"); for file in $(grep -l "\.png" df_linux -ri | sort -u); do sed -i 's/\.png/.bmp/g' "$file"; done;
unset IFS;
# eeeeh... I give up. Leave it like that. :P now let's make a mess
# old raws need to go though
rm df_linux/raw -r
cp df_linux/* $masterpath/Dwarf\ Fortress/ -r

#patch language.
echo "patching language... this could take a while..."
IFS=$(echo -en "\n\b"); for line in $(cat template.lng | tr -d "\r" | grep "|.*|.*|"); do echo "$line" | IFS="|" read nope from to nope; to="${(r:${#from}:: :)${to[1,${#from}]}}"; [ "$from" != "$to" ] && { echo "#$from#=>#$to#"; sed -i "s|$from|$to|g" masterwork-dwarf-fortress-beta/Dwarf\ Fortress/libs/Dwarf_Fortress;} done;

# and dfhack...
cp dfhack-0.34.11-r4-Linux/* masterwork-dwarf-fortress-beta/Dwarf\ Fortress/ -r
chmod +x masterwork-dwarf-fortress-beta/Dwarf\ Fortress/dfhack

# shitty bundled version ruins everything, where did that even come from again?
rm masterwork-dwarf-fortress-beta/Dwarf\ Fortress/libs/libstdc++.so.6

md5=$(md5sum masterwork-dwarf-fortress-beta/Dwarf\ Fortress/libs/Dwarf_Fortress | sed "s/ .*//")

#patch new df binary md5sum into dfhack symbols.xml
sed -i "s#<md5-hash value='c55e1718c93247e702b35108c8d90e69'/>#\0\n<md5-hash value='$md5'/>#" masterwork-dwarf-fortress-beta/Dwarf\ Fortress/hack/symbols.xml

# wine stuff
export WINEARCH=win32
export WINEPREFIX=$installdir/.wine_df
winetricks -q dotnet40

# configuration need desktop icon or something.
echo "
[Desktop Entry]
Name=DF Masterwork configuration (wine)
Exec=env WINEPREFIX=\\\"$installdir/.wine_df\\\" wine \\\"$installdir/$masterpath/Masterwork Dwarf Fortress.exe\\\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
" >| ~/Desktop/dfMasterwork_config.desktop

# df needs desktop icon or something too.
echo "
[Desktop Entry]
Name=DF Masterwork (native DFhack)
Exec=\\\"$installdir/$masterpath/Dwarf Fortress/dfhack\\\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_native.desktop

# todo: therapist / patch checksum, moar
new_weird_checksum_for_therapist="0x${md5:0:8}"
# sed -i <something something needcompiled therapist first>
« Last Edit: March 07, 2014, 04:31:51 pm by yaymeh »
Logged

urmane

  • Bay Watcher
    • View Profile
Re: [linux] Install script help?
« Reply #1 on: March 03, 2014, 02:08:35 pm »

Here's the bits I currently do - this assumes everything is already downloaded, and since MDF changes so fast I have copies of a bunch of needed files outside the MDF directory.  Obviously it won't work as-is, but it may help you anyway:

Code: [Select]
mkdir -p MW4h/Dwarf\ Fortress
cd MW4h/Dwarf\ Fortress
tar --strip-components 1 -xjkf ../../df_34_11_linux.tar.bz2 --exclude raw
tar xkzf ../../dfhack-0.34.11-r3-Linux.tar.gz
cd ..
7z x -y ../MasterworkDF\ V4h.7z
cd Dwarf\ Fortress
cp ../../MasterworkDF_linux\ v3a3/Dwarf\ Fortress/stonesense/deplibs/libpng12.so.0 ./stonesense/deplibs/
cp ../../MasterworkDF_linux\ v3a3/Dwarf\ Fortress/stonesense/deplibs/libjpeg.so.62 ./stonesense/deplibs/
cp ../../UtilityPlugins/Linux/*.so ./hack/plugins
cp ../../itemsyndrome.lua ./hack/scripts
cp ../../diggingInvaders\ 0.5.7/diggingInvaders.plug.so ./hack/plugins
cp ../../macros/* data/init/macros
cp ../../unit-info-viewer.lua hack/scripts/gui
cp hack/ruby/ruby-autogen.rb hack/ruby/ruby-autogen.rb.orig
cp ../../dfhack-0.34.11-r3-Linux/hack/ruby/ruby-autogen.rb hack/ruby
cd data/init
sed -i -e 's/\[TRUETYPE:YES\]/\[TRUETYPE:NO\]/' init.txt
sed -i -e 's/\[WINDOWED:NO\]/\[WINDOWED:YES\]/' init.txt
cd macros
rm [A-Z]*
cd ../../..
sed -i -e '/^diggingInvaders/s/^/#/' dfhack.init
sed -i -e '/^cls/s/^/#/' dfhack.init
Logged

dementia

  • Bay Watcher
    • View Profile
Re: [linux] Install script help?
« Reply #2 on: March 03, 2014, 04:58:36 pm »

Here is the Masterwork direct download link.
http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4h.7z
« Last Edit: March 03, 2014, 05:00:25 pm by dementia »
Logged

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script help?
« Reply #3 on: March 05, 2014, 11:10:05 am »

Still having some minor problems with therapist, but the rest works fine on my system now.

Uploaded a messy recompiled version of therapist here: http://dffd.wimbli.com/file.php?id=8462 - did not manage to bundle the needed qt5 stuff though :/

edit: *updated* this seems to be working now, Therapist with bundled qt5 and all.
Code: [Select]
#!/bin/zsh
### Might not work in bash. Will definitely not work in sh.
#### to be more precise: Everything except the language patch should work in bash.

# try to guess if the user moved the script to a nice custom install dir - otherwise use default $HOME/DF_Masterwork
echo $PWD | grep -i "master\fortress\|DF\|dwarf" && installdir=$PWD || installdir="$HOME/DF_Masterwork"; echo $installdir

## *sigh* using archlinux package instead of official download now because it works better... uhm... on archlinux :D if someone knows a better alternative please post it
# 'http://www.bay12games.com/dwarves/df_34_11_linux.tar.bz2'
downloads=(
'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4i.7z'
'https://dl.dropboxusercontent.com/u/60111839/template.lng'
'http://dffd.wimbli.com/download.php?id=8067&f=dfhack-0.34.11-r4-Linux.7z'
'http://mirror.selfnet.de/archlinux/multilib/os/x86_64/dwarffortress-0.34.11-4-x86_64.pkg.tar.xz'
'http://dffd.wimbli.com/download.php?id=8462&f=Dwarf-Therapist-linux-x86_64-git-20140305-2.7z');
# this one seems to be obsolete / segfauly: 'https://dl.dropboxusercontent.com/u/60111839/game_data.ini'
# masterword df subdirectory
masterpath='MasterworkDF V4i'

# check if exists || create new
[ -d  "$installdir" ] || mkdir "$installdir"
cd $installdir || exit 0

# check if we have all libraries installed & complain
for dependancy in libgail libgailutil libgdk-x11-2.0 libGLU libSDL_image-1.2 libSDL_image-1.2 libsndfile libopenal;
do
ldconfig -p | grep $dependancy || { echo "you might need to install a package that provides the library $dependancy \n ctrl+c to abort, ENTER to continue anyways."; read nope; }
done;

# check if we have all programs installed & complain/quit
for dependancy in wget wine winetricks unzip zsh tar 7z;
do
[ -f "/usr/bin/$dependancy" ] || { echo "please install $dependancy, p.e.: 'sudo apt-get install $dependancy'"; exit 1; }
done;

#get and extract downloads
for download in $downloads
do
filename=$(basename "$download");
[ -f $filename ] || wget "$download";
case $filename in
(*.tar.bz2) tar xvjf "$filename" ;;
(*.pkg.tar.xz) tar xf "$filename" ;;
(*.zip) unzip "$filename" ;;
(*.7z) 7z x $filename ;;
esac

done;

# "unfuck" (see link) the linux download a little bit. Would probably be better to do the whole https://github.com/svenstaro/dwarf_fortress_unfuck thing but... eeeh... uhm... NOPE.
## This was a baaaaaad idea :D
## Using mysterious fixed libgraphics.so instead :3 now if only I know where I got that -.- oh, it was from /opt. Thx, archlinux :D
#IFS=$(echo -en "\n\b"); for file in $(grep -l "\.png" df_linux -ri | sort -u); do sed -i 's/\.png/.bmp/g' "$file"; done;

unset IFS;

# eeeeh... I give up. Leave it like that. :P now let's <just take the archlinux package and> make a mess
# old raws need to go though. Also some configs etc.
rm -v opt/df_linux/raw opt/df_linux/data  -r
cp opt/df_linux/* ./$masterpath/Dwarf\ Fortress/ -r

#patch language  in DF binary (masterworks skills etc)
echo "\n\nPATCHING LANGUAGE... this could take a while..."
IFS=$(echo -en "\n\b"); for line in $(cat template.lng | tr -d "\r" | grep "|.*|.*|" | grep -v "box"| grep -v "box"); do echo "$line" | IFS="|" read nope from to nope; to="${(r:${#from}:: :)${to[1,${#from}]}}"; [ "$from" != "$to" ] && { echo "#$from#=>#$to#"; sed -i "s|$from|$to|g" "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress";} done;

# and there goes dfhack...
cp dfhack-0.34.11-r4-Linux/* "$masterpath/Dwarf Fortress/" -r
chmod +x "./$masterpath/Dwarf Fortress/dfhack"

# shitty bundled version ruins everything, where did that even come from again?
#rm "./$masterpath/Dwarf Fortress/libs/libstdc++.so.6"
#It came from the official DF linux release, now using archlinux package ;)

md5=$(md5sum "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress" | sed "s/ .*//")

#patch new df binary md5sum into dfhack symbols.xml
sed -i "s#<md5-hash value='c55e1718c93247e702b35108c8d90e69'/>#\0\n<md5-hash value='$md5'/>#" "./$masterpath/Dwarf Fortress/hack/symbols.xml"

# wine stuff
export WINEARCH=win32
export WINEPREFIX=$installdir/.wine_df
winetricks -q dotnet40 corefonts

# configuration need desktop icon or something.
echo "
[Desktop Entry]
Name=DF Masterwork configuration (wine)
Exec=env WINEPREFIX=\"$installdir/.wine_df\" wine \"$installdir/$masterpath/Masterwork Dwarf Fortress.exe\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
" >| ~/Desktop/dfMasterwork_config.desktop

# df needs desktop icon or something too.
echo "
[Desktop Entry]
Name=DF Masterwork (native DFhack)
Exec=\'$installdir/$masterpath/Dwarf Fortress/dfhack\'
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_native.desktop

# therapist needs desktop icon or something too too.
echo "
[Desktop Entry]
Name=Dwarf Therapist (native, Splintermind Branch)
Exec=\'$installdir/Dwarf-Therapist/DwarfTherapist\'
Type=Application
StartupNotify=true
Path=$installdir/$masterpath/Dwarf-Therapist
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_Therapist_native.desktop

# therapist / patch checksum + stuff
new_weird_checksum_for_therapist="0x${md5:0:8}"
sed -i "s/0xe966ee88/$new_weird_checksum_for_therapist/g" Dwarf-Threapist/etc/memory_layouts/linux/v034.11.ini
cp "../$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/game_data.ini" ./Dwarf-Therapist/etc
cp "./$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/default_gridviews.dtg" ./Dwarf-Therapist/etc/default_gridviews.dtg

# sed -i <something something needcompiled therapist first>
grep -q 1 /proc/sys/kernel/yama/ptrace_scope || { echo "Ptrace Scope is currently set to 1. To run therapist, you need to 'sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist' (or run it as root) \n Trying now:" && sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist }

# change some default settings
## fullscreen makes your window manager sad.
sed -i "s/\[WINDOWED:NO\]/\[WINDOWED:YES\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"
## truetype crashes in build menu etc
sed -i "s/\[TRUETYPE:YES\]/\[TRUETYPE:NO\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"
## my mousewheel zoom was broken, this might help.
echo "32a33,34                                                               
> [SYM:0:Leftbracket]
> [BUTTON:0:5]
33a36,37
> [SYM:0:Rightbracket]
> [BUTTON:0:4]
" | patch $masterpath/Dwarf\ Fortress/data/init/interface.txt
« Last Edit: March 07, 2014, 04:16:59 pm by yaymeh »
Logged

adanos

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #4 on: March 09, 2014, 05:56:02 pm »

Hey, how can I use this script under my distro - elementaryOS? I am zsh's user. Can You prepare step-by-step guide with commands?
When I am using just a simple command zsh ./script.zsh I got strange log:
http://pastebin.com/PkuxkUdS

ps. ofc I have tar.

Regards
Logged

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #5 on: March 10, 2014, 05:03:12 am »

Oh, didn't know that some distributions still put the binaries in other places than /usr/bin...?

Checking all PATH instead...:

( Everything still untested, please keep that in mind and be careful if you want to try! )
Code: [Select]
#!/bin/zsh
### Might not work in bash. Will definitely not work in sh.
#### to be more precise: Everything except the language patch should work in bash.

# try to guess if the user moved the script to a nice custom install dir - otherwise use default $HOME/DF_Masterwork
echo $PWD | grep -qi "master\fortress\|DF\|dwarf" && installdir=$PWD || installdir="$HOME/DF_Masterwork";

# warn
{ echo "Installing DF to: $installdir \n ctrl+c to abort, ENTER to continue."; read nope; }

cp -v "$0" "$installdir/install_DF_Masterwork"

## only 64bit atm
[[ $(uname -m) == "x86_64" ]] || { echo "There is no precompiled 32-bit version of bundled libraries and Therapist available at the moment - only wine/windows version of DF might work \n ctrl+c to abort, ENTER to continue anyways."; read nope; }

## *sigh* using archlinux package instead of official download now because it works better... uhm... on archlinux at least, that is :D if someone knows a better alternative please post it
# 'http://www.bay12games.com/dwarves/df_34_11_linux.tar.bz2'
## Using splintermind's git instead of 'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4i.7z' for bugfixes
downloads=(
'https://dl.dropboxusercontent.com/u/60111839/template.lng'
'http://dffd.wimbli.com/download.php?id=8067&f=dfhack-0.34.11-r4-Linux.7z'
'http://mirror.selfnet.de/archlinux/multilib/os/x86_64/dwarffortress-0.34.11-4-x86_64.pkg.tar.xz'
'http://dffd.wimbli.com/download.php?id=8462&f=Dwarf-Therapist-linux-x86_64-git-20140305-2.7z');
# this one seems to be obsolete / segfauly: 'https://dl.dropboxusercontent.com/u/60111839/game_data.ini'
# masterword df subdirectory
masterpath='masterwork-dwarf-fortress'

# check if exists || create new
[ -d  "$installdir" ] || mkdir "$installdir"
cd $installdir || exit 0

# check if we have all libraries installed & complain
for dependancy in libgail libgailutil libgdk-x11-2.0 libGLU libSDL_image-1.2 libSDL_image-1.2 libsndfile libopenal;
do
ldconfig -p | grep -q $dependancy || { echo "you might need to install a package that provides the library $dependancy \n ctrl+c to abort, ENTER to continue anyways."; read nope; }
done;

# check if we have all programs installed & complain/quit
for dependancy in wget wine winetricks unzip zsh tar 7z dos2unix git;
do
which "$dependancy" || { echo "please install $dependancy, p.e.: 'sudo apt-get install $dependancy'"; exit 1; }
done;

#get and extract downloads
for download in $downloads
do
filename=$(basename "$download");
[ -f $filename ] || wget "$download";
case $filename in
(*.tar.bz2) tar xvjf "$filename" ;;
(*.pkg.tar.xz) tar xf "$filename" ;;
(*.zip) unzip "$filename" ;;
(*.7z) 7z x $filename ;;
esac

# get DF from git...
[ -d $masterpath ] || git clone https://github.com/splintermind/masterwork-dwarf-fortress.git
## ... or update
cd $masterpath || { echo "WTF!? can't cd into $masterpath"; exit 1; }
git pull || { echo "git pull failed in $masterpath"; exit 1; }
## THROW AWAY ALL CHANGES
git reset --hard
# hey, I don't know how git works, better do that one again :P
git pull || { echo "git pull failed in $masterpath"; exit 1; }
cd $installdir


done;

# "unfuck" (see link) the linux download a little bit. Would probably be better to do the whole https://github.com/svenstaro/dwarf_fortress_unfuck thing but... eeeh... uhm... NOPE.
## This was a baaaaaad idea :D
## Using mysterious fixed libgraphics.so instead :3 now if only I know where I got that -.- oh, it was from /opt. Thx, archlinux :D
#IFS=$(echo -en "\n\b"); for file in $(grep -l "\.png" df_linux -ri | sort -u); do sed -i 's/\.png/.bmp/g' "$file"; done;

unset IFS;

# eeeeh... I give up. Leave it like that. :P now let's <just take the archlinux package and> make a mess
# old raws need to go though. Also some configs etc.
rm opt/df_linux/raw opt/df_linux/data  -r
cp -v opt/df_linux/* ./$masterpath/Dwarf\ Fortress/ -r

#patch language  in DF binary (masterworks skills etc)
echo "\n\nPATCHING LANGUAGE... this could take a while..."
IFS=$(echo -en "\n\b"); for line in $(cat template.lng | tr -d "\r" | grep "|.*|.*|" | grep -v "box\|Tanner\|Cof"); do echo "$line" | IFS="|" read nope from to nope; to="${(r:${#from}:: :)${to[1,${#from}]}}"; [ "$from" != "$to" ] && { echo -n "#$from#=>#$to# //// "; sed -i "s|$from|$to|g" "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress";} done;

# and there goes dfhack...
cp -v dfhack-0.34.11-r4-Linux/* "$masterpath/Dwarf Fortress/" -r
chmod -v +x "./$masterpath/Dwarf Fortress/dfhack"

# shitty bundled version ruins everything, where did that even come from again?
#rm -v "./$masterpath/Dwarf Fortress/libs/libstdc++.so.6"
#It came from the official DF linux release, now using archlinux package ;)

md5=$(md5sum "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress" | sed "s/ .*//")

#patch new df binary md5sum into dfhack symbols.xml
sed -i "s#<md5-hash value='c55e1718c93247e702b35108c8d90e69'/>#\0\n<md5-hash value='$md5'/>#" "./$masterpath/Dwarf Fortress/hack/symbols.xml"

# wine stuff
export WINEARCH=win32
export WINEPREFIX=$installdir/.wine_df
winetricks -q dotnet40 corefonts

# therapist / patch checksum + stuff
new_weird_checksum_for_therapist="0x${md5:0:8}"
sed -i "s/0xe966ee88/$new_weird_checksum_for_therapist/g" Dwarf-Therapist/etc/memory_layouts/linux/v034.11.ini
cp -v "./$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/game_data.ini" "./Dwarf-Therapist/etc"
cp -v "./$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/default_gridviews.dtg" "./Dwarf-Therapist/etc/default_gridviews.dtg"

# configuration need desktop icon or something.
echo "
[Desktop Entry]
Name=DF Masterwork configuration (wine)
Exec=env WINEPREFIX=\"$installdir/.wine_df\" wine explorer /desktop=DFMWconfig,$(xrandr -q | grep "*" | sed "s/ *\([^ ]*\) .*/\1/") \"$installdir/$masterpath/Masterwork Dwarf Fortress.exe\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
" >| ~/Desktop/dfMasterwork_config.desktop

# df needs desktop icon or something too.
echo "
[Desktop Entry]
Name=DF Masterwork (native DFhack)
Exec=\'$installdir/$masterpath/Dwarf Fortress/dfhack\'
Type=Application
StartupNotify=false
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_native.desktop

# therapist needs desktop icon or something too too.
echo "
[Desktop Entry]
Name=Dwarf Therapist (native, Splintermind Branch)
Exec=\'$installdir/Dwarf-Therapist/DwarfTherapist\'
Type=Application
StartupNotify=false
Path=$installdir/Dwarf-Therapist
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=false
" >| ~/Desktop/dfMasterwork_Therapist_native.desktop

# soundsense needs desktop icon or something too too too.
echo "
[Desktop Entry]
Name=Soundsense (native)
Exec=\'$installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh\'
Type=Application
StartupNotify=false
Path=$installdir/Dwarf-Therapist
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_SOUNDSENSE.desktop

# change some default settings
## fullscreen makes your window manager sad.
sed -i "s/\[WINDOWED:NO\]/\[WINDOWED:YES\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"
## truetype crashes in build menu etc
sed -i "s/\[TRUETYPE:YES\]/\[TRUETYPE:NO\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"

##### This seems to have been fixed upstream, don't need those any more:
#### my mousewheel zoom was broken, this did help.
###echo "32a33,34                                                               
###> [SYM:0:Leftbracket]
###> [BUTTON:0:5]
###33a36,37
###> [SYM:0:Rightbracket]
###> [BUTTON:0:4]
###" | patch $masterpath/Dwarf\ Fortress/data/init/interface.txt

# soundsense start script is broken
dos2unix $installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh
chmod +x $installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh

# Therapist needs ptrace
grep -q 1 /proc/sys/kernel/yama/ptrace_scope || { echo "\n\n\nGlobal Ptrace Scope is currently set to 1. To run therapist, you need to 'sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist' (or run it as root) \n Trying now:" && sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist }
« Last Edit: March 12, 2014, 01:14:50 pm by yaymeh »
Logged

jellsprout

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #6 on: March 13, 2014, 12:40:57 pm »

I tried to play this again, but when I try to start up Masterwork Dwarf Fortress.exe in Wine, it does nothing. If I try it in Terminal, I get the following messsage:

Code: [Select]
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"configSections" in state 1
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"sectionGroup" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"section" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"system.diagnostics" in state 1
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"sources" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"source" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"listeners" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"add" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"switches" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"add" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"sharedListeners" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"add" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"userSettings" in state 1
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"MasterworkDwarfFortress.My.MySettings" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"setting" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"value" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"runtime" in state 1
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"assemblyBinding" in state 3
fixme:mscoree:ConfigFileHandler_startElement Unknown element L"probing" in state 3
fixme:wincodecs:JpegDecoder_Frame_GetResolution (0x1fe579c,0x322ee0,0x322ee8): stub
fixme:gdiplus:GdipDrawLineI graphics object has no HDC
fixme:gdiplus:GdipDrawLineI graphics object has no HDC

Unhandled Exception: System.InvalidOperationException: WinForms_SeeInnerException ---> System.NullReferenceException: Object reference not set to an instance of an object
  at System.Windows.Forms.TextRenderer.MeasureTextInternal (IDeviceContext dc, System.String text, System.Drawing.Font font, Size proposedSize, TextFormatFlags flags, Boolean useMeasureString) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TextRenderer.MeasureText (System.String text, System.Drawing.Font font) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.get_OrbBounds () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.UpdateRegions (System.Drawing.Graphics g) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.UpdateRegions () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.set_OrbStyle (RibbonOrbStyle value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Ribbon:set_OrbStyle (System.Windows.Forms.RibbonOrbStyle)
  at MasterworkDwarfFortress.MainForm.InitializeComponent () [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) MasterworkDwarfFortress.MainForm:InitializeComponent ()
  at MasterworkDwarfFortress.MainForm..ctor () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at MasterworkDwarfFortress.My.MyProject+MyForms.Create__Instance__[MainForm] (MasterworkDwarfFortress.MainForm Instance) [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyProject+MyForms.get_MainForm () [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyApplication.OnCreateMainForm () [0x00000] in <filename unknown>:0
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () [0x00000] in <filename unknown>:0
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyApplication.Main (System.String[] Args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidOperationException: WinForms_SeeInnerException ---> System.NullReferenceException: Object reference not set to an instance of an object
  at System.Windows.Forms.TextRenderer.MeasureTextInternal (IDeviceContext dc, System.String text, System.Drawing.Font font, Size proposedSize, TextFormatFlags flags, Boolean useMeasureString) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.TextRenderer.MeasureText (System.String text, System.Drawing.Font font) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.get_OrbBounds () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.UpdateRegions (System.Drawing.Graphics g) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.UpdateRegions () [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Ribbon.set_OrbStyle (RibbonOrbStyle value) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Ribbon:set_OrbStyle (System.Windows.Forms.RibbonOrbStyle)
  at MasterworkDwarfFortress.MainForm.InitializeComponent () [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) MasterworkDwarfFortress.MainForm:InitializeComponent ()
  at MasterworkDwarfFortress.MainForm..ctor () [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  --- End of inner exception stack trace ---
  at MasterworkDwarfFortress.My.MyProject+MyForms.Create__Instance__[MainForm] (MasterworkDwarfFortress.MainForm Instance) [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyProject+MyForms.get_MainForm () [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyApplication.OnCreateMainForm () [0x00000] in <filename unknown>:0
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun () [0x00000] in <filename unknown>:0
  at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run (System.String[] commandLine) [0x00000] in <filename unknown>:0
  at MasterworkDwarfFortress.My.MyApplication.Main (System.String[] Args) [0x00000] in <filename unknown>:0

I have Mono installed in Wine and I have the latest .net frameworks. This happens even on a clean, unedited Windows version download. Anybody have any idea how to fix this?
Logged
"Having been equipped with tracking collars so their migration and survival in the wild can be measured, the young Sea Serpent is released into the wild.  It is hoped that this captive breeding program will boost their terribly low population numbers and eventually see them removed from the endangered species list..."

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #7 on: March 13, 2014, 04:09:02 pm »

I'm slightly sleepy already, but thaaaat doesn't look like dotnet40, that looks like mono trying to pretend it's dotnet40.

Maybe you better take another look at the winehq guides for dotnet40 and  try a different application that runs only with dotnet40, just to be sure.
Logged

jellsprout

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #8 on: March 14, 2014, 08:09:44 am »

Turns out it dotnet40 didn't install properly the first time. I reinstalled it and everything works fine now. Thanks for your help.
Logged
"Having been equipped with tracking collars so their migration and survival in the wild can be measured, the young Sea Serpent is released into the wild.  It is hoped that this captive breeding program will boost their terribly low population numbers and eventually see them removed from the endangered species list..."

adanos

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #9 on: March 14, 2014, 09:39:28 am »

I can't use this script, but I'm trying to do it step by step:

Actually I have got problem with updating dfhack, what is the difference between release 3 and 4? When I am using r3 there's no problem, df starts. But after update, I have got some problems:

Code: [Select]
Unicorn% ./dfhack
./libs/Dwarf_Fortress: /home/typh00nz/Pobrane/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/typh00nz/Pobrane/df_linux/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /home/typh00nz/Pobrane/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
-e

After deleting unnecessary lib I reduced this log to something like that:
Quote
Unicorn% ./dfhack           
./libs/Dwarf_Fortress: /usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by ./hack/libdfhack.so)
-e

Unicorn% ls ./libs/
Dwarf_Fortress  libgcc_s.so.1  libgraphics.so  libopenal.so  libsndfile.so
Unicorn%

My question is, do I really need release 4 of the dfhack for preparing masterwork compilation?

ps. I have libstdc++6-4.4-dev
Logged

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #10 on: March 14, 2014, 10:07:22 am »

Nope, you don't need it. I updated it only because some scripts didn't work with r3 - but those were mostly for ingame debugging if I remember correctly. Normal gameplay should work fine with r3.

I don't understand how this is a dfhack problem though... isn't that lib you're having trouble with the one from the official dwarf fortress download which I deleted in the script because it didn't work on modern linux? My installation worked fine with the native libstdc++.so.5.0.7 I have on my system after I deleted the bundled one. Maybe it needs the 32bit version... do you have that installed too?
Logged

adanos

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #11 on: March 14, 2014, 11:24:59 am »

Yes, According to comment

Code: [Select]
# shitty bundled version ruins everything, where did that even come from again?
#rm -v "./$masterpath/Dwarf Fortress/libs/libstdc++.so.6"
#It came from the official DF linux release, now using archlinux package ;)

I deleted this lib, with the idea that would be better if I'll use native lib from my linux.. But there's a problem - game can't find though it's installed.

I am using 64bit Elementary OS "Luna"
Logged

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #12 on: March 14, 2014, 12:22:11 pm »

The question is: Do you have the lib32 version installed too? Or just the 64 bit one? It should look about like this:
Code: [Select]
$  ldconfig -p | grep stdc
libstdc++.so.6 (libc6,x86-64) => /usr/lib/libstdc++.so.6
libstdc++.so.6 (libc6) => /usr/lib32/libstdc++.so.6
libstdc++.so.5 (libc6,x86-64) => /usr/lib/libstdc++.so.5
libstdc++.so (libc6,x86-64) => /usr/lib/libstdc++.so
libstdc++.so (libc6) => /usr/lib32/libstdc++.so
Logged

adanos

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #13 on: March 14, 2014, 12:28:23 pm »

Code: [Select]
Unicorn% ldconfig -p | grep stdc
libstdc++.so.6 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (libc6) => /usr/lib/i386-linux-gnu/libstdc++.so.6
libstdc++.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libstdc++.so.5
libstdc++.so.5 (libc6) => /usr/lib/i386-linux-gnu/libstdc++.so.5
Unicorn%

As I see, yes. But for some reasons game is not able to recognize required file. Am I right?
Logged

yaymeh

  • Bay Watcher
    • View Profile
Re: [linux] Install script
« Reply #14 on: March 14, 2014, 01:02:40 pm »

Not really... something is weird there, maybe take a closer look.

This is how mine looks:
Code: [Select]
$ ldd hack/libdfhack-client.so
ldd: warning: you do not have execution permission for `hack/libdfhack-client.so'
linux-gate.so.1 (0xf77d1000)
libprotobuf-lite.so => not found
libpthread.so.0 => /usr/lib32/libpthread.so.0 (0xf771d000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf7706000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf761d000)
libm.so.6 => /usr/lib32/libm.so.6 (0xf75d6000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf75bc000)
libc.so.6 => /usr/lib32/libc.so.6 (0xf740f000)
/usr/lib/ld-linux.so.2 (0xf77d2000)
And if I look at the dfhack start script, I can see there they are manually adding something to the library path, namely here:
Code: [Select]
$ grep LD_LIB -i dfhack
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack"

If you add what's in your start script to your ldd line, you should see where the problem is.
Code: [Select]
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack" ldd hack/libdfhack.so
ldd: warning: you do not have execution permission for `hack/libdfhack.so'
linux-gate.so.1 (0xf7706000)
libprotobuf-lite.so => ./hack/libprotobuf-lite.so (0xf71a6000)
liblua.so => ./hack/liblua.so (0xf716a000)
librt.so.1 => /usr/lib32/librt.so.1 (0xf7129000)
libdl.so.2 => /usr/lib32/libdl.so.2 (0xf7124000)
libpthread.so.0 => /usr/lib32/libpthread.so.0 (0xf7107000)
libz.so.1 => /usr/lib32/libz.so.1 (0xf70f0000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7007000)
libm.so.6 => /usr/lib32/libm.so.6 (0xf6fc1000)
libgcc_s.so.1 => /usr/lib32/libgcc_s.so.1 (0xf6fa7000)
libc.so.6 => /usr/lib32/libc.so.6 (0xf6df9000)
/usr/lib/ld-linux.so.2 (0xf7707000)
Now, in my case, all the libs are found now and still only the one previously "not found" is bundled with dfhack... the rest is native.

Also watch out, if any of those get overridden by LD_PRELOAD:
Code: [Select]
% grep LD_PRELOAD -riI
hack/Compile.html:<p>On Linux, DFHack acts as a library that shadows parts of the SDL API using LD_PRELOAD.</p>
dfhack:# changed to properly set LD_PRELOAD so as to run DFHACK.
dfhack:    echo "set environment LD_PRELOAD=./hack/libdfhack.so" > gdbcmd.tmp
dfhack:    LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress "$@"
dfhack:    LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress "$@"
dfhack:    LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress "$@"
dfhack:    setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress "$@"
So, the only thing preloaded is libdfhack itsself - my wild guess would be  that that means if yours looks the same and still gets your errors such as those above, that dfhack and your native libs were compiled with incompatible uhm... options or versions or something (you know... all that gcc stuff... that breaks if you update the core stuff and change flags + things and recompile only part of your system... uhm... no idea how all of that works -.-")


edit: Uhm, by the way - if you continue with DF from the official download, you might end up having to work around some issues with libpng that personally I didn't find very much fun to tinker with.
« Last Edit: March 14, 2014, 01:11:45 pm by yaymeh »
Logged
Pages: [1] 2 3 4