From 7fc022c3b4b29b480d8af5cba89465f54c34e8d4 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 14 Aug 2014 12:47:01 -0400 Subject: [PATCH] ENH: added an explicit question (and even a warning note) to debconf of neurodebian. NEURODEBIAN_ENABLE env can override default/current value --- debian/TODO | 2 - debian/changelog | 9 +++- debian/neurodebian.config | 46 ++++++++++++++++----- debian/neurodebian.postinst | 46 ++++++++++++--------- debian/neurodebian.templates | 20 +++++++-- debian/po/templates.pot | 80 ++++++++++++++++++++++++------------ 6 files changed, 138 insertions(+), 65 deletions(-) diff --git a/debian/TODO b/debian/TODO index 4b50e0b..0e69205 100644 --- a/debian/TODO +++ b/debian/TODO @@ -51,5 +51,3 @@ apt-cache policy | grep o=NeuroDebian,.*,n=$release echo "I: success" *** ~/bin/docker-debians-run /bin/bash -c "apt-get -y update >/dev/null; apt-get install -y wget >/dev/null; bash <(wget -q --no-check-certificate -O- https://raw.githubusercontent.com/yarikoptic/neurodebian/enh/neurodebian-installer/tools/nd-configurerepo) --overwrite --install --mirror=us-nh" - -* TODO use NEURODEBIAN_ENABLE env variable in postinst, add explicit option diff --git a/debian/changelog b/debian/changelog index a2b4724..6b1f5e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,8 +10,8 @@ neurodebian (0.34) unstable; urgency=medium - moved virtualbox-guest* dependencies into Depends (from Pre-Depends), and stripping deprecated -ose suffix - dropped depends on elderly gdm, now lightdm or any x-display-manager - - fixing package names for chromium, and removing update-manager-gnome - N/A in sid + - fixing package names for chromium, and removing update-manager-gnome + N/A in sid * debian/neurodebian-popularity-contest.* - .postinst should try to remove old-fashion popcon entry only if upgrading/configuring from pre 0.33 version of neurodebian-* @@ -21,6 +21,11 @@ neurodebian (0.34) unstable; urgency=medium - use long GPG key id - unify prefix for environment variables to be NEURODEBIAN_ instead of more cryptic ND_AE_ + * tools/neurodebian.{preinst,templates,config} + - add an explicit question either NeuroDebian APT configuration should + be installed (i.e. NeuroDebian repository being enabled). debconf + default/value could be overriden from the environment using + NEURODEBIAN_ENABLE. -- Yaroslav Halchenko Wed, 13 Aug 2014 13:43:13 -0400 diff --git a/debian/neurodebian.config b/debian/neurodebian.config index ea6f628..2d89688 100755 --- a/debian/neurodebian.config +++ b/debian/neurodebian.config @@ -28,9 +28,23 @@ 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" != 8 ]; do +while [ "$STATE" != 0 -a "$STATE" -lt 9 ]; do case $STATE in - 1) + 1) + # allow to be overriden 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 "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 medium 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 @@ -41,7 +55,7 @@ while [ "$STATE" != 0 -a "$STATE" != 8 ]; do db_subst neurodebian/release release "$debian_release" db_input medium neurodebian/release || true ;; - 2) + 3) neurodebian_mirrors="$(ND_IFS=', ' nd-configurerepo --print-mirrors)" debug "mirrors: $neurodebian_mirrors" db_subst neurodebian/mirror mirrors "$neurodebian_mirrors" @@ -49,24 +63,36 @@ while [ "$STATE" != 0 -a "$STATE" != 8 ]; do mirror_selection_ret="$RET" debug "mirror select return: <$mirror_selection_ret>" ;; - 3) neurodebian_flavor="$(ND_IFS=', ' nd-configurerepo --print-flavor)" + 4) neurodebian_flavor="$(ND_IFS=', ' nd-configurerepo --print-flavor)" db_subst neurodebian/flavor flavor "$neurodebian_flavor" db_input medium neurodebian/flavor || true ;; - 4) db_input medium neurodebian/components || true ;; - 5) db_input low neurodebian/overwrite || true ;; + 5) db_input medium neurodebian/components || true ;; 6) db_input low neurodebian/suffix || true ;; - 7) db_input medium neurodebian/run-update-note || 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 /bin/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' # -# case $STATE in -# 2) +# 3) # db_metaget neurodebian/mirror value # selected_mirror="$RET" # # TODOs: @@ -85,7 +111,7 @@ while [ "$STATE" != 0 -a "$STATE" != 8 ]; do # continue; # fi # fi -# esac + esac STATE=$(($STATE + 1)) else STATE=$(($STATE - 1)) diff --git a/debian/neurodebian.postinst b/debian/neurodebian.postinst index 97cbc86..0e3a3f5 100755 --- a/debian/neurodebian.postinst +++ b/debian/neurodebian.postinst @@ -7,26 +7,32 @@ set -e case "$1" in configure) - # obtain all the options and call nd-configurerepo - opts="--do-not-update" - db_get neurodebian/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'" - db_get neurodebian/mirror; nd_mirror="${RET##* }" # get just a url if it came together with alias - db_get neurodebian/flavor; nd_flavor="$RET" - db_get neurodebian/components; nd_components="${RET// /}" - - db_get neurodebian/overwrite; [ "$RET" = "true" ] && opts+=" --overwrite" || : - db_get neurodebian/suffix; [ "$RET" = "" ] || opts+=" --suffix='$RET'" || : - - eval nd-configurerepo -m "$nd_mirror" -c "$nd_components" $opts - ;; - abort-upgrade|abort-remove|abort-deconfigure) - # nothing to do - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; + db_get neurodebian/enable + if [ "$RET" = "true" ]; then + # obtain all the options and call nd-configurerepo + opts="--do-not-update" + db_get neurodebian/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'" + db_get neurodebian/mirror; nd_mirror="${RET##* }" # get just a url if it came together with alias + db_get neurodebian/flavor; nd_flavor="$RET" + db_get neurodebian/components; nd_components="${RET// /}" + + db_get neurodebian/overwrite; [ "$RET" = "true" ] && opts+=" --overwrite" || : + db_get neurodebian/suffix; [ "$RET" = "" ] || opts+=" --suffix='$RET'" || : + + eval nd-configurerepo -m "$nd_mirror" -c "$nd_components" $opts + else + # removing neurodebian APT configs + rm -f /etc/apt/sources.list.d/neurodebian.sources*.list + fi + ;; + abort-upgrade|abort-remove|abort-deconfigure) + # nothing to do + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; esac #DEBHELPER# diff --git a/debian/neurodebian.templates b/debian/neurodebian.templates index 03d814b..f46a40b 100644 --- a/debian/neurodebian.templates +++ b/debian/neurodebian.templates @@ -2,6 +2,18 @@ Template: neurodebian/title Type: title _Description: NeuroDebian APT repository installer +Template: neurodebian/enable +Type: boolean +Default: false +_Description: Should NeuroDebian repository be enabled? + NeuroDebian project provides a separate APT repository with backport + builds of most recent releases of maintained software, datasets and + some software not in Debian proper yet. Enabling this additional + repository will make those packages available on your base system. + . + Note: although NeuroDebian team aims to assure robust and correct + operation of provided packages, enabling this additional archive + might compromise the integrity of your base system. Template: neurodebian/release Type: select @@ -86,10 +98,10 @@ _Description: Additional suffix for the NeuroDebian APT file name: Template: neurodebian/run-update-note Type: note _Description: APT list of packages needs to be updated - For the installed NeuroDebian APT configuration to take an effect, - list of packages needs to be updated. This needs to be done - "manually" (e.g., via apt-get update) upon completion of installation - of the neurodebian package. + For the installed (or removed) NeuroDebian APT configuration to take + an effect, list of packages needs to be updated. This needs to be + done "manually" (e.g., via apt-get update) upon completion of + installation or reconfiguration of the neurodebian package. Template: neurodebian/netselect-not-found Type: error diff --git a/debian/po/templates.pot b/debian/po/templates.pot index 8d51e48..0ef0771 100644 --- a/debian/po/templates.pot +++ b/debian/po/templates.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: neurodebian\n" "Report-Msgid-Bugs-To: neurodebian@packages.debian.org\n" -"POT-Creation-Date: 2014-08-13 14:01-0400\n" +"POT-Creation-Date: 2014-08-14 12:27-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -23,21 +23,46 @@ msgstr "" msgid "NeuroDebian APT repository installer" msgstr "" -#. Type: select +#. Type: boolean +#. Description +#: ../neurodebian.templates:2001 +msgid "Should NeuroDebian repository be enabled?" +msgstr "" + +#. Type: boolean +#. Description +#: ../neurodebian.templates:2001 +msgid "" +"NeuroDebian project provides a separate APT repository with backport builds " +"of most recent releases of maintained software, datasets and some software " +"not in Debian proper yet. Enabling this additional repository will make " +"those packages available on your base system." +msgstr "" + +#. Type: boolean #. Description #: ../neurodebian.templates:2001 +msgid "" +"Note: although NeuroDebian team aims to assure robust and correct operation " +"of provided packages, enabling this additional archive might compromise the " +"integrity of your base system." +msgstr "" + +#. Type: select +#. Description +#: ../neurodebian.templates:3001 msgid "Release name of the base system:" msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:2001 +#: ../neurodebian.templates:3001 msgid "Specify for which Debian or Ubuntu release (e.g. wheezy or trusty)." msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:2001 +#: ../neurodebian.templates:3001 msgid "" "If 'auto', Debian or Ubuntu release name will be '${release}' as deduced " "from the output of apt-cache policy. If the release of your system is not " @@ -46,13 +71,13 @@ msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:3001 +#: ../neurodebian.templates:4001 msgid "NeuroDebian mirror to use:" msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:3001 +#: ../neurodebian.templates:4001 msgid "" "NeuroDebian project has a number of community-maintainer mirrors around the " "globe." @@ -60,13 +85,13 @@ msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:3001 +#: ../neurodebian.templates:4001 msgid "If you do not know which mirror URL to choose, select among" msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:3001 +#: ../neurodebian.templates:4001 msgid "" " - origin: original NeuroDebian repository\n" " - best: will try to use netselect to select \"closest\" mirror.\n" @@ -77,13 +102,13 @@ msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:4001 +#: ../neurodebian.templates:5001 msgid "NeuroDebian flavor to use:" msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:4001 +#: ../neurodebian.templates:5001 msgid "" "NeuroDebian project adheres to Debian Free Software Guidelines and has three " "areas of the archive in all suites/releases:" @@ -91,7 +116,7 @@ msgstr "" #. Type: select #. Description -#: ../neurodebian.templates:4001 +#: ../neurodebian.templates:5001 msgid "" " libre\n" " only the DFSG-compliant materials\n" @@ -104,19 +129,19 @@ msgstr "" #. Type: multiselect #. Description -#: ../neurodebian.templates:5001 +#: ../neurodebian.templates:6001 msgid "NeuroDebian repository components to enable:" msgstr "" #. Type: multiselect #. Description -#: ../neurodebian.templates:5001 +#: ../neurodebian.templates:6001 msgid "NeuroDebian repository provides" msgstr "" #. Type: multiselect #. Description -#: ../neurodebian.templates:5001 +#: ../neurodebian.templates:6001 msgid "" " software\n" " Packages containing software packages, often backports of stable\n" @@ -132,13 +157,13 @@ msgstr "" #. Type: boolean #. Description -#: ../neurodebian.templates:6001 +#: ../neurodebian.templates:7001 msgid "Should existing NeuroDebian APT file be overridden?" msgstr "" #. Type: boolean #. Description -#: ../neurodebian.templates:6001 +#: ../neurodebian.templates:7001 msgid "" "If not allowed, configuration would fail if there is an existing apt " "configuration file for the NeuroDebian." @@ -146,13 +171,13 @@ msgstr "" #. Type: string #. Description -#: ../neurodebian.templates:7001 +#: ../neurodebian.templates:8001 msgid "Additional suffix for the NeuroDebian APT file name:" msgstr "" #. Type: string #. Description -#: ../neurodebian.templates:7001 +#: ../neurodebian.templates:8001 msgid "" "For instance if you would like to enable additional repository (e.g. " "NeuroDebian devel) or release, without interfering with the main/default " @@ -161,28 +186,29 @@ msgstr "" #. Type: note #. Description -#: ../neurodebian.templates:8001 +#: ../neurodebian.templates:9001 msgid "APT list of packages needs to be updated" msgstr "" #. Type: note #. Description -#: ../neurodebian.templates:8001 +#: ../neurodebian.templates:9001 msgid "" -"For the installed NeuroDebian APT configuration to take an effect, list of " -"packages needs to be updated. This needs to be done \"manually\" (e.g., via " -"apt-get update) upon completion of installation of the neurodebian package." +"For the installed (or removed) NeuroDebian APT configuration to take an " +"effect, list of packages needs to be updated. This needs to be done " +"\"manually\" (e.g., via apt-get update) upon completion of installation or " +"reconfiguration of the neurodebian package." msgstr "" #. Type: error #. Description -#: ../neurodebian.templates:9001 +#: ../neurodebian.templates:10001 msgid "netselect tool was not found!" msgstr "" #. Type: error #. Description -#: ../neurodebian.templates:9001 +#: ../neurodebian.templates:10001 msgid "" "Please install netselect tool first (apt-get install netselect) or choose a " "specific mirror." @@ -190,13 +216,13 @@ msgstr "" #. Type: error #. Description -#: ../neurodebian.templates:10001 +#: ../neurodebian.templates:11001 msgid "netselect tool was not found (no other mirror)!" msgstr "" #. Type: error #. Description -#: ../neurodebian.templates:10001 +#: ../neurodebian.templates:11001 msgid "" "Please install netselect tool first (apt-get install netselect) before " "installing/configuring this package, or run with a lower DEBIAN_PRIORITY to " -- 2.39.2