Skip to content
Snippets Groups Projects
Commit c524d5ad authored by jean-michel's avatar jean-michel
Browse files

restore/update mkinitcpio 30-4

parent df363a57
No related branches found
No related tags found
No related merge requests found
Pipeline #806 passed
# Obarun : 66 init/supervisor
# Maintainer : Eric Vidal <eric@obarun.org>
# Maintainer : Jean-Michel T.Dydak <jean-michel@obarun.org>
# Obarun PkgSrc : url="https://git.obarun.org/pkg/obcore/mkinitcpio"
# Obarun PkgSrc : https://git.obarun.org/pkg/obcore/mkinitcpio
#----------------
# Maintainer :
# Contributor :
# Arch PkgSrc : url="https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/mkinitcpio/"
#----------------
# Website : https://
#----------------------------------------------------------------------------
#--DESCRIPTION---------------------------------------------------------------
#--------------------------------------------------------------
# DESCRIPTION ]
pkgname=mkinitcpio
pkgdesc="Modular initramfs image creation utility"
pkgver=30
pkgrel=3
pkgrel=4
pkgdesc='Modular initramfs image creation utility'
url='https://github.com/archlinux/mkinitcpio'
source=("https://sources.archlinux.org/other/${pkgname}/${pkgname}-$pkgver.tar.gz"
'001-remove-systemd-and-kept-gzip-as-default.patch'
)
#--BUILD CONFIGURATION-------------------------------------------------------
makedepends=('asciidoc' 'git' 'sed')
#--BUILD PREPARATION---------------------------------------------------------
prepare() {
cd "$pkgname-$pkgver"
# Apply 0003-remove-systemd.patch
patch -Np1 < $srcdir/001-remove-systemd-and-kept-gzip-as-default.patch
}
#--BUILD---------------------------------------------------------------------
#--CHECK---------------------------------------------------------------------
check() {
make -C "$pkgname-$pkgver" check
}
source=(
"https://sources.archlinux.org/other/$pkgname/$pkgname-$pkgver.tar.gz"
'001-remove-systemd-and-kept-gzip-as-default.patch'
'add_udev_rule_function.patch'
)
#--PACKAGE-------------------------------------------------------------------
#----------------------
# BUILD CONFIGURATION ]
package() {
make -C "${pkgname}-$pkgver" DESTDIR="$pkgdir" install
}
makedepends=(
'asciidoc'
'git'
'sed'
)
#--INSTALL CONFIGURATION-----------------------------------------------------
#------------------------
# INSTALL CONFIGURATION ]
arch=(x86_64)
install=mkinitcpio.install
backup=('etc/mkinitcpio.conf')
depends=(
'mkinitcpio-busybox>=1.19.4-2'
'kmod'
......@@ -76,7 +48,8 @@ depends=(
'filesystem>=2011.10-1'
'gzip'
'lz4'
'sed')
'sed'
)
optdepends=(
'xz: Use lzma or xz compression for the initramfs image'
......@@ -84,13 +57,47 @@ optdepends=(
'lzop: Use lzo compression for the initramfs image'
'lz4: Use lz4 compression for the initramfs image'
'zstd: Use zstd compression for the initramfs image'
'mkinitcpio-nfs-utils: Support for root filesystem on NFS')
'mkinitcpio-nfs-utils: Support for root filesystem on NFS'
)
backup=(
'etc/mkinitcpio.conf'
)
provides=(
"mkinitcpio=$pkgver-$pkgrel"
'initramfs'
)
#----------------
# BUILD PREPARE ]
prepare() {
cd $pkgname-$pkgver
## Apply 0003-remove-systemd.patch
patch -Np1 < $srcdir/001-remove-systemd-and-kept-gzip-as-default.patch
patch -Np1 < $srcdir/add_udev_rule_function.patch
provides=("mkinitcpio=${pkgver}-${pkgrel}" "initramfs")
}
#--------
# CHECK ]
check() {
make -C $pkgname-$pkgver check
}
#----------
# PACKAGE ]
package() {
make -C $pkgname-$pkgver DESTDIR="$pkgdir" install
}
#--SECURITY AND LICENCE------------------------------------------------------
#-------------------------
# LICENCE AND VALIDATION ]
license=('GPL')
license=(GPL)
sha256sums=('c7725035a06d2ab6ef6e97601b69859d6061aec95c4551e2a1ad2e27d307258f'
'a7dcad6ec0a3ea32896f2ca218ea4ba1550feaed25d58ed609bfbb7f9fd03619')
sha512sums=(' ')
diff -Nuar -uar --color a/functions b/functions
--- a/functions 2021-02-17 13:37:31.000000000 +1100
+++ b/functions 2021-11-03 10:35:49.773891914 +1100
@@ -625,6 +625,46 @@
return 0
}
+add_udev_rule() {
+ # Add an udev rules file to the initcpio image. Dependencies on binaries
+ # will be discovered and added.
+ # $1: path to rules file (or name of rules file)
+
+ local rules="$1" rule= key= value= binary=
+
+ if [[ ${rules:0:1} != '/' ]]; then
+ rules=$(PATH=/usr/lib/udev/rules.d:/lib/udev/rules.d type -P "$1")
+ fi
+ if [[ -z $rules ]]; then
+ # complain about not found rules
+ return 1
+ fi
+
+ add_file "$rules" /usr/lib/udev/rules.d/"${rules##*/}"
+
+ while IFS=, read -ra rule; do
+ # skip empty lines, comments
+ [[ -z $rule || $rule = @(+([[:space:]])|#*) ]] && continue
+
+ for pair in "${rule[@]}"; do
+ IFS=' =' read -r key value <<< "$pair"
+ case $key in
+ RUN@({program}|+)|IMPORT{program}|ENV{REMOVE_CMD})
+ # strip quotes
+ binary=${value//[\"\']/}
+ # just take the first word as the binary name
+ binary=${binary%% *}
+ [[ ${binary:0:1} == '$' ]] && continue
+ if [[ ${binary:0:1} != '/' ]]; then
+ binary=$(PATH=/usr/lib/udev:/lib/udev type -P "$binary")
+ fi
+ add_binary "$binary"
+ ;;
+ esac
+ done
+ done <"$rules"
+}
+
parse_config() {
# parse key global variables set by the config file.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment