diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 08:09:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 08:09:27 +0000 |
commit | 45acc200b4c8b4e03d0d8cb46258ef21720e90c3 (patch) | |
tree | 75adeca7e23385cb92ef6211455bc6bf3b5b231f /debian/templates/preinst.license.in | |
parent | Adding upstream version 20230625. (diff) | |
download | firmware-nonfree-45acc200b4c8b4e03d0d8cb46258ef21720e90c3.tar.xz firmware-nonfree-45acc200b4c8b4e03d0d8cb46258ef21720e90c3.zip |
Adding debian version 20230625-2.debian/20230625-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debian/templates/preinst.license.in | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/templates/preinst.license.in b/debian/templates/preinst.license.in new file mode 100644 index 0000000..6c68221 --- /dev/null +++ b/debian/templates/preinst.license.in @@ -0,0 +1,76 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule +db_version 2.0 +db_capb backup + +#Valid values are "required" and "no-preseed" +license_accept=@license-accept@ + +errmsg() +{ + echo >&2 '' + echo >&2 "$@" + echo >&2 "try 'dpkg-reconfigure debconf' to select a frontend other than noninteractive" + echo >&2 '' +} + +ask() +{ + # facilitate backup capability per debconf-devel(7) + STATE=1 + while true; do + case "$STATE" in + 0) # ensure going back from license presentment is harmless + STATE=1 + continue + ;; + 1) # present license + db_get firmware-@package@/license/accepted + if [ "$RET" != true -o "${license_accept}" = "no-preseed" ]; then + db_fset firmware-@package@/license/accepted seen false + if ! db_input critical firmware-@package@/license/accepted ; then + errmsg "firmware-@package@ agree question could not be asked" + exit 2 + fi + fi + ;; + 2) # determine users' choice + db_get firmware-@package@/license/accepted + if [ "$RET" = "true" ]; then + exit 0 + fi + # error on decline license (give user chance to back up) + db_input critical firmware-@package@/license/error + ;; + 3) + echo "user did not accept the firmware-@package@ license" >&2 + exit 1 + ;; + *) # unknown state + echo "firmware-@package@ license state unknown: $STATE" >&2 + exit 2 + ;; + esac + if db_go; then + STATE=$(($STATE + 1)) + else + STATE=$(($STATE - 1)) + fi + done +} + +if [ "$@package-env-prefix@_LICENSE_READ_AND_ACCEPTED" = yes ]; then + db_set firmware-@package@/license/accepted true +fi + +db_get firmware-@package@/license/accepted +if [ "$RET" != "true" ]; then + ask + RESULT=$? + [ "$RESULT" = 0 ] || exit $RESULT +fi + +#DEBHELPER# + +exit 0 |