Useful bits for GOG Linux Users

Over the last little while, I’ve written or researched a few little things to make my life as a Linux-using player of GOG.com games a bit simpler. As such, I thought I’d share them.

1. GOG.com – Updated Thread Count in Title

This Greasemonkey script adds the unread count for your favourited forum threads to the favicon so you can select “Pin Tab” and have an alternative to manually polling for new replies.

It’s not RSS, but it still takes a load off your mind.

2. find_broken_symlinks.sh

While not specifically focused on GOG.com or even gaming, this multi-mode script has proven very useful.

Modes of operation:
--all-external
  Show all symlinks targeted outside the current directory
--all-home
 Show all symlinks targeted inside /home
--all-my-home
 Show all symlinks targeted inside the current user's home directory
(anything else)
 Show all broken symlinks originating inside the current directory

I originally wrote it because:

  • Some of my Linux-native ports store their save files in the game’s application folder
  • I symlinked the save files into my homedir so nightly backups cover them
  • My games folder is on an external USB drive
  • Supposing I ever want to let a friend try the games on their computer, I’ll need a way to identify the folders I need to mkdir -p to unbreak the symlinks.

Caution: It’s a bit of a hack and will get confused by folder/filenames containing newlines. (Doing it properly and efficiently is very awkward and painful without reinventing /usr/bin/find in something with more support for structured data than shell scripting.)

3. aptitude search ~o
A quick explanation of “aptitude” for Ubuntu users:

  1. Debian invented apt-get
  2. apt-get didn’t get the lovin’ it deserved
  3. aptitude was invented as an apt-get that doesn’t suck and Debian decided to include it in the base install.
  4. The more popular aspects of aptitude eventually got added to apt-get
  5. Ubuntu decided that apt-get was enough and you have to sudo apt-get install aptitude if you want it.

Basically, aptitude is apt-get on steroids.

What does aptitude search ~o do? It lists all installed packages which aren’t backed by a repository. (Packages you installed using dpkg -i or gdebi, packages which are still installed after you removed the PPA, etc.)

I used it to identify which Humble Bundle games had been installed as .debs so I could replace them with tarballs and move them to my new games drive.

UPDATE #1 …

4. lgogd_uri

A simple GTK+ GUI for lgogdownloader that I wrote so Linux users could take advantage of GOG’s gogdownloader:// URIs.

5. makeself_safeextract

A tool for unpacking GOG’s new MojoSetup-based Linux installers without running any 3rd-party code.

(eg. Good for scripting the extraction of DOSBox- or ScummVM-based games for use with your non-x86 DOSBox or ScummVM install.)

Includes a proof-of-concept script demonstrating how to automatically download a game’s Linux build and then convert the installer to a cleaned-up Zip file. (Since MojoSetup already uses a Zip file internally to store the game so the file permissions are already constrained to what Zip’s support for POSIX permissions can represent.)

UPDATE #2 …

6. How to use overlayfs to force games to separate out stuff you want to back up

While many native Linux games are well-behaved and cleanly separate out their save files, some games (some native, some DOSBox-wrapped DOS games, and some in Wine prefixes rendered self-contained to keep games from scribbling all over $HOME) aren’t so helpful.

Rather than fighting with symlinks and permissions, the simple, easy, and proper solution is to use an overlay filesystem so that any changes made after installation will be redirected into a folder covered by your backup system and the game won’t even realize anything’s changed.

Historically, Linux has had various overlay filesystems, like unionfs and aufs, but they haven’t made it into the mainline kernel. UnionFS (in Ubuntu patchsets since 11.10 and mainlined in kernel 3.18) changes that.

Just cook up an OverlayFS mount command like this and you’re ready to go.

sudo mount -t overlayfs -o lowerdir=/mnt/buffalo_ext/games_inst,upperdir=~/.local/share/games/ overlayfs /mnt/buffalo_ext/games_play

(lowerdir is where you install your games to. upperdir is where files created/modified after install will end up. That last path on the line is where you run your games from.)

CC BY-SA 4.0 Useful bits for GOG Linux Users by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.

All comments are moderated. If your comment is generic enough to apply to any post, it will be assumed to be spam. Borderline comments will have their URL field erased before being approved.