Skip to content

Commit

Permalink
Merge pull request #1516 from etungsten/cd-pls
Browse files Browse the repository at this point in the history
release: add new udev rules for mounting CD-ROMs
  • Loading branch information
etungsten authored Apr 23, 2021
2 parents 5d3db5e + 3b75e0c commit 5800a60
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 2 additions & 7 deletions packages/release/media-cdrom.mount
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=CD-ROM mount (/media/cdrom)
# Only run this unit if /dev/cdrom exists and is tracked via systemd. (systemd
# ships with a udev rule to tag and symlink the first suspected cdrom device to
# /dev/cdrom)
Requires=dev-cdrom.device
BindsTo=dev-cdrom.device
After=dev-cdrom.device
DefaultDependencies=no
Conflicts=umount.target
Expand All @@ -13,9 +13,4 @@ Before=local-fs.target umount.target
What=/dev/cdrom
Where=/media/cdrom
Type=iso9660
Options=defaults,noexec

[Install]
# This dependency ensures that systemd attempts to run this unit if the device
# exists.
WantedBy=dev-cdrom.device
Options=ro,defaults,noexec
8 changes: 8 additions & 0 deletions packages/release/mount-cdrom.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ACTION!="change", GOTO="mount_cdrom_end"
SUBSYSTEM!="block", GOTO="mount_cdrom_end"
KERNEL!="sr[0-9]*|vdisk*|xvd*", GOTO="mount_cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="mount_cdrom_end"
# If media is present, we want to mount the CD-ROM.
ENV{ID_CDROM}=="1", ENV{ID_CDROM_MEDIA}=="1", ENV{ID_FS_TYPE}=="iso9660", \
ENV{SYSTEMD_WANTS}="media-cdrom.mount"
LABEL="mount_cdrom_end"
7 changes: 6 additions & 1 deletion packages/release/release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ Source1008: opt.mount
Source1009: var-lib-bottlerocket.mount
Source1010: etc-cni.mount

# CD-ROM mount
# CD-ROM mount & associated udev rules
Source1015: media-cdrom.mount
Source1016: mount-cdrom.rules

# Mounts that require build-time edits.
Source1020: var-lib-kernel-devel-lower.mount.in
Expand Down Expand Up @@ -113,6 +114,9 @@ install -d %{buildroot}%{_cross_templatedir}
install -p -m 0644 %{S:200} %{buildroot}%{_cross_templatedir}/motd
install -p -m 0644 %{S:201} %{buildroot}%{_cross_templatedir}/proxy-env

install -d %{buildroot}%{_cross_udevrulesdir}
install -p -m 0644 %{S:1016} %{buildroot}%{_cross_udevrulesdir}/61-mount-cdrom.rules

ln -s %{_cross_unitdir}/preconfigured.target %{buildroot}%{_cross_unitdir}/default.target

%files
Expand Down Expand Up @@ -141,5 +145,6 @@ ln -s %{_cross_unitdir}/preconfigured.target %{buildroot}%{_cross_unitdir}/defau
%dir %{_cross_templatedir}
%{_cross_templatedir}/motd
%{_cross_templatedir}/proxy-env
%{_cross_udevrulesdir}/61-mount-cdrom.rules

%changelog

0 comments on commit 5800a60

Please sign in to comment.