Skip to content

Commit

Permalink
Merge pull request #50 from ValShaped/v0.5.0
Browse files Browse the repository at this point in the history
Rwfus v0.5.0
  • Loading branch information
ValShaped authored Jun 24, 2024
2 parents 4ed69c0 + ee93022 commit 15904c2
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 196 deletions.
48 changes: 26 additions & 22 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Important Note: You'll probably want [Nix][nix-inst] instead.

Nix is a ridiculously powerful, declarative package manager that forces packages to play nice with each other. That includes the system glibc. [You can learn about nix here][nixtutor], and [you can check if your package is available here][nix-pkgs].

SteamOS 3.5 and above have a built-in overlay for the `/nix` directory, and Nix is designed to work with (effectively) immutable root filesystems, like those found on the Steam Deck. It's a purpose-built solution.

Rwfus is not tested with all packages in the SteamOS/Arch repositories, and many of them will install to locations not covered by the overlay. If you just need to install Yakuake, but don't want to unlock your Deck, this'll do the trick. If you're looking for anything more complex, I suggest Nix.

## Rwfus: Read-Write OverlayFS for your Steam Deck!
---

Expand All @@ -9,30 +17,23 @@ Directories covered in a default installation:
| /etc/pacman.d | `pacman` configuration |
| /usr | Programs and libraries |
| /var/cache/pacman | Package cache |
| /var/lib/pacman | Package metadata |

### * Jank warning

Due to the way Valve's firmware updates work, doing `pacman -S[y[y]]u` at any time will lead to complications when the next firmware update is installed. I highly advise avoiding `-Su`, `-Syu`, and `-Syyu` altogether on a Steam Deck with read-only rootfs. It may lead to bad behavior.

Rwfus is, right now, a proof of concept (hence the 0.x version number, and being written in Bash.)
I made it to install a couple user-mode packages (nano-syntax-highlighting and yakuake specifically.)
It is not production-ready software, and in using Rwfus, you accept that I am not liable if your Deck catches fire.

Rwfus will allow you to install *any* package, but not everything will let your Deck survive an update. In particular, `glibc` will crash your Deck after an update, requiring the SteamOS recovery image and some knowledge of Linux and/or Rwfus' internals to fix.
Due to the way Valve's firmware updates work, doing `pacman -S[y[y]]u` at any time will leave your system in a partially updated state. This may cause crashes, hangs, boot-loops, or other undesired behavior, and will be annoying to fix. If you run into this issue, you can disable the Rwfus service from the recovery console with `systemctl disable rwfusd.service`

### Installation:

1. `git clone https://github.com/ValShaped/rwfus.git`
1. Download the latest release from GitHub's [Releases][releases] page
2. `cd rwfus`
3. `./rwfus -iI`
3. `./rwfus -i`

Then you're all set! Remember to periodically run `pacman -Sy` to update your repos

### Usage:

