Skip to content

Commit

Permalink
Merge pull request #1290 from zmrow/cdrom
Browse files Browse the repository at this point in the history
Add a systemd mount unit for CD-ROM devices
  • Loading branch information
zmrow authored Jan 27, 2021
2 parents 7ec18f5 + eea4182 commit 55b1c90
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/filesystem/filesystem.spec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ mkdir -p %{buildroot}%{_cross_mandir}
mkdir -p %{buildroot}%{_cross_localstatedir}
mkdir -p %{buildroot}/{boot,dev,proc,root,run,sys,tmp}
mkdir -p %{buildroot}/{home,local,media,mnt,opt,srv}
mkdir -p %{buildroot}/media/cdrom

ln -s .%{_cross_prefix} %{buildroot}%{_prefix}
ln -s .%{_cross_bindir} %{buildroot}/bin
Expand Down
21 changes: 21 additions & 0 deletions packages/release/media-cdrom.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
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
After=dev-cdrom.device
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target

[Mount]
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
6 changes: 5 additions & 1 deletion packages/release/release.spec
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Source1008: opt.mount
Source1009: var-lib-bottlerocket.mount
Source1010: etc-cni.mount

# CD-ROM mount
Source1015: media-cdrom.mount

# Mounts that require build-time edits.
Source1020: var-lib-kernel-devel-lower.mount.in
Source1021: usr-src-kernels.mount.in
Expand Down Expand Up @@ -104,7 +107,7 @@ EOF

install -d %{buildroot}%{_cross_unitdir}
install -p -m 0644 \
%{S:1002} %{S:1006} %{S:1007} %{S:1008} %{S:1009} %{S:1010} \
%{S:1002} %{S:1006} %{S:1007} %{S:1008} %{S:1009} %{S:1010} %{S:1015} \
%{buildroot}%{_cross_unitdir}

LOWERPATH=$(systemd-escape --path %{_cross_sharedstatedir}/kernel-devel/lower)
Expand Down Expand Up @@ -138,6 +141,7 @@ install -p -m 0644 %{S:201} %{buildroot}%{_cross_templatedir}/proxy-env
%{_cross_unitdir}/var.mount
%{_cross_unitdir}/opt.mount
%{_cross_unitdir}/etc-cni.mount
%{_cross_unitdir}/media-cdrom.mount
%{_cross_unitdir}/*-lower.mount
%{_cross_unitdir}/*-kernels.mount
%{_cross_unitdir}/*-licenses.mount
Expand Down

0 comments on commit 55b1c90

Please sign in to comment.