Skip to content

Commit

Permalink
Add support for raspberry pi os legacy (raspberry pi 3 and below)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewoodall82 authored and toolboc committed Mar 6, 2024
1 parent 352dbe8 commit 20fec3c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions automount-usb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ sudo apt-get install -y ntfs-3g udisks2
sudo usermod -a -G disk ${USER}

# Create polkit rule
sudo mkdir -p /etc/polkit-1/rules.d/
sudo mkdir -p /etc/polkit-1/localauthority/50-local.d/

# For polkit > 105
sudo cat <<'EOF' | sudo tee /etc/polkit-1/rules.d/10-udisks2.rules
// Allow udisks2 to mount devices without authentication
// for users in the "disk" group.
Expand All @@ -33,6 +37,16 @@ polkit.addRule(function(action, subject) {
});
EOF

# For polkit <= 105
sudo cat <<'EOF' | sudo tee /etc/polkit-1/localauthority/50-local.d/10-udisks2.pkla
[Authorize mounting of devices for group disk]
Identity=unix-group:disk
Action=org.freedesktop.udisks2.filesystem-mount-system;org.freedesktop.udisks2.filesystem-mount;org.freedesktop.udisks2.filesystem-mount-other-seat
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF

# Create udev rule
sudo cat <<'EOF' | sudo tee /etc/udev/rules.d/usbstick.rules
ACTION=="add", KERNEL=="sd[a-z][0-9]", TAG+="systemd", ENV{SYSTEMD_WANTS}="usbstick-handler@%k"
Expand Down

0 comments on commit 20fec3c

Please sign in to comment.