```
Rwfus v0.4.1
Rwfus v0.5.0
Carry Pacman across SteamOS updates!
USAGE:
Expand All @@ -42,8 +43,8 @@ FLAGS:
-h, --help Show this help text, then exit
-v, --version Show the version number, then exit
-i, --install* Install Rwfus
-u, --update* Re-generate systemd service files, without touching data
-i, --install* Install or update Rwfus
-u, --update* Alias for --install
-r, --remove* Remove ALL FILES AND DIRECTORIES associated with Rwfus
-e, --enable* Activate overlays
Expand All @@ -53,17 +54,14 @@ FLAGS:
--mount* Mount Rwfus's disk image
--umount* Unmount Rwfus's disk image
-I, --install-bin* Put ./rwfus into a [...]/usr/local/bin folder
-R, --remove-bin* Remove Rwfus from a [...]/usr/local/bin folder
-t, --test Use fake directory targets when performing operations
-g, --gen-config Generate a sample config file, which you can use to customize your install
* flags marked with a star require root, unless the --test flag is set.
OPTIONS:
OPTIONS:
-l, --logfile <path> Specify the location of Rwfus's log file
Default: /var/log/rwfus.log (where X is random)
Default: /var/log/rwfus.log
-c, --config <path> Specify a configuration file to use
Default: /opt/rwfus/
--backup <dest>* Backup Rwfus's disk image to (file path) <dest>
Expand All @@ -78,14 +76,20 @@ FLAGS:
> `rwfus --install`: Install Rwfus
> `rwfus --update`: Update Rwfus's scripts
> `rwfus --update`: Update Rwfus
> `rwfus --remove`: Remove Rwfus, including the pacman keyring and all installed pacman packages
> `rwfus --remove`: Remove Rwfus and all overlaid files
> `rwfus --gen-config`: Generate a sample config file in your present working directory
> `rwfus --config ./rwfus.conf`: Use a config file called `rwfus.conf` when setting up Rwfus
> `rwfus --install-bin`: Install Rwfus into the overlaid /usr/local/bin folder, so you can configure Rwfus from anywhere!
# Adding `rwfus` to your `$PATH`

To access the `rwfus` manager utility from anywhere, you may want to [add it to your PATH][archpath].

> `rwfus --install --install-bin` will do the above, with a fresh install, in a single command!
[releases]: https://github.com/ValShaped/rwfus/releases
[archpath]: https://wiki.archlinux.org/title/Environment_variables#Per_user
[nix-inst]: https://github.com/DeterminateSystems/nix-installer
[nix-pkgs]: https://search.nixos.org/packages
[nixtutor]: https://nix.dev/tutorials/
45 changes: 16 additions & 29 deletions rwfus
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ source "$IncludeDir/manage-install.sh" # Installation management
source "$IncludeDir/config.sh" # Configuration files

# Load the default configuration.
load_defaults
config default

# Default operation
Default_Operation="stat_service "
Expand All @@ -55,8 +55,8 @@ FLAGS:
-h, --help Show this help text, then exit
-v, --version Show the version number, then exit
-i, --install* Install $Name
-u, --update* Re-generate systemd service files, without touching data
-i, --install* Install or update $Name
-u, --update* Alias for --install
-r, --remove* Remove ALL FILES AND DIRECTORIES associated with $Name
-e, --enable* Activate overlays
Expand All @@ -66,17 +66,14 @@ FLAGS:
--mount* Mount $Name's disk image
--umount* Unmount $Name's disk image
-I, --install-bin* Put $0 into a [...]/usr/local/bin folder
-R, --remove-bin* Remove $Name from a [...]/usr/local/bin folder
-t, --test Use fake directory targets when performing operations
-g, --gen-config Generate a sample config file, which you can use to customize your install
* flags marked with a star require root, unless the --test flag is set.
OPTIONS:
OPTIONS:
-l, --logfile <path> Specify the location of $Name's log file
Default: $cf_Logfile (where X is random)
Default: $cf_Logfile
-c, --config <path> Specify a configuration file to use
Default: $cf_Base_Directory/
--backup <dest>* Backup $Name's disk image to (file path) <dest>
Expand All @@ -87,9 +84,9 @@ EOF
}

# Parse options
longopts="help,install,update,remove,enable,disable,status,mount,umount,backup:,restore:,test,version,install-bin,remove-bin,gen-config,gen-script,gen-disk,logfile:,config:"
shortopts="hiuredstvIRgl:c:"
#if [[ $? != 0 ]]; then
longopts="help,install,update,remove,enable,disable,status,mount,umount,backup:,restore:,test,version,gen-config,gen-script,gen-disk,logfile:,config:"
shortopts="hiuredstvgl:c:"

if ! parsed="$(getopt --options "$shortopts" --longoptions "$longopts" --name "$0" -- "$@")"; then
echo "Usage: $0 [-hiuredstvg] [-l path/to/logfile] [-c path/to/config] [/dir1 /dir2 ...]"
exit 128;
Expand All @@ -114,11 +111,11 @@ while true; do
shift
;;
-u|--update)
Operation+="perform_update "
Operation+="perform_install "
shift
;;
-r|--remove)
Operation+="perform_remove_all "
Operation+="perform_remove "
shift
;;
# Enablement control operations
Expand Down Expand Up @@ -161,7 +158,7 @@ while true; do
# Sample generators
-g|--gen-config)
sample_fullpath="$caller_dir/${Name@L}.conf"
config --store "$sample_fullpath"
config store "$sample_fullpath"
echo "Wrote config to $sample_fullpath"
exit 0
;;
Expand All @@ -178,22 +175,13 @@ while true; do
echo "Wrote disk image to $sample_fullpath"
exit 0
;;
# on-path installation
-I|--install-bin)
Operation+="add_to_bin "
shift
;;
-R|--remove-bin)
Operation+="remove_from_bin "
shift
;;
# Options
-l|--logfile)
cf_Logfile="$2"
shift 2
;;
-c|--config)
config --load "$2"
config load "$2"
shift 2
;;

Expand All @@ -219,17 +207,16 @@ function initialize_log {

for operation in ${Operation:=$Default_Operation}; do
case "$operation" in
"perform_install"|"perform_update"|"perform_remove_all"|\
"add_to_bin"|"remove_from_bin"|\
"perform_install"|"perform_remove"|\
"enable_service"|"disable_service")
check_permissions
initialize_log
Log config --load
Log config load
$operation "$@"
;;
"mount_disk"|"unmount_disk"|"backup_disk"|"restore_disk")
check_permissions
config --load
config load
state=$(service_state)
echo "$state"
if [[ "$state" == "active"* ]]; then
Expand All @@ -245,7 +232,7 @@ for operation in ${Operation:=$Default_Operation}; do
fi
;;
"stat_service"|"stat_disk")
config --load > /dev/null
config load > /dev/null
$operation
;;
"print_help")
Expand Down
Loading

0 comments on commit 15904c2

Please sign in to comment.