-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 181d74c
Showing
6 changed files
with
518 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,16 @@ | ||
# dracut-alpm-hook | ||
|
||
This provides [alpm hooks][alpm-hooks5] for [dracut][dracut] to generate a new initramfs on kernel upgrade. | ||
|
||
## Usage | ||
|
||
Copy hooks (`*.hook`) to `/usr/share/libalpm/hooks` and scripts to `/usr/share/libalpm/scripts`. | ||
|
||
## License | ||
|
||
[FDL 1.3][fdl] | ||
|
||
[alpm-hooks5]:https://www.archlinux.org/pacman/alpm-hooks.5.html | ||
[dracut]:/~https://github.com/dracutdevs/dracut | ||
[fdl]:http://www.gnu.org/licenses/fdl-1.3.html | ||
|
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,16 @@ | ||
[Trigger] | ||
Type = File | ||
Operation = Remove | ||
Target = usr/lib/modules/*/pkgbase | ||
|
||
[Trigger] | ||
Type = Package | ||
Operation = Remove | ||
Target = dracut | ||
Target = dracut-git | ||
|
||
[Action] | ||
Description = Remove linux initcpios... | ||
When = PreTransaction | ||
Exec = /usr/share/libalpm/scripts/dracut-remove | ||
NeedsTargets |
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 @@ | ||
[Trigger] | ||
Type = File | ||
Operation = Install | ||
Operation = Upgrade | ||
Target = usr/lib/modules/*/pkgbase | ||
Target = usr/lib/dracut/* | ||
|
||
[Action] | ||
Description = Updating linux initcpios... | ||
When = PostTransaction | ||
Exec = /usr/share/libalpm/scripts/dracut-install | ||
NeedsTargets |
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,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
args=('--force' '--no-hostonly-cmdline') | ||
|
||
while read -r line; do | ||
if [[ "$line" == 'usr/lib/modules/'+([^/])'/pkgbase' ]]; then | ||
read -r pkgbase < "/${line}" | ||
kver="${line#'usr/lib/modules/'}" | ||
kver="${kver%'/pkgbase'}" | ||
|
||
install -Dm0644 "/${line%'/pkgbase'}/vmlinuz" "/boot/vmlinuz-${pkgbase}" | ||
dracut "${args[@]}" "/boot/initramfs-${pkgbase}.img" --kver "$kver" | ||
dracut "${args[@]}" --no-hostonly "/boot/initramfs-${pkgbase}-fallback.img" --kver "$kver" | ||
fi | ||
done |
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,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
while read -r line; do | ||
if [[ "$line" == 'usr/lib/modules/'+([^/])'/pkgbase' ]]; then | ||
read -r pkgbase < "/${line}" | ||
rm -f "/boot/vmlinuz-${pkgbase}" "/boot/initramfs-${pkgbase}.img" "/boot/initramfs-${pkgbase}-fallback.img" | ||
fi | ||
done |