]> git.donarmstrong.com Git - neurodebian.git/blobdiff - tools/nd-configurerepo
Also for stats report which repo and which job number use our setup
[neurodebian.git] / tools / nd-configurerepo
index 5720fe8a892f6b7b125defb91e18d92344ef267c..e3a7d47a0718bc08e8d93b639b09435f7c22b8d0 100755 (executable)
@@ -15,25 +15,25 @@ set -u
 
 nd_aptenable_version=0.1
 
-nd_key_id=0x2649A5A9
+nd_key_id=0xA5D32F012649A5A9
 nd_config_url=https://raw.githubusercontent.com/neurodebian/neurodebian/master/neurodebian.cfg
 nd_config_file=/etc/neurodebian/neurodebian.cfg
 nd_mirror_origin=http://neuro.debian.net/debian
 nd_mirror_default=$nd_mirror_origin # or may be AWS?
 
-# To be set by cmdline args or via env variables with prefix ND_AE_
-ae_release=${ND_AE_RELEASE:-}
-ae_components=${ND_AE_COMPONENTS:-software,data}
-ae_flavor=${ND_AE_FLAVOR:-}
-ae_mirror=${ND_AE_MIRROR:-best}
-ae_suffix=${ND_AE_SUFFIX:-}
-ae_verbose=${ND_AE_VERBOSE:-1}
-ae_overwrite=${ND_AE_OVERWRITE:-}
-ae_sources=${ND_AE_SOURCES:-}
-ae_install=${ND_AE_INSTALL:-}
-ae_update=${ND_AE_UPDATE:-1}
-ae_dry_run=${ND_AE_DRY_RUN:-}
-ae_defun_only=${ND_AE_DEFUN_ONLY:-} # mode to source this file as a "library"
+# To be set by cmdline args or via env variables with prefix NEURODEBIAN_
+ae_release=${NEURODEBIAN_RELEASE:-}
+ae_components=${NEURODEBIAN_COMPONENTS:-software,data}
+ae_flavor=${NEURODEBIAN_FLAVOR:-}
+ae_mirror=${NEURODEBIAN_MIRROR:-best}
+ae_suffix=${NEURODEBIAN_SUFFIX:-}
+ae_verbose=${NEURODEBIAN_VERBOSE:-1}
+ae_overwrite=${NEURODEBIAN_OVERWRITE:-}
+ae_sources=${NEURODEBIAN_SOURCES:-}
+ae_install=${NEURODEBIAN_INSTALL:-}
+ae_update=${NEURODEBIAN_UPDATE:-1}
+ae_dry_run=${NEURODEBIAN_DRY_RUN:-}
+ae_defun_only=${NEURODEBIAN_DEFUN_ONLY:-} # mode to source this file as a "library"
 
 ae_sudo=
 exe_dir=$(dirname $0)
@@ -44,12 +44,12 @@ do_print_flavor=
 # - apt priority! (so we could avoid automagic upgrades etc)
 # - multiarch setups
 
-if [ -z "${ND_AE_TEMPDIR:-}" ]; then
+if [ -z "${NEURODEBIAN_TEMPDIR:-}" ]; then
     ae_tempdir=$(mktemp -d)
     trap "rm -rf \"$ae_tempdir\"" TERM INT EXIT
 else
     # reuse the same directory/fetched configuration if was specified
-    ae_tempdir="${ND_AE_TEMPDIR:-}"
+    ae_tempdir="${NEURODEBIAN_TEMPDIR:-}"
 fi
 
 
@@ -113,8 +113,8 @@ Enables NeuroDebian repository for the current Debian or Ubuntu release.
 Options:
 
   -r, --release=RELEASE
-    Name of the Debian/Ubuntu release to be used.  If not specified,
-    it is deduced from the  apt-cache policy  output, by taking repository
+    Name of the Debian/Ubuntu release to be used. If not specified,
+    it is deduced from the 'apt-cache policy' output, by taking repository
     of Debian or Ubuntu origin with highest priority.
 
   --print-releases
