Skip to content

Commit

Permalink
patch module
Browse files Browse the repository at this point in the history
  • Loading branch information
nihil-admirari committed Feb 18, 2025
1 parent 9bac2a6 commit a7064b6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 26 deletions.
11 changes: 11 additions & 0 deletions files/patches/admin.mount.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/usr/share/gvfs/mounts/admin.mount
+++ b/usr/share/gvfs/mounts/admin.mount
@@ -1,7 +1,7 @@
[Mount]
Type=admin
# Add a dummy argument after pkexec, or '/bin/sh -c' will eat the first argument in '$@'
-Exec=/bin/sh -c 'pkexec /usr/libexec/gvfsd-admin "$@" --address $DBUS_SESSION_BUS_ADDRESS --dir $XDG_RUNTIME_DIR' gvfsd-admin
+Exec=/bin/sh -c 'run0 --setenv=PKEXEC_UID="$UID" /usr/libexec/gvfsd-admin "$@" --address $DBUS_SESSION_BUS_ADDRESS --dir $XDG_RUNTIME_DIR' gvfsd-admin
AutoMount=false
DBusName=org.gtk.vfs.mountpoint_admin
MountPerClient=true
File renamed without changes.
10 changes: 0 additions & 10 deletions files/scripts/patchcommonconf.sh

This file was deleted.

15 changes: 0 additions & 15 deletions files/scripts/patchconf.sh

This file was deleted.

6 changes: 6 additions & 0 deletions modules/patch/module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: patch
shortdesc: This module is used to apply patches to files at image build image.
example: |
type: patch
patches:
- hardenlogindefs.patch
18 changes: 18 additions & 0 deletions modules/patch/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -euo pipefail
shopt -s nullglob

get_json_array PATCHES 'try .["patches"][]' "$1"
PATCH_DIR="$CONFIG_DIRECTORY/patches"
readonly PATCHES PATCH_DIR

main() {
local p
for p in "${PATCHES[@]}"; do
patch --batch --silent --forward --no-backup-if-mismatch \
--directory=/ --strip=1 < "$PATCH_DIR/$p"
done
}

main "$@"
4 changes: 4 additions & 0 deletions recipes/common/common-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ modules:
- type: script
scripts:
- enablecommonautoupdate.sh
- type: patch
source: local
patches:
- login.defs.patch
- type: secureblue-signing
source: local
1 change: 0 additions & 1 deletion recipes/common/common-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ scripts:
- disablegeoclue.sh
- enablesecurebluefirstrun.sh
- createjustcompletions.sh
- patchcommonconf.sh
4 changes: 4 additions & 0 deletions recipes/common/silverblue-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ modules:
- type: script
scripts:
- removedkmshelper.sh
- type: patch
source: local
patches:
- admin.mount.patch

0 comments on commit a7064b6

Please sign in to comment.