Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: add new udev rules for mounting CD-ROMs #1516

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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