mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 13:08:42 +00:00
debian: acrn-hypervisor: Refactor debconf
Tracked-On: #6688 Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com>
This commit is contained in:
parent
e49f18f1f3
commit
46416f9fc4
13
debian/acrn-hypervisor.config
vendored
13
debian/acrn-hypervisor.config
vendored
@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Exit on error
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Source debconf library.
|
|
||||||
. /usr/share/debconf/confmodule
|
|
||||||
|
|
||||||
# query board
|
|
||||||
db_input critical acrn-hypervisor/board || true
|
|
||||||
|
|
||||||
# Show interface
|
|
||||||
db_go || true
|
|
44
debian/acrn-hypervisor.config.in
vendored
Normal file
44
debian/acrn-hypervisor.config.in
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# inspired by http://www.fifi.org/doc/debconf-doc/tutorial.html
|
||||||
|
|
||||||
|
# Exit on error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Source debconf library.
|
||||||
|
. /usr/share/debconf/confmodule
|
||||||
|
db_version 2.0
|
||||||
|
|
||||||
|
# This conf script is capable of backing up
|
||||||
|
db_capb backup
|
||||||
|
|
||||||
|
ACRNDIR=@acrndir@
|
||||||
|
declare -A SCENARIOS=@scenarios@
|
||||||
|
STATE="board"
|
||||||
|
while [ "$STATE" != "quit" -a "$STATE" != "done" ]; do
|
||||||
|
case "$STATE" in
|
||||||
|
board)
|
||||||
|
# query board
|
||||||
|
db_input critical acrn-hypervisor/board || true
|
||||||
|
if db_go; then
|
||||||
|
STATE="scenario"
|
||||||
|
else
|
||||||
|
STATE="quit"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
scenario)
|
||||||
|
db_get acrn-hypervisor/board
|
||||||
|
db_subst acrn-hypervisor/scenario scenariolist ${SCENARIOS[${RET}]}
|
||||||
|
db_clear
|
||||||
|
db_input critical acrn-hypervisor/scenario || true
|
||||||
|
if db_go; then
|
||||||
|
STATE="done"
|
||||||
|
else
|
||||||
|
STATE="board"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# trigger grub update
|
||||||
|
dpkg-trigger --await --by-package=acrn-hypervisor grub-acrn-update
|
||||||
|
|
10
debian/acrn-hypervisor.postinst.in
vendored
10
debian/acrn-hypervisor.postinst.in
vendored
@ -11,16 +11,6 @@ ACRNDIR=@acrndir@
|
|||||||
|
|
||||||
db_get acrn-hypervisor/board
|
db_get acrn-hypervisor/board
|
||||||
BOARD=${RET}
|
BOARD=${RET}
|
||||||
|
|
||||||
SCENARIOS=$(find ${ACRNDIR}/${BOARD} -maxdepth 1 -type d \
|
|
||||||
| tail -n +2 | sed "s#${ACRNDIR}/${BOARD}/##" \
|
|
||||||
| sort | awk '{s=s (s?OFS:x) $1} END {print s}' OFS=", ")
|
|
||||||
|
|
||||||
db_subst acrn-hypervisor/scenario scenariolist ${SCENARIOS}
|
|
||||||
db_clear
|
|
||||||
db_input critical acrn-hypervisor/scenario || true
|
|
||||||
db_go || true
|
|
||||||
|
|
||||||
db_get acrn-hypervisor/scenario
|
db_get acrn-hypervisor/scenario
|
||||||
SCENARIO=${RET}
|
SCENARIO=${RET}
|
||||||
|
|
||||||
|
7
debian/acrn-hypervisor.postrm.in
vendored
7
debian/acrn-hypervisor.postrm.in
vendored
@ -30,9 +30,12 @@ rm_acrn()
|
|||||||
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
remove|purge)
|
remove)
|
||||||
rm_acrn
|
rm_acrn
|
||||||
db_purge acrn-hypervisor || :
|
;;
|
||||||
|
purge)
|
||||||
|
rm_acrn
|
||||||
|
db_purge acrn-hypervisor || :
|
||||||
;;
|
;;
|
||||||
upgrade)
|
upgrade)
|
||||||
rm_acrn
|
rm_acrn
|
||||||
|
3
debian/control
vendored
3
debian/control
vendored
@ -59,7 +59,8 @@ Depends:
|
|||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
grub-acrn,
|
grub-acrn,
|
||||||
acrn-devicemodel,
|
acrn-devicemodel,
|
||||||
debconf (>=1.5.71)
|
debconf (>=1.5.71),
|
||||||
|
bash (>=4)
|
||||||
Suggests: acrn-doc
|
Suggests: acrn-doc
|
||||||
Recommends: setserial
|
Recommends: setserial
|
||||||
Description: ACRN Hypervisor for IoT
|
Description: ACRN Hypervisor for IoT
|
||||||
|
9
debian/rules
vendored
9
debian/rules
vendored
@ -165,7 +165,14 @@ debian/acrn-hypervisor.templates: debian/acrn-hypervisor.templates.in
|
|||||||
@$(call echo-silent,CREATE $@)
|
@$(call echo-silent,CREATE $@)
|
||||||
$(Q)sed -e 's/@boardlist@/$(call commasep,$(boardlist))/g' $< > $@
|
$(Q)sed -e 's/@boardlist@/$(call commasep,$(boardlist))/g' $< > $@
|
||||||
|
|
||||||
override_dh_installdebconf-arch: debian/acrn-hypervisor.templates
|
debian/acrn-hypervisor.config: debian/acrn-hypervisor.config.in
|
||||||
|
@$(call echo-verbose)
|
||||||
|
@$(call echo-silent,CREATE $@)
|
||||||
|
@# create scenarios as bash associative array
|
||||||
|
$(Q)sed -e 's%@acrndir@%$(libdir)/acrn%g' \
|
||||||
|
-e 's%@scenarios@%($(foreach b,$(boardlist),[$b]="$(call commasep,$(scenariolist_$b))"))%g' $< > $@
|
||||||
|
|
||||||
|
override_dh_installdebconf-arch: debian/acrn-hypervisor.templates debian/acrn-hypervisor.config
|
||||||
$(Q)dh_installdebconf -a
|
$(Q)dh_installdebconf -a
|
||||||
|
|
||||||
### build-arch ###############################################################
|
### build-arch ###############################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user