Add support to different deviceinfo variables in mainline/downstream subpackages
This commit is contained in:
parent
10cbdc7225
commit
9249bf2122
9 changed files with 107 additions and 14 deletions
41
main/devicepkg-dev/devicepkg_subpackage_kernel.sh
Normal file
41
main/devicepkg-dev/devicepkg_subpackage_kernel.sh
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#!/bin/sh
|
||||
startdir=$1
|
||||
pkgname=$2
|
||||
subpkgname=$3
|
||||
|
||||
if [ -z "$startdir" ] || [ -z "$pkgname" ] || [ -z "$subpkgname" ]; then
|
||||
echo "ERROR: missing argument!"
|
||||
echo "Please call $0 with \$startdir \$pkgname \$subpkgname as arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
srcdir="$startdir/src"
|
||||
pkgdir="$startdir/pkg/$pkgname"
|
||||
subpkgdir="$startdir/pkg/$subpkgname"
|
||||
|
||||
if [ -e "$pkgdir/etc/deviceinfo" ]; then
|
||||
rm -v "$pkgdir/etc/deviceinfo"
|
||||
fi
|
||||
|
||||
install -Dm644 "$srcdir/deviceinfo" \
|
||||
"$subpkgdir/etc/deviceinfo"
|
||||
|
||||
# Get the kernel type ("downstream", "mainline")
|
||||
kernel=$(echo "$subpkgname" | sed -n "s/.*-kernel-\(.*\)/\1/p")
|
||||
|
||||
# Iterate over deviceinfo variables that have the kernel type as suffix
|
||||
# var looks like: deviceinfo_kernel_cmdline, ...
|
||||
grep -E "(.+)_$kernel=.*" "$subpkgdir/etc/deviceinfo" | \
|
||||
sed "s/\(.\+\)_$kernel=.*/\1/g" | while IFS= read -r var
|
||||
do
|
||||
if grep -Eq "$var=.*" "$subpkgdir/etc/deviceinfo"; then
|
||||
echo "ERROR: variable '$var' should contain a kernel subpackage suffix"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove the kernel suffix from the variable
|
||||
sed -i "s/$var\_$kernel/$var/g" "$subpkgdir/etc/deviceinfo"
|
||||
|
||||
# Remove the variables with other kernel suffixes
|
||||
sed -i "/$var\_.*=.*/d" "$subpkgdir/etc/deviceinfo"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue