This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add service for Surface hardware setup
Configures and enables initramfs-etc on boot
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
12 changes: 12 additions & 0 deletions
12
system_files/shared/usr/lib/systemd/system/surface-hardware-setup.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |