config is in neurodebian 0.37.2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #!/bin/bash
set -e
. /usr/share/debconf/confmodule
db_capb backup # allow to go back, for that we implement that STATE loop
debug()
{
[ "${DEBCONF_DEBUG:-}" != "developer" ] || echo -e "D: $*" >&2
}
db_settitle neurodebian/title
if [ "$1" = "configure" ]; then
# Must have been called in preinst state, so no nd-configurerepo
# tool is yet installed, thus delay asking questions to
# whenever will be called in postinst state
which nd-configurerepo 1>/dev/null 2>&1 || exit 0
fi
# Create temporary directory which will be reused
export ND_AE_TEMPDIR=$(mktemp -d)
trap "rm -rf \"$ND_AE_TEMPDIR\"" TERM INT EXIT
neurodebian_releases="auto"
# This implements a simple state machine so the back button can be handled.
# taken from debconf demo example
STATE=1
while [ "$STATE" != 0 -a "$STATE" -lt 9 ]; do
case $STATE in
1)
# allow to be overridden by environment variable as discussed with
# ftpmaster
if [ ! -z "${NEURODEBIAN_ENABLE:-}" ]; then
case "${NEURODEBIAN_ENABLE}" in
true|yes|YES|1) enable=true;;
false|no|NO|0) enable=false;;
*) echo "ERROR: Non-supported value $NEURODEBIAN_ENABLE of NEURODEBIAN_ENABLE env variable. Use yes or no" >&2;
exit 1;;
esac
db_set neurodebian/enable $enable
fi
db_input high neurodebian/enable || true
;;
2)
neurodebian_releases="$(ND_IFS=', ' nd-configurerepo --print-releases)"
debian_release="$(ND_IFS=', ' nd-configurerepo --print-release)"
if [ -z "$debian_release" ]; then # just a failover
debian_release="sid"
fi
debug "releases: $neurodebian_releases"
db_subst neurodebian/release releases "$neurodebian_releases"
db_subst neurodebian/release release "$debian_release"
db_input medium neurodebian/release || true
;;
3)
neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)"
debug "mirrors: $neurodebian_mirrors"
db_subst neurodebian/mirror mirrors "$neurodebian_mirrors"
db_input medium neurodebian/mirror || true
mirror_selection_ret="$RET"
debug "mirror select return: <$mirror_selection_ret>"
;;
4) neurodebian_flavor="$(ND_IFS=', ' nd-configurerepo --print-flavor)"
db_subst neurodebian/flavor flavor "$neurodebian_flavor"
db_input medium neurodebian/flavor || true ;;
5) db_input medium neurodebian/components || true ;;
6) db_input low neurodebian/suffix || true ;;
7) db_input low neurodebian/overwrite || true ;;
8) db_input medium neurodebian/run-update-note || true ;;
esac
if db_go; then
case $STATE in
1)
db_get neurodebian/enable # get new value
if [ "$RET" = "false" ]; then
# no need to proceed with further questions
if ls /etc/apt/sources.list.d/neurodebian.sources*.list &>/dev/null; then
# we have configuration present -- display a note about apt-get update
STATE=8
else
STATE=100 # just go out -- nothing to do, nothing to inform about
fi
continue
fi;;
# Ubuntus managed to remove netselect "to accompany apt-netselect"
# https://bugs.launchpad.net/ubuntu/+source/netselect/+bug/337377
# So for now remove this mandatory demanding of netselect for "best", and
# rely on logic in nd-configurerepo to select default mirror (currently origin)
# as the 'best'
#
# 3)
# db_metaget neurodebian/mirror value
# selected_mirror="$RET"
# # TODOs:
# # - handle custom
# # - separate out alias from url
# debug "selected mirror: $selected_mirror"
# if [ "$selected_mirror" = "best" ] && ! which netselect &>/dev/null; then
# if [ "$mirror_selection_ret" = "30 question skipped" ]; then
# # if the question was not even shown, we would
# # not get a chance to specify mirror, thus
# # better just fail altogether and demand intervention
# db_input high neurodebian/netselect-cannot-be-used
# exit 1
# else
# db_input high neurodebian/netselect-not-found
# continue;
# fi
# fi
esac
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
done
db_stop
|