Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Dwarf fortress on read-only file system  (Read 1796 times)

RazZziel

  • Escaped Lunatic
    • View Profile
Dwarf fortress on read-only file system
« on: March 29, 2013, 12:45:49 pm »

Hi there,

I'm trying to package Dwarf Fortress as an AppImage, which is a read-only, auto-executable container that lets you play the game without installing nor uncompressing.

The process is straightforward, but the game fails with the error "Main index file missing/corrupted.  The file "index" must be in the "data" folder.  Make sure DF decompressed into its folders properly.". This file is actually perfectly accesible, the only problem is it's inside the AppImage, which is read-only, so the open("data/index", O_RDWR|O_LARGEFILE) call fails, and retuns -1 EROFS (Read-only file system). Is there any way to workaround to this? Would is data/index actually written to, or would O_RDWR suffice?
Logged

Lasander

  • Bay Watcher
    • View Profile
Re: Dwarf fortress on read-only file system
« Reply #1 on: March 31, 2013, 03:23:52 pm »

Dwarf Fortress doesn't run on a flash drive all by itself?  I never had to "install" it as everything runs from its directory.  Also, doesn't Dwarf Fortress need to be able to create saves and generate worlds?  I don't see how you can force it to be read-only plus have a playable game since it needs to modify saves and create worlds.
Logged
Worship!

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Dwarf fortress on read-only file system
« Reply #2 on: April 01, 2013, 04:46:18 pm »

I've been able to run DF off of a USB keychain drive. The game runs very smoothly, only showing a diffrence in saving and loading.

As for actually trying to run it on the file system directly I'm afraid it's not going to work for everything.  Some programs expect unhindered access to their own data files.  And if the data files are read-only that is not 'unhindered' access.  And as Lasander said, it's going to need to save data at some point anyway, if DF has nothing to write to, that won't happen.  In fact you may find that an issue with a lot of programs.

I would recommend obtaining some portable media drive and keeping DF on that.  As I mentioned at the beginning, DF has no qualms at all about operating off the OS drive, and it's relatively small until you start packing in a dozen or so saves as well.
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

RazZziel

  • Escaped Lunatic
    • View Profile
Re: Dwarf fortress on read-only file system
« Reply #3 on: April 09, 2013, 04:57:44 pm »

Ok, if it does modify its data files by design it's alright, I only wanted to know if it was that the case or if O_RDWR could be safely avoided.

Regarding modifications of data files, actually most applications and games for Linux and modern Windows use a read-only data directory and target disk writes only on the user's home directory, ~/.config/(...) or ~/.local/(...) in the case of Linux, as it enables greater flexibility for package management and application upgrade and better multi-user support. Some applications of course (like df) are not designed that way, but it can be emulated using i.e. unionfs if needed.
Logged

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Dwarf fortress on read-only file system
« Reply #4 on: April 09, 2013, 05:06:21 pm »

Yea yer right, I'm used to the older days I guess, back when they kept all their stuff in their own directory.  I see programs putting files into the user directories all the time now, and I forgot about them.

I never was a fan of that method, if I want to access files for a program it seems silly to me to have to check 2 completely separate locations for what I'm looking for.  But I'm sure there are logical reasons to it.
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

RazZziel

  • Escaped Lunatic
    • View Profile
Re: Dwarf fortress on read-only file system
« Reply #5 on: April 14, 2013, 11:04:00 am »

I finally used the unionfs trick, packaged DwarfFortress as an AppImage and uploaded it to http://www.portablelinuxgames.org/

As df is already portable, the only advantage that this package has is that it includes every dependency needed to run the game (sdl, libpng15, etc). It's packaged using ArchLinux libs, so it won't work on old distros (i.e. Ubuntu 10.04), but I'm upload another package including older libraries
Logged