overhaul sed'ding

This commit is contained in:
Jan Alexander Steffens 2016-11-17 15:27:34 +00:00
parent f3c411367e
commit 0c6d4c7ab6
4 changed files with 18 additions and 31 deletions

View File

@ -2,10 +2,10 @@
Type = File Type = File
Operation = Install Operation = Install
Operation = Upgrade Operation = Upgrade
Target = boot/vmlinuz-linux Target = boot/vmlinuz-%PKGBASE%
Target = usr/lib/initcpio/* Target = usr/lib/initcpio/*
[Action] [Action]
Description = Updating Arch Linux initramfs image Description = Updating %PKGBASE% initcpios
When = PostTransaction When = PostTransaction
Exec = /usr/bin/mkinitcpio -p linux Exec = /usr/bin/mkinitcpio -p %PKGBASE%

View File

@ -31,8 +31,8 @@ sha256sums=('3e9150065f193d3d94bcf46a1fe9f033c7ef7122ab71d75a7fb5a2f0c9a7e11a'
'SKIP' 'SKIP'
'2ac8818414beb7dbacbd3ad450c516e6ada804827132a7132f63b8189e5f5151' '2ac8818414beb7dbacbd3ad450c516e6ada804827132a7132f63b8189e5f5151'
'93a4ad4f6c7bb9296fddec436ed7477a5a5c11cf4d6e68482fa6610442cbcb1f' '93a4ad4f6c7bb9296fddec436ed7477a5a5c11cf4d6e68482fa6610442cbcb1f'
'2d4424928ae3c5f63ee618b4685580f4bd24faf1778553dbd961f85a88ea0910' '834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c' 'a8cae3381e5669a70e20e36562d7433f61b13d24ad8c688cf6c398d5128e2c02'
'1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99') '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99')
validpgpkeys=( validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
@ -115,24 +115,17 @@ _package() {
cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}" cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgbase}"
# set correct depmod command for install # set correct depmod command for install
cp -f "${startdir}/${install}" "${startdir}/${install}.pkg" sed -e "s|%PKGBASE%|${pkgbase}|g;s|%KERNVER%|${_kernver}|g" \
"${startdir}/${install}" > "${startdir}/${install}.pkg"
true && install=${install}.pkg true && install=${install}.pkg
sed \
-e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/" \
-e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/" \
-i "${startdir}/${install}"
# install mkinitcpio preset file for kernel # install mkinitcpio preset file for kernel
install -D -m644 "${srcdir}/linux.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset" sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/linux.preset" |
sed \ install -D -m644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
-e "1s|'linux.*'|'${pkgbase}'|" \
-e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgbase}\"|" \
-e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgbase}.img\"|" \
-e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgbase}-fallback.img\"|" \
-i "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
# install pacman hook for initramfs regeneration # install pacman hook for initramfs regeneration
install -D -m644 "${srcdir}/80-linux.hook" "${pkgdir}/usr/share/libalpm/hooks/80-linux.hook" sed "s|%PKGBASE%|${pkgbase}|g" "${srcdir}/80-linux.hook" |
install -D -m644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/80-${pkgbase}.hook"
# remove build and source links # remove build and source links
rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build} rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}

View File

@ -1,13 +1,7 @@
# arg 1: the new package version
# arg 2: the old package version
KERNEL_NAME=
KERNEL_VERSION=
post_install () { post_install () {
# updating module dependencies # updating module dependencies
echo ">>> Updating module dependencies. Please wait ..." echo ">>> Updating module dependencies. Please wait ..."
depmod ${KERNEL_VERSION} depmod %KERNVER%
} }
post_upgrade() { post_upgrade() {
@ -17,7 +11,7 @@ post_upgrade() {
# updating module dependencies # updating module dependencies
echo ">>> Updating module dependencies. Please wait ..." echo ">>> Updating module dependencies. Please wait ..."
depmod ${KERNEL_VERSION} depmod %KERNVER%
if [ $(vercmp $2 3.13) -lt 0 ]; then if [ $(vercmp $2 3.13) -lt 0 ]; then
echo ">>> WARNING: AT keyboard support is no longer built into the kernel." echo ">>> WARNING: AT keyboard support is no longer built into the kernel."
@ -28,6 +22,6 @@ post_upgrade() {
post_remove() { post_remove() {
# also remove the compat symlinks # also remove the compat symlinks
rm -f boot/initramfs-linux${KERNEL_NAME}.img rm -f boot/initramfs-%PKGBASE%.img
rm -f boot/initramfs-linux${KERNEL_NAME}-fallback.img rm -f boot/initramfs-%PKGBASE%-fallback.img
} }

View File

@ -1,14 +1,14 @@
# mkinitcpio preset file for the 'linux' package # mkinitcpio preset file for the 'linux' package
ALL_config="/etc/mkinitcpio.conf" ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux" ALL_kver="/boot/vmlinuz-%PKGBASE%"
PRESETS=('default' 'fallback') PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf" #default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img" default_image="/boot/initramfs-%PKGBASE%.img"
#default_options="" #default_options=""
#fallback_config="/etc/mkinitcpio.conf" #fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img" fallback_image="/boot/initramfs-%PKGBASE%-fallback.img"
fallback_options="-S autodetect" fallback_options="-S autodetect"