-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from hotburger/fix-automount
- Loading branch information
Showing
10 changed files
with
173 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
let | ||
inherit (lib) | ||
mkIf | ||
mkMerge | ||
mkOption | ||
types | ||
; | ||
cfg = config.jovian.steamos; | ||
in | ||
{ | ||
options = { | ||
jovian.steamos = { | ||
enableAutoMountUdevRules = mkOption { | ||
default = cfg.useSteamOSConfig; | ||
defaultText = lib.literalExpression "config.jovian.steamos.useSteamOSConfig"; | ||
type = types.bool; | ||
description = '' | ||
Whether to enable udev rules to automatically mount SD cards upon insertion. | ||
''; | ||
}; | ||
}; | ||
}; | ||
config = mkMerge [ | ||
(mkIf (cfg.enableAutoMountUdevRules) { | ||
services.udev.packages = [ | ||
pkgs.jupiter-hw-support | ||
]; | ||
}) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ let | |
in | ||
{ | ||
imports = [ | ||
./automount.nix | ||
./bluetooth.nix | ||
./boot.nix | ||
./mesa.nix | ||
|
45 changes: 45 additions & 0 deletions
45
pkgs/jupiter-hw-support/0001-Jovian-Ensure-automounting-works-for-any-UID-1000-us.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
From 42798ed60fbc601cefab84fd1f2c8dab95906702 Mon Sep 17 00:00:00 2001 | ||
From: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
Date: Sun, 29 Sep 2024 02:52:26 -0400 | ||
Subject: [PATCH] =?UTF-8?q?[Jovian]=C2=A0Ensure=20automounting=20works=20f?= | ||
=?UTF-8?q?or=20any=20UID=201000=20username?= | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset=UTF-8 | ||
Content-Transfer-Encoding: 8bit | ||
|
||
Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
--- | ||
usr/lib/hwsupport/steamos-automount.sh | 10 +++++++--- | ||
1 file changed, 7 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/usr/lib/hwsupport/steamos-automount.sh b/usr/lib/hwsupport/steamos-automount.sh | ||
index 386f4d8..8583ca7 100755 | ||
--- a/usr/lib/hwsupport/steamos-automount.sh | ||
+++ b/usr/lib/hwsupport/steamos-automount.sh | ||
@@ -22,8 +22,12 @@ fi | ||
ACTION=$1 | ||
DEVBASE=$2 | ||
DEVICE="/dev/${DEVBASE}" | ||
-DECK_UID=$(id -u deck) | ||
-DECK_GID=$(id -g deck) | ||
+# Jovian Experiments assumptions: | ||
+# - UID for Steam user is 1000 | ||
+# - Username is unknown | ||
+DECK_UID=1000 | ||
+DECK_GID=$(id -g "$DECK_UID") | ||
+DECK_USERNAME=$(id -nu "$DECK_UID") | ||
|
||
send_steam_url() | ||
{ | ||
@@ -90,7 +94,7 @@ do_mount() | ||
"block_devices/${DEVBASE}" \ | ||
Filesystem Mount \ | ||
'a{sv}' 3 \ | ||
- as-user s deck \ | ||
+ as-user s "$DECK_USERNAME" \ | ||
auth.no_user_interaction b true \ | ||
options s "$OPTS") | ||
|
||
-- | ||
2.46.0 | ||
|
30 changes: 30 additions & 0 deletions
30
pkgs/jupiter-hw-support/0001-format-device-Harden-against-mountpoint-being-listed.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
From eee1d1e1f8e6d7a2246e3428d71522e02b04c5d7 Mon Sep 17 00:00:00 2001 | ||
From: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
Date: Sun, 29 Sep 2024 21:45:49 -0400 | ||
Subject: [PATCH] format-device: Harden against mountpoint being listed more | ||
than once | ||
|
||
This can happen with some combination of bind mounts magic, where the | ||
mount point may appear at more than one location at a time. | ||
|
||
Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
--- | ||
usr/lib/hwsupport/format-device.sh | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/usr/lib/hwsupport/format-device.sh b/usr/lib/hwsupport/format-device.sh | ||
index 65d77f8..0400ae8 100755 | ||
--- a/usr/lib/hwsupport/format-device.sh | ||
+++ b/usr/lib/hwsupport/format-device.sh | ||
@@ -77,6 +77,8 @@ fi | ||
# If any partitions on the device are mounted, unmount them before continuing | ||
# to prevent problems later | ||
lsblk -n "$STORAGE_DEVICE" -o MOUNTPOINTS | awk NF | sort -u | while read m; do | ||
+ # Check the mountpoint still exists, in case the mount point is reported more than once. | ||
+ test -e "$m" || continue | ||
if ! umount "$m"; then | ||
echo "Failed to unmount filesystem: $m" | ||
exit 32 # EPIPE | ||
-- | ||
2.46.0 | ||
|
36 changes: 36 additions & 0 deletions
36
pkgs/jupiter-hw-support/0001-steamos-automount-Harden-against-missing-run-media.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
From 55674111fe7956adb41c2b8d0c6fbb3c3d6ca8bf Mon Sep 17 00:00:00 2001 | ||
From: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
Date: Sun, 29 Sep 2024 02:36:41 -0400 | ||
Subject: [PATCH] steamos-automount: Harden against missing /run/media | ||
|
||
When running against some systems, it is possible `/run/media` does not | ||
exist when trying to unmount a path. E.g. with `UDISKS_FILESYSTEM_SHARED`. | ||
|
||
Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com> | ||
--- | ||
usr/lib/hwsupport/steamos-automount.sh | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/usr/lib/hwsupport/steamos-automount.sh b/usr/lib/hwsupport/steamos-automount.sh | ||
index 8583ca7..0b0457f 100755 | ||
--- a/usr/lib/hwsupport/steamos-automount.sh | ||
+++ b/usr/lib/hwsupport/steamos-automount.sh | ||
@@ -107,6 +107,7 @@ do_mount() | ||
# that use the older mount point (for SD cards only). | ||
case "${DEVBASE}" in | ||
mmcblk0p*) | ||
+ mkdir -p /run/media | ||
if [[ -z "${ID_FS_LABEL}" ]]; then | ||
old_mount_point="/run/media/${DEVBASE}" | ||
else | ||
@@ -124,6 +125,7 @@ do_mount() | ||
|
||
do_unmount() | ||
{ | ||
+ mkdir -p /run/media | ||
local mount_point=$(findmnt -fno TARGET "${DEVICE}" || true) | ||
if [[ -n $mount_point ]]; then | ||
# Remove symlink to the mount point that we're unmounting | ||
-- | ||
2.46.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters