4 . /usr/share/debconf/confmodule
6 db_capb backup # allow to go back, for that we implement that STATE loop
10 [ "${DEBCONF_DEBUG:-}" != "developer" ] || echo -e "D: $*" >&2
13 db_settitle neurodebian/title
15 if [ "$1" = "configure" ]; then
16 # Must have been called in preinst state, so no nd-configurerepo
17 # tool is yet installed, thus delay asking questions to
18 # whenever will be called in postinst state
19 which nd-configurerepo 1>/dev/null 2>&1 || exit 0
22 # Create temporary directory which will be reused
23 export ND_AE_TEMPDIR=$(mktemp -d)
24 trap "rm -rf \"$ND_AE_TEMPDIR\"" TERM INT EXIT
26 neurodebian_releases="auto"
28 # This implements a simple state machine so the back button can be handled.
29 # taken from debconf demo example
31 while [ "$STATE" != 0 -a "$STATE" != 8 ]; do
34 neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)"
35 debian_release="$(ND_IFS=', ' nd-configurerepo --print-release)"
36 if [ -z "$debian_release" ]; then # just a failover
39 debug "releases: $neurodebian_releases"
40 db_subst neurodebian/release releases "$neurodebian_releases"
41 db_subst neurodebian/release release "$debian_release"
42 db_input medium neurodebian/release || true
45 neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)"
46 debug "mirrors: $neurodebian_mirrors"
47 db_subst neurodebian/mirror mirrors "$neurodebian_mirrors"
48 db_input medium neurodebian/mirror || true
49 mirror_selection_ret="$RET"
50 debug "mirror select return: <$mirror_selection_ret>"
52 3) neurodebian_flavor="$(ND_IFS=', ' nd-configurerepo --print-flavor)"
53 db_subst neurodebian/flavor flavor "$neurodebian_flavor"
54 db_input medium neurodebian/flavor || true ;;
55 4) db_input medium neurodebian/components || true ;;
56 5) db_input low neurodebian/overwrite || true ;;
57 6) db_input low neurodebian/suffix || true ;;
58 7) db_input medium neurodebian/run-update-note || true ;;
62 # Ubuntus managed to remove netselect "to accompany apt-netselect"
63 # https://bugs.launchpad.net/ubuntu/+source/netselect/+bug/337377
64 # So for now remove this mandatory demanding of netselect for "best", and
65 # rely on logic in nd-configurerepo to select default mirror (currently origin)
70 # db_metaget neurodebian/mirror value
71 # selected_mirror="$RET"
74 # # - separate out alias from url
75 # debug "selected mirror: $selected_mirror"
76 # if [ "$selected_mirror" = "best" ] && ! which netselect &>/dev/null; then
77 # if [ "$mirror_selection_ret" = "30 question skipped" ]; then
78 # # if the question was not even shown, we would
79 # # not get a chance to specify mirror, thus
80 # # better just fail altogether and demand intervention
81 # db_input high neurodebian/netselect-cannot-be-used
84 # db_input high neurodebian/netselect-not-found