]> git.donarmstrong.com Git - neurodebian.git/commitdiff
BF: right -- we can't apt-get update while installing the package (via apt at least...
authorYaroslav Halchenko <debian@onerussian.com>
Tue, 29 Jul 2014 01:04:54 +0000 (21:04 -0400)
committerYaroslav Halchenko <debian@onerussian.com>
Tue, 29 Jul 2014 02:08:05 +0000 (22:08 -0400)
+ various fixups

debian/neurodebian-repository.config
debian/neurodebian-repository.postinst
debian/neurodebian-repository.postrm
debian/neurodebian-repository.templates
tools/nd-aptenable

index 6f36006e991e7f0700e8230ac3a6552b837820f2..a40f1533e409cfd6b4510ca49018b4aafeaf7d46 100755 (executable)
@@ -48,7 +48,7 @@ while [ "$STATE" != 0 -a "$STATE" != 8 ]; do
         4)  db_input medium neurodebian-repository/components || true ;;
         5)  db_input low neurodebian-repository/overwrite || true ;;
         6)  db_input low neurodebian-repository/suffix || true ;;
-        7)  db_input low neurodebian-repository/apt-update || true ;;
+        7)  db_input medium neurodebian-repository/run-update-note || true ;;
     esac
 
     if db_go; then
index d514acc50a1ec6c93f02a98b5a6fa65c1ddf0483..49dda25b59e0b7dfea29940cc3aa92c38f181448 100755 (executable)
@@ -8,17 +8,16 @@ set -e
 case "$1" in
     configure)
                # obtain all the options and call nd-aptenable
-               opts=""
+               opts="--do-not-update"
                db_get neurodebian-repository/release; [ "$RET" = "auto" ] || opts+=" -r '$RET'"
                db_get neurodebian-repository/mirror;  nd_mirror="${RET##* }" # get just a url if it came together with alias
                db_get neurodebian-repository/flavor;  nd_flavor="$RET"
-               db_get neurodebian-repository/components; nd_components="$RET"
+               db_get neurodebian-repository/components; nd_components="${RET// /}"
 
                db_get neurodebian-repository/overwrite;  [ "$RET" = "true" ] && opts+=" --overwrite" || :
                db_get neurodebian-repository/suffix;     [ "$RET" = "" ]     || opts+=" --suffix='$RET'" || :
-               db_get neurodebian-repository/apt-update; [ "$RET" = "true" ] || opts+=" --do-not-update" || :
 
-               eval nd-aptenable -m "$nd_mirror" $opts
+               eval nd-aptenable -m "$nd_mirror" -c "$nd_components" $opts
     ;;
     abort-upgrade|abort-remove|abort-deconfigure)
         # nothing to do
index 2c92f0fc228313527196dd56ef58fdb748137a95..902c3f49122b01d6d34d11cd1576e3b1e292d38b 100755 (executable)
@@ -2,14 +2,9 @@
 
 set -e
 
-
 case "$1" in
     purge)
                rm -f /etc/apt/sources.list.d/neurodebian.sources*.list
-               db_get neurodebian-repository/apt-update || :
-               if [ "$RET" = "true" ] ; then
-                  apt-get update
-               fi
     ;;
 
     remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
index e4293b89add98b4f7975c9ca6cd8d4e5982afd4e..5a206a491a09d3df7e37d0fa5afe27786df21b28 100644 (file)
@@ -82,22 +82,13 @@ Description: Additional suffix to use in the NeuroDebian APT file name
  (e.g. NeuroDebian devel) or release, without interfering with the
  main/default configuration file.
 
-Template: neurodebian-repository/apt-update
-Type: boolean
-Default: true
-Description: Should apt-get update be run to update list of packages?
-
-Template: neurodebian-repository/apt-update-failed
-Type: error
-Description: apt-get update failed
- An attempt to update package lists of enabled APT repositories (via
- apt-get update) has failed.
-
-Template: neurodebian-repository/netselect-not-found
-Type: error
-Description: netselect tool was not found
- Please install netselect tool first (apt-get install netselect) or
- choose a specific mirror.
+Template: neurodebian-repository/run-update-note
+Type: note
+Description: Upon completion of installation invoke update in your APT frontend.
+ 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. apt-get update) upon completion of installation of
+ the neurodebian-repository package.
 
 Template: neurodebian-repository/netselect-not-found
 Type: error
index d6f5192106887adc35829e243d98489f5f5867e0..08812ccb3cbbdc1f5c6aaf55b8419e4b0e970ed9 100755 (executable)
@@ -280,8 +280,13 @@ netselect_mirror() {
             netselect_opts+=" -I"
         fi
         best_mirror=$(get_mirrors | awk '{print $2;}' | eval $ae_sudo xargs netselect $netselect_opts | awk '{print $2;}')
-        print_verbose 2 "Best mirror: $best_mirror"
-        echo $best_mirror
+        if [ -z "$best_mirror" ]; then
+            print_verbose 1 "Failed to select mirror using netselect. Selecting default one ($nd_mirror_default)"
+            echo "$nd_mirror_default"
+        else
+            print_verbose 2 "Best mirror: $best_mirror"
+            echo $best_mirror
+        fi
     fi
 }
 
@@ -327,7 +332,7 @@ assure_command_from_package()
 
     # if absent -- check availability of the package
     apt_cache=$(LANG=C apt-cache policy "$pkg" 2>&1)
-    if [[ "$apt_cache" =~ "Unable to locate package" ]] || [[ "$apt_cache" =~ "Candidate: (none)" ]]; then
+    if [[ "$apt_cache" =~ Unable\ to\ locate\ package ]] || [[ "$apt_cache" =~ Candidate:\ (none) ]]; then
         print_verbose 1 "Package $pkg providing command $cmd is N/A. Skipping"
         return 10;
     fi
@@ -430,7 +435,7 @@ if is_component_included software || is_component_included data; then
     if [ -z "$ae_mirror" ]; then # none specified
         ae_mirror_url=$nd_mirror_origin
     else
-        if ! [[ "$ae_mirror" =~ ".*://.*" ]]; then
+        if ! [[ "$ae_mirror" =~ .*://.* ]]; then
             case "$ae_mirror" in
                 best)    ae_mirror_url=$(netselect_mirror);;
                 default) ae_mirror_url=$nd_mirror_default;;
@@ -550,6 +555,8 @@ if [ ! -z "$ae_update" ]; then
     else
         eval_dry apt-get update
     fi
+else
+    print_verbose 1 "apt-get update  was not run. Please run to take an effect of changes"
 fi
 
 if [ "$ae_verbose" -ge 2 ]; then