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)
+do_print_release=
+do_print_flavor=
# TODOs:
# - 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
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
- Return a list of releases present in NeuroDebian repository.
+ Print a list of releases present in NeuroDebian repository.
+
+ --print-release
+ Print the release deduced from the output of apt-cache policy.
-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.
- If not specified -- deduced from the output of apt-cache policy
+
+ 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
+ Print the flavor deduced from the output of apt-cache policy.
-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
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
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
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
}
# 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
# Note that we use `"$@"' to let each command-line parameter expand to a
# separate word. The quotes around `$@' are essential!
# We need CLOPTS as the `eval set --' would nuke the return value of getopt.
-CLOPTS=`getopt -o h,r:,m:,f:,c:,q,v,n --long help,version,quiet,verbose,mirror:,release:,flavor:,components:,suffix:,overwrite,sources,no-sources,install,dry-run,do-not-update,print-releases,print-mirrors,print-best-mirror -n 'nd-configurerepo' -- "$@"`
+CLOPTS=`getopt -o h,r:,m:,f:,c:,q,v,n --long help,version,quiet,verbose,mirror:,release:,flavor:,components:,suffix:,overwrite,sources,no-sources,install,dry-run,do-not-update,print-releases,print-release,print-mirrors,print-best-mirror,print-flavor -n 'nd-configurerepo' -- "$@"`
if [ $? != 0 ] ; then
error 2 "Problem with parsing cmdline. Terminating..."
--print-mirrors) get_mirrors; exit 0;;
--print-best-mirror) netselect_mirror; exit 0;;
--print-releases) get_releases; exit 0;;
+ --print-release) do_print_release=1; shift;;
+ --print-flavor) do_print_flavor=1; shift;;
-n|--dry-run) ae_dry_run=1; shift;;
--suffix) shift; ae_suffix="$1"; shift;;
--overwrite) ae_overwrite="$1"; shift;;
if [ -z "$ae_release" ]; then
ae_release=$(echo "$apt_policy" | head -1 | sed -e 's/.*,n=\([^,]*\),.*/\1/g')
+ if [ ! -z "$do_print_release" ]; then
+ echo $ae_release
+ exit 0
+ fi
fi
if [ -z "$ae_flavor" ]; then
ae_flavor=$(echo "$apt_policy" | grep -e ",n=$ae_release," | grep -qe 'c=\(non-free\|multiverse\)' && echo "full" || echo "libre")
+ if [ ! -z "$do_print_flavor" ]; then
+ echo $ae_flavor
+ exit 0
+ fi
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