Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
feat: Add service for Surface hardware setup
Browse files Browse the repository at this point in the history
Configures and enables initramfs-etc on boot
  • Loading branch information
EyeCantCU committed Nov 11, 2023
1 parent b9f1132 commit ebc60d3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ RUN if grep -q "silverblue" <<< "${BASE_IMAGE_NAME}"; then \

# Setup things which are the same for every image
RUN /tmp/surface-install.sh && \
systemctl enable surface-hardware-setup && \
systemctl enable tlp && \
systemctl enable fprintd && \
rm -rf /tmp/* /var/* && \
Expand Down
25 changes: 25 additions & 0 deletions system_files/shared/usr/bin/surface-hardware-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

INITRAMFS=$(rpm-ostree initramfs-etc)
SURFACE_INITRAMFS=("/etc/crypttab")
APPLY_INITRAMFS=false

echo "Current initramfs: $INITRAMFS"

SURFACE_INITRAMFS+=("/etc/modprobe.d/ublue-surface.conf")

# Verify initramfs options are applied
for ARG in ${SURFACE_INITRAMFS[@]}; do
if [[ ! $INITRAMFS =~ "$ARG" ]]; then
APPLY_INITRAMFS=true
fi
done

# Update initramfs
if $APPLY_INITRAMFS; then
echo "Found needed initramfs changes, applying the following: ${SURFACE_INITRAMFS[*]}"
plymouth display-message --text="Updating initramfs - System will reboot" || true
rpm-ostree initramfs-etc "${SURFACE_INITRAMFS[@]/#/--track=}" --reboot
else
echo "No initramfs changes needed"
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Configure Surface hardware
After=rpm-ostreed.service
Before=systemd-user-sessions.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/surface-hardware-setup

[Install]
WantedBy=multi-user.target

0 comments on commit ebc60d3

Please sign in to comment.