mirror_ubuntu-kernels/debian/scripts/control-create
You-Sheng Yang (vicamo) 3fcc97ecd6 UBUNTU: [Packaging] support standalone dkms module builds
BugLink: https://bugs.launchpad.net/bugs/1969434

Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
2022-06-15 14:12:51 +02:00

68 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
. debian/debian.env
vars=$1
any_signed=$2
. $vars
[ "$provides" != '' ] && provides="$provides, "
if [ "$is_sub" = "" ]; then
flavour=$(basename $vars | sed 's/.*\.//')
stub="${DEBIAN}/control.d/flavour-control.stub debian/control.d/flavour-buildinfo.stub"
if [ "$any_signed" = 'true' ]; then
sign_me_pkg="-unsigned"
sign_me_txt=" unsigned"
sign_peer_pkg=""
else
sign_me_pkg=""
sign_me_txt=""
sign_peer_pkg="-unsigned"
fi
else
flavour=$(basename $vars .vars)
stub=${DEBIAN}/sub-flavours/control.stub
fi
cat $stub | grep -v '^#' | sed \
-e "s#FLAVOUR#$flavour#g" \
-e "s#DESC#$desc#g" \
-e "s#ARCH#$arch#g" \
-e "s#SUPPORTED#$supported#g" \
-e "s#TARGET#$target#g" \
-e "s#BOOTLOADER#$bootloader#g" \
-e "s#=PROVIDES=#$provides#g" \
-e "s#=CONFLICTS=#$conflicts#g" \
-e "s#=SIGN-ME-PKG=#$sign_me_pkg#g" \
-e "s#=SIGN-ME-TXT=#$sign_me_txt#g" \
-e "s#=SIGN-PEER-PKG=#$sign_peer_pkg#g"
while read package version extras
do
module="$package"
module_type=
# Module arch parameters are skipped here, so a package section will
# be generated for each flavour, and its Architecture will be set to
# all architectures with that flavour. Even that is being generated,
# it doesn't follow all of them will be built. That's to work-around
# dkms_exclude/dkms_include that manipulates supported architectures
# in $(DEBIAN)/rules.d/$(arch).mk.
for param in $extras; do
case "$param" in
modulename=*) module="${param#modulename=}" ;;
type=*) module_type="${param#type=}" ;;
*) continue ;;
esac
done
[ "$module_type" = "standalone" ] || continue
cat debian/control.d/flavour-module.stub | grep -v '^#' | sed \
-e "s#ARCH#$arch#g" \
-e "s#MODULE#$module#g" \
-e "s#FLAVOUR#$flavour#g"
done <"debian/dkms-versions"