[pbs-devel] [PATCH proxmox-backup 25/26] debian/etc: add udev rules and simple service for automounting
Hannes Laimer
h.laimer at proxmox.com
Tue Jul 5 15:08:33 CEST 2022
Signed-off-by: Hannes Laimer <h.laimer at proxmox.com>
---
debian/proxmox-backup-server.install | 1 +
debian/proxmox-backup-server.udev | 3 +++
etc/Makefile | 3 ++-
etc/removable-device-attach at .service.in | 6 ++++++
4 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 etc/removable-device-attach at .service.in
diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install
index 6e2219b4..3cabd46e 100644
--- a/debian/proxmox-backup-server.install
+++ b/debian/proxmox-backup-server.install
@@ -3,6 +3,7 @@ etc/proxmox-backup.service /lib/systemd/system/
etc/proxmox-backup-banner.service /lib/systemd/system/
etc/proxmox-backup-daily-update.service /lib/systemd/system/
etc/proxmox-backup-daily-update.timer /lib/systemd/system/
+etc/removable-device-attach at .service /lib/systemd/system/
etc/pbs-enterprise.list /etc/apt/sources.list.d/
usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api
usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy
diff --git a/debian/proxmox-backup-server.udev b/debian/proxmox-backup-server.udev
index afdfb2bc..e5aa26c3 100644
--- a/debian/proxmox-backup-server.udev
+++ b/debian/proxmox-backup-server.udev
@@ -16,3 +16,6 @@ SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="1", ENV{ID_SCSI_SER
SYMLINK+="tape/by-id/scsi-$env{ID_SCSI_SERIAL}-sg"
LABEL="persistent_storage_tape_end"
+
+# triggers the mounting of a removable device
+ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_UUID}!="", TAG+="systemd", ENV{SYSTEMD_WANTS}="removable-device-attach@$env{ID_FS_UUID}"
diff --git a/etc/Makefile b/etc/Makefile
index 42f639f6..730de4f8 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -7,7 +7,8 @@ DYNAMIC_UNITS := \
proxmox-backup-banner.service \
proxmox-backup-daily-update.service \
proxmox-backup.service \
- proxmox-backup-proxy.service
+ proxmox-backup-proxy.service \
+ removable-device-attach at .service
all: $(UNITS) $(DYNAMIC_UNITS) pbs-enterprise.list
diff --git a/etc/removable-device-attach at .service.in b/etc/removable-device-attach at .service.in
new file mode 100644
index 00000000..12fa103f
--- /dev/null
+++ b/etc/removable-device-attach at .service.in
@@ -0,0 +1,6 @@
+[Unit]
+Description=Try to mount the removable device with uuid '%i'.
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/proxmox-backup-manager removable-device mount-uuid %i
--
2.30.2
More information about the pbs-devel
mailing list