Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

steamos-automount: Support btrfs and f2fs #414

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkgs/jupiter-hw-support/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, coreutils
, e2fsprogs
, exfatprogs
, f2fs-tools
, f3
, findutils
, gawk
Expand All @@ -28,6 +29,7 @@ let
coreutils
e2fsprogs
exfatprogs
f2fs-tools
f3
findutils
gawk
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions pkgs/jupiter-hw-support/src.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ stdenv.mkDerivation rec {
systemd = systemd;
src = ./jovian.patch;
})
./steamos-automount-add-btrfs-and-f2fs-support.patch
# Fix controller updates with python-hid >= 1.0.6
./hid-1.0.6.patch
];
Expand Down
Original file line number Diff line number Diff line change
@@ -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
+ ;;
Comment on lines +55 to +58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a warning, and unsure what the exit code ends-up being doing...

... after all, this runs for any "external storage", this shouldn't be considered unlikely to happen.

+ 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 \
Loading