From 8fb88af4f17fa0fe897717a39f507fa9ca824e16 Mon Sep 17 00:00:00 2001 From: hot burger <33610620+hotburger@users.noreply.github.com> Date: Sat, 28 Sep 2024 16:01:07 -0700 Subject: [PATCH 1/2] add btrfs and f2fs support --- pkgs/jupiter-hw-support/btrfs.patch | 62 +++++++++++++++++++++++++++++ pkgs/jupiter-hw-support/default.nix | 3 ++ pkgs/jupiter-hw-support/src.nix | 1 + 3 files changed, 66 insertions(+) create mode 100644 pkgs/jupiter-hw-support/btrfs.patch diff --git a/pkgs/jupiter-hw-support/btrfs.patch b/pkgs/jupiter-hw-support/btrfs.patch new file mode 100644 index 00000000..19e512b5 --- /dev/null +++ b/pkgs/jupiter-hw-support/btrfs.patch @@ -0,0 +1,62 @@ +diff --git a/usr/lib/hwsupport/steamos-automount.sh b/usr/lib/hwsupport/steamos-automount.sh +index 386f4d8..1c78233 100755 +--- a/usr/lib/hwsupport/steamos-automount.sh ++++ b/usr/lib/hwsupport/steamos-automount.sh +@@ -67,23 +67,40 @@ do_mount() + #fi + + # We need symlinks for Steam for now, so only automount ext4 as that'll Steam will format right now +- if [[ ${ID_FS_TYPE} != "ext4" ]]; then +- echo "Error mounting ${DEVICE}: wrong fstype: ${ID_FS_TYPE} - ${dev_json}" +- exit 2 +- fi +- +- # Try to repair the filesystem if it's known to have errors. +- # ret=0 means no errors, 1 means that errors were corrected. +- # In all other cases we try to mount the fs read-only and report an error. +- ret=0 +- fsck.ext4 -y "${DEVICE}" || ret=$? +- if (( ret != 0 && ret != 1 )); then +- send_steam_url "system/devicemountresult" "${DEVBASE}/${FSCK_ERROR}" +- echo "Error running fsck on ${DEVICE} (status = $ret)" +- OPTS+=",ro" +- else +- OPTS+=",rw" +- fi ++ case ${ID_FS_TYPE} in ++ "ext4") ++ # Try to repair the filesystem if it's known to have errors. ++ # ret=0 means no errors, 1 means that errors were corrected. ++ # In all other cases we try to mount the fs read-only and report an error. ++ ret=0 ++ fsck.ext4 -y "${DEVICE}" || ret=$? ++ if (( ret != 0 && ret != 1 )); then ++ send_steam_url "system/devicemountresult" "${DEVBASE}/${FSCK_ERROR}" ++ echo "Error running fsck on ${DEVICE} (status = $ret)" ++ OPTS+=",ro" ++ else ++ OPTS+=",rw" ++ fi ++ ;; ++ "btrfs") ++ # btrfs doesn't have fsck (see man fsck.btrfs) ++ OPTS+=",rw" ++ ;; ++ "f2fs") ++ ret=0 ++ fsck.f2fs "${DEVICE}" || ret=$? ++ if (( ret != 0 )); then ++ echo "Error running fsck on ${DEVICE} (status = $ret)" ++ OPTS+=",ro" ++ else ++ OPTS+=",rw" ++ fi ++ ;; ++ *) ++ echo "Error mounting ${DEVICE}: wrong fstype: ${ID_FS_TYPE} - ${dev_json}" ++ exit 2 ++ ;; ++ esac + + # Ask udisks to auto-mount. This needs a version of udisks that supports the 'as-user' option. + mount_point=$(make_dbus_udisks_call call 'data[0]' s \ diff --git a/pkgs/jupiter-hw-support/default.nix b/pkgs/jupiter-hw-support/default.nix index 17177e6d..99c04f5d 100644 --- a/pkgs/jupiter-hw-support/default.nix +++ b/pkgs/jupiter-hw-support/default.nix @@ -6,6 +6,7 @@ , coreutils , e2fsprogs , exfatprogs +, f2fs-tools , f3 , findutils , gawk @@ -28,6 +29,7 @@ let coreutils e2fsprogs exfatprogs + f2fs-tools f3 findutils gawk @@ -44,6 +46,7 @@ let execer = [ "cannot:${e2fsprogs}/bin/fsck.ext4" "cannot:${e2fsprogs}/bin/mkfs.ext4" + "cannot:${f2fs-tools}/bin/fsck.f2fs" "cannot:${procps}/bin/pgrep" "cannot:${systemd}/bin/systemctl" "cannot:${systemd}/bin/udevadm" diff --git a/pkgs/jupiter-hw-support/src.nix b/pkgs/jupiter-hw-support/src.nix index 9d19f53b..7cd87772 100644 --- a/pkgs/jupiter-hw-support/src.nix +++ b/pkgs/jupiter-hw-support/src.nix @@ -23,6 +23,7 @@ stdenv.mkDerivation rec { systemd = systemd; src = ./jovian.patch; }) + ./btrfs.patch # Fix controller updates with python-hid >= 1.0.6 ./hid-1.0.6.patch ]; From d096ede4d5c61e9b88c1faa2e4fe51707eff44cd Mon Sep 17 00:00:00 2001 From: hot burger <33610620+hotburger@users.noreply.github.com> Date: Sat, 28 Sep 2024 19:33:25 -0700 Subject: [PATCH 2/2] more descriptive steamos-automount patch name --- pkgs/jupiter-hw-support/src.nix | 2 +- ...patch => steamos-automount-add-btrfs-and-f2fs-support.patch} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename pkgs/jupiter-hw-support/{btrfs.patch => steamos-automount-add-btrfs-and-f2fs-support.patch} (100%) diff --git a/pkgs/jupiter-hw-support/src.nix b/pkgs/jupiter-hw-support/src.nix index 7cd87772..237297d8 100644 --- a/pkgs/jupiter-hw-support/src.nix +++ b/pkgs/jupiter-hw-support/src.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { systemd = systemd; src = ./jovian.patch; }) - ./btrfs.patch + ./steamos-automount-add-btrfs-and-f2fs-support.patch # Fix controller updates with python-hid >= 1.0.6 ./hid-1.0.6.patch ]; diff --git a/pkgs/jupiter-hw-support/btrfs.patch b/pkgs/jupiter-hw-support/steamos-automount-add-btrfs-and-f2fs-support.patch similarity index 100% rename from pkgs/jupiter-hw-support/btrfs.patch rename to pkgs/jupiter-hw-support/steamos-automount-add-btrfs-and-f2fs-support.patch