Other Commentary

Shell script to copy addon files off my Steam Deck

After all the primary housekeeping I did in Desktop Mode on my new Steam Deck, there was one more problem I wanted to solve: a better way to copy the SavedVariables directory files off the Deck and into the equivalent folder on my MacBook.

For those of you who don’t play Elder Scrolls Online, or who do play but don’t play with addons, the SavedVariables directory is one of the directories underneath ESO’s standard install location. On my Mac, ESO gets plunked into the Documents directory, so it’s very easy to find. In that directory is a subdirectory called “live”, and underneath that is “SavedVariables”.

The SavedVariables directory is where a bunch of user-specific stuff gets saved for how you’ve configured your game. Including any specific setups you’ve done for any addons you’re running.

Since I typically play on Steam Deck the majority of the time but also semi-regularly play on computer, I wanted a way to keep the SavedVariables directories in both places in sync.

Previous solutions

There are a few ways I’ve dealt with copying files off the Steam Deck up till now.

  1. Dropbox. I installed Dropbox on my original Steam Deck, and set Steam to save uncompressed copies of screenshots to a particular subdirectory of the Dropbox location on the device. I also told Dropbox to auto-launch every time I went into Desktop Mode. Result: all screenshots taken on the Deck synced up to my computer automatically, where I could then easily grab them for posts on this blog. I have replicated this same setup on the new Deck.
  2. Warpinator. When I got the original Deck, I saw Warpinator and its Windows cousin Winpinator mentioned a lot, as a solution for transferring files back and forth between a Deck and a PC. I did try this, when I still had Windows 10 running on my potato laptop, so I can confirm that it works if you don’t happen to have a Dropbox account.
  3. Samba connection to a server on our house LAN. Dara set up a dedicated network share on our NAS called “stagingarea”, whose entire purpose is to be a temporary drop location for files you want to move around. This works just as well as Dropbox for my purposes, with the added bonus of connecting only to a house server vs. anything external.

However, none of these really solve the problem the way I wanted to solve it, which is to say, “I want something that will copy files out of this specific location on the Deck and put them right into the equivalent location on the Mac, without my having to copy and paste anything to an intermediate location”.

Essentially, I wanted to keep the SavedVariables directory in both places in sync. So I started casting around for other ways to solve this problem.

Syncthing

Syncthing came up pretty quickly in search results when I started hunting. And this certainly seemed promising, with what sounded like exactly the functionality I wanted. Except that when I started digging into the functionality, from what I saw, it only synchronized things in a specific dedicated directory and its subdirectories. Which was not quite what I wanted.

(Editing to add: I’ve now been informed on Mastodon that Syncthing does not in fact restrict you to a given directory structure, and that’s good to know. I’ll keep this in mind for later. Right now, from what I’ve seen on the Deck’s Discover app, the syncthing wrapper available to install there doesn’t have very good reviews. But if functionality improves there, I may consider this an option in the future.)

And then I realized I was overthinking the problem.

SCP and SSH to the rescue!

Because I already had ways to do what I wanted, built right into Linux and MacOS. Namely, scp, the command to do secure copies between any two locations that can take SSH connections. And I’d already just set up the Deck to allow it to take SSH connections from my Mac.

Which meant therefore I could also call scp to move files around, too.

So I wrote myself up a little bash script, which turned out looking like this:

#!/bin/bash

MAC_ESO_SAVEDVARS_DIR=/Users/annathepiper/Documents/Elder\ Scrolls\ Online/live/SavedVariables
DECK_ESO_SAVEDVARS_DIR=/home/deck/.steam/steam/steamapps/compatdata/306130/pfx/drive_c/users/steamuser/Documents/Elder\ Scrolls\ Online/live/SavedVariables

cd "$MAC_ESO_SAVEDVARS_DIR"

scp "deck@steamdeck:$DECK_ESO_SAVEDVARS_DIR/*" .

In order for this to work as written, I had to have one other piece in place: an SSH key which would allow my Mac to connect to the Steam Deck without my having to enter a password. I’d already set up a key a long time ago to connect to our main house servers, so I just re-used that same key to connect to the Deck. All this required was for me to copy the public portion of the key off the Mac and over into the .ssh directory on the Deck.

Making it clickable

Once I had that script created, that meant I could then run it any time I liked from the command line. But that would also require me to do things like adding the location of the script to my command line path, not to mention actually opening the command line. And I wanted to save as many steps as possible here.

I’d originally thought about maybe creating a cron job to run the script automatically once a day. Cron jobs, if you’re not familiar with Linux, are basically task schedulers. And since macOS at the command line level is essentially Linux, I do have cron functionality Mac-side.

I could not, however, find any signs that cron jobs were available on the Deck without my having to job through a bunch more hoops.

At which point I realized, I was still overthinking it.

Because I didn’t really need this to be a regularly scheduled process. Having it launchable on demand would be fine. My usual use case for this would be, any time where I made a change to my addon configs in ESO on the Deck, and wanting to quickly copy that over to the Mac. Or vice-versa.

This meant that just having something I could click on to run the script would do nicely. And macOS even has an easy way to tell it that a given file is a thing I can click on from the Finder! Namely, giving the file a name that ends in .command.

So I called my script “ESO AddOn Files Sync.command”. And then I made an alias Ia.k.a. a shortcut) for it, and plunked that alias down into a directory I already had set up on my Dock–the same directory where I have a couple other useful .command files for ESO.

Result: an icon I can click on to pull my SavedVariables files off the Deck and over onto the Mac.

“I want to use a script like this, but my computer runs Windows! Help?”

Not gonna lie, this is a very niche problem I’m solving here. Going by what I’ve observed of the other members of my ESO guilds, Mac users just aren’t as common as PC users in the ESO player base. And Steam Deck users are pretty damned thin on the ground, too. Players who use both a Mac and a Steam Deck? So far, I’m the only one I know of. 😀

But this kind of a solution could still be implemented in a scenario where a player has ESO on a Windows box as well as on a Steam Deck. Or, a Windows box and a Linux box. Or, a Steam Deck and a Linux box–which is essentially two Linux boxes, given that SteamOS is a Linux derivative!

A common thread through all of these scenarios would be, you’d still need to set up SSH on both the computer and the Steam Deck so they can connect to each other without a password. And you’d need to be comfortable with creating script files on Windows and/or Linux, depending on your specific scenario.

It’s been a while since I’ve had to make scripts on a Windows machine. But where I’d start would be either a) finding out how to make a shell script in PowerShell, which comes with Windows by default, or b) turning on the Windows Linux subsystem. My preference would lean to b) here, just because that basically hands me a Linux style command terminal and lets me do all the same things I’d do on a Linux machine anyway. Your mileage may vary here, depending on if you’re more familiar with PowerShell or Linux.

References

Some potentially useful links to get you started, if you want to try this kind of shell scripting on your own devices. Any questions, let me know!

As Angela Highland, Angela is the writer of the Rebels of Adalonia epic fantasy series with Carina Press. As Angela Korra'ti, she writes the Free Court of Seattle urban fantasy series. She's also an amateur musician and devoted fan of Newfoundland and Quebecois traditional music.