create-mksspec.sh: Add support for OS-cascade

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-06-19 09:33:12 +00:00
commit c84f7b3f84

View file

@ -39,6 +39,18 @@ subpackage_description()
esac esac
} }
os_cascade()
{
# might want to run python3 path/to/projects.py --os=suse-tumbleweed os-cascade
# or turn this into a python script and use projects.py as a module.
if [ "$DISTRIBUTION" ]; then
echo os linux $DISTRIBUTION | sed 's/\([^-]\+\)-\([^-]\+\)/\1 \1-\2/g'
else
echo os linux
fi
}
# -- here we go # -- here we go
echo "== running $0" "$@" >&2 echo "== running $0" "$@" >&2
@ -123,16 +135,29 @@ for p in $subpackages; do
for stage in pre preun post postun; do for stage in pre preun post postun; do
echo "== processing stage $stage: cfg_section pkg.$p.$stage" >&2 echo "== processing stage $stage: cfg_section pkg.$p.$stage" >&2
cfg_section pkg.$p.$stage >&2 out=""
cfg_section pkg.$p.$stage | grep -q . && { #for os in '' `os_cascade | sed 's/\(^\| \)/ ./g'`; do
for os in '' `os_cascade`; do
sec=pkg.$p.$stage
if [ "$os" ]; then
sec="$sec.$os"
head="\n# --- $os\n"
else
head=""
fi
cfg_section $sec | grep -q . || continue
out="$out$head`cfg_section $sec`"
done
if [ "$out" ]; then
echo -e "$out" >&2
_cat <<- EOT _cat <<- EOT
|echo "" |echo ""
|echo "%$stage -n \$NAME-$p" |echo "%$stage -n \$NAME-$p"
EOT EOT
echo "cat << EOT" echo "cat << EOT"
cfg_section pkg.$p.$stage | cfg_escape echo -e "$out" | cfg_escape
echo "EOT" echo "EOT"
} fi
done done
_cat <<- EOT _cat <<- EOT