first commitment
This commit is contained in:
commit
48eb2cf0f6
25
69-mounter.rules
Executable file
25
69-mounter.rules
Executable file
@ -0,0 +1,25 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
var YES = polkit.Result.YES;
|
||||
var permission = {
|
||||
// required for udisks1:
|
||||
"org.freedesktop.udisks.filesystem-mount": YES,
|
||||
"org.freedesktop.udisks.luks-unlock": YES,
|
||||
"org.freedesktop.udisks.drive-eject": YES,
|
||||
"org.freedesktop.udisks.drive-detach": YES,
|
||||
// required for udisks2:
|
||||
"org.freedesktop.udisks2.filesystem-mount": YES,
|
||||
"org.freedesktop.udisks2.encrypted-unlock": YES,
|
||||
"org.freedesktop.udisks2.eject-media": YES,
|
||||
"org.freedesktop.udisks2.power-off-drive": YES,
|
||||
// required for udisks2 if using udiskie from another seat (e.g. systemd):
|
||||
"org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
|
||||
"org.freedesktop.udisks2.filesystem-unmount-others": YES,
|
||||
"org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
|
||||
"org.freedesktop.udisks2.encrypted-unlock-system": YES,
|
||||
"org.freedesktop.udisks2.eject-media-other-seat": YES,
|
||||
"org.freedesktop.udisks2.power-off-drive-other-seat": YES
|
||||
};
|
||||
if (subject.isInGroup("my-group-id")) {
|
||||
return permission[action.id];
|
||||
}
|
||||
});
|
13
README.md
Executable file
13
README.md
Executable file
@ -0,0 +1,13 @@
|
||||
# Automagic SD card import
|
||||
|
||||
I'll most likely forget this, so I'll have this documentation available for later use.
|
||||
|
||||
But tl;dr this is for no GUI automount of SD card, run copy and umount automagically.
|
||||
|
||||
Requires following packages: `udiskie`, `udisks2`
|
||||
|
||||
- polkit-rule goes to polkit folder, say `/etc/polkit-1/rules.d/69-mounter.rules` on Debian based polkitted things
|
||||
- service units go to `/usr/lib/systemd/system` and change the user on udiskie.service
|
||||
- copy file goes where ever the files are (edit the unit sd-copy and script)
|
||||
- no udev bullshit required (yay)
|
||||
|
7
copy.sh
Executable file
7
copy.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
rsync -r /media/whateverthesd-cardidis/DCIM/* /home/whoever/pics
|
||||
|
||||
echo "import finished at $(date)" >> /var/log/sd-import.log
|
||||
|
||||
udiskie-umount /media/whateverthesd-cardidis
|
10
sd-copy.service
Executable file
10
sd-copy.service
Executable file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Trigger to copy files from camera SD to Photoprism
|
||||
Requires=media-whateverthesd\x2dcardidis.mount
|
||||
After=media-whateverthesd\x2dcardidis.mount
|
||||
|
||||
[Service]
|
||||
ExecStart=/home/whereverthethingis/copy.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=media-whateverthesd\x2dcardidis.mount
|
19
udiskie.service
Executable file
19
udiskie.service
Executable file
@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=udiskie automagic mounter
|
||||
Wants=udisks2.service
|
||||
After=udisks2.service
|
||||
Documentation=man:udiskie
|
||||
|
||||
[Service]
|
||||
User=whoever
|
||||
Group=whoever
|
||||
ExecStart=/usr/bin/udiskie
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
StandardOutput=syslog
|
||||
NoNewPrivileges=true
|
||||
MemoryDenyWriteExecute=true
|
||||
ProtectSystem=true
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user