@@ -125,8 +125,10 @@ Options:
 
   -f, --flavor=full|libre
     Which flavor of the repository should be enabled:
-     libre -- Only  main  component, containing only DFSG-compliant content.
-     full -- Includes main, contrib, and non-free.
+
+      libre  Only 'main' component, containing only DFSG-compliant content.
+      full   Includes 'main', 'contrib', and 'non-free'.
+
     If not specified -- deduced from the output of apt-cache policy.
 
   --print-flavor
@@ -134,21 +136,23 @@ Options:
 
   -c, --components=c1,c2,c3
     Comma separated list of components to enable among:
-     software -- primary software repository
-     data -- data packages
-     devel -- "overlay" of development versions (like Debians' "experimental").
-              Not sufficient on its own and available only from the main site
+
+     software  primary software repository
+     data      data packages
+     devel     "overlay" of development versions (like Debians' "experimental").
+               Not sufficient on its own and available only from the main site
+
     If not specified -- "software,data"
 
   -m, --mirror=NAME|URL
-    Which mirror to use.  Could be a mirror code-name (as specified in
+    Which mirror to use. Could be a mirror code-name (as specified in
     /etc/neurodebian/neurodebian.cfg), or a URL.
 
   --print-mirrors
     Return a list (with abbreviation) of known NeuroDebian mirrors.
 
   --overwrite,
-    If apt file already present, it would not be overriden (by default).
+    If apt file already present, it would not be overridden (by default).
     Use this option to overwrite.
 
   --suffix=SUFFIX
@@ -156,7 +160,7 @@ Options:
     multiple repositories
 
   --sources, --no-sources
-    Either to enable deb-src lines.  If none specified -- would be enabled if
+    Either to enable deb-src lines. If none specified -- would be enabled if
     sources for a core package (apt) are available.
 
   -n, --dry-run
@@ -168,7 +172,7 @@ Options:
     be apt-get installed
 
   -v, --verbose
-    Enable additional progress messages.  Could be used multiple times
+    Enable additional progress messages. Could be used multiple times
 
   -q, --quiet
     Make operation quiet -- only error messages would be output
@@ -181,25 +185,20 @@ Options:
 
 Exit status:
 
-  non-0 exit status in case of error.  Error exit code would depend
-  on which command has failed
+  non-0 exit status in case of error.
+  Error exit code would depend on which command has failed.
 
 Examples:
-
-  - Enable software and data components from the optimal (according to
+  nd-configurerepo
+    Enable software and data components from the optimal (according to
     netselect) mirror.  Some information about progress will be printed
 
-    nd-configurerepo
-
-  - Quietly enable -devel repository for the current release, and place apt
+  nd-configurerepo -q --suffix=-devel -c devel
+    Quietly enable -devel repository for the current release, and place apt
     configuration into /etc/apt/sources.list.d/neurodebian.sources-devel.list
 
-    nd-configurerepo -q --suffix=-devel -c devel
-
-  - Force sid distribution, all the components, from the Japan mirror:
-
-    nd-configurerepo -q --suffix=-de-sid-full -c software,data,devel -m jp
-
+  nd-configurerepo -q --suffix=-de-sid-full -c software,data,devel -m jp
+    Force sid distribution, all the components, from the Japan mirror
 EOT
 }
 
@@ -340,7 +339,8 @@ 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) ]] \
+       || [[ "$apt_cache" =~ is\ not\ available ]] ; then
         print_verbose 1 "Package $pkg providing command $cmd is N/A. Skipping"
         return 10;
     fi
@@ -544,7 +544,7 @@ fi
 #
 
 # Figure out if key needs to be imported (if ran within package,
-# should already be there due to neurodebian-keyring package)
+# should already be there due to neurodebian-archive-keyring package)
 if LANG=C eval $ae_sudo apt-key export $nd_key_id 2>&1 1>/dev/null | grep -qe "nothing exported"; then
     print_verbose 1 "Fetching the key from the server"
     eval_dry apt-key adv --recv-keys --keyserver pgp.mit.edu $nd_key_id