]> git.donarmstrong.com Git - neurodebian.git/commitdiff
initial postinst and postrm scripts for neurodebian-repository pkg
authorYaroslav Halchenko <debian@onerussian.com>
Tue, 29 Jul 2014 00:01:40 +0000 (20:01 -0400)
committerYaroslav Halchenko <debian@onerussian.com>
Tue, 29 Jul 2014 00:14:19 +0000 (20:14 -0400)
debian/changelog
debian/neurodebian-repository.postinst [new file with mode: 0755]
debian/neurodebian-repository.postrm [new file with mode: 0755]
tools/nd-aptenable

index 2f339f63beebc0f2b9edbe7cac94c61830d205b5..6f7f9eea0d292ee8866d9215f6fe5c615d03481a 100644 (file)
@@ -1,3 +1,12 @@
+neurodebian (0.33~a1) unstable; urgency=medium
+
+  * New "upstream" release
+  * New features:
+    - neurodebian and neurodebian-repository packages to provide 1-click
+      NeuroDebian deployment on Debian/Ubuntu boxesw
+
+ -- Yaroslav Halchenko <debian@onerussian.com>  Mon, 28 Jul 2014 20:03:12 -0400
+
 neurodebian (0.32) neurodebian; urgency=low
 
   [ Michael Hanke ]
diff --git a/debian/neurodebian-repository.postinst b/debian/neurodebian-repository.postinst
new file mode 100755 (executable)
index 0000000..d514acc
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+
+case "$1" in
+    configure)
+               # obtain all the options and call nd-aptenable
+               opts=""
+               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/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
+    ;;
+    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-repository.postrm b/debian/neurodebian-repository.postrm
new file mode 100755 (executable)
index 0000000..2c92f0f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+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)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
index 54d5bc8f94a0f2e364aefd7b545a0ad35dc30587..d6f5192106887adc35829e243d98489f5f5867e0 100755 (executable)
@@ -31,6 +31,7 @@ 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"
 
@@ -356,7 +357,7 @@ assure_command_from_package()
 # 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,print-releases,print-mirrors,print-best-mirror -n 'nd-aptenable' -- "$@"`
+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-aptenable' -- "$@"`
 
 if [ $? != 0 ] ; then
   error 2 "Problem with parsing cmdline.  Terminating..."
@@ -381,6 +382,7 @@ while true ; do
       -n|--dry-run)        ae_dry_run=1; shift;;
          --suffix) shift;  ae_suffix="$1"; shift;;
          --overwrite)      ae_overwrite="$1"; shift;;
+         --do-not-update)  ae_update=""; shift;;
          --sources)        ae_sources=1; shift;;
          --no-sources)     ae_sources=0; shift;;
          --install)        ae_install=1; shift;;
@@ -530,22 +532,24 @@ fi
 # Finalizing (apt-get update etc)
 #
 
-print_verbose 1 "Updating APT listings, might take a few minutes"
-if [ -z "$ae_dry_run" ]; then
-    apt_logfile="$ae_tempdir/apt.log"
-    $ae_sudo apt-get update 1>"$apt_logfile" 2>&1 \
-        && rm -f "$apt_logfile" \
-        || {
-             apt_log=$(cat "$apt_logfile")
-             echo "$apt_log"
-             if echo "$apt_log" | grep -q "Malformed line [0-9]* in source list $ae_output_file"; then
-                 $ae_sudo mv "${ae_output_file}" "${ae_output_file}-failed.disabled"
-                 error 6 "Update failed to possible errorneous APT listing file produced by this script.  Generated $ae_output_file renamed to ${ae_output_file}-failed.disabled to not interfer"
-             fi
-             error 5 "Update failed with exit code $? (above output logged into $apt_logfile)."
-             }
-else
-    eval_dry apt-get update
+if [ ! -z "$ae_update" ]; then
+    print_verbose 1 "Updating APT listings, might take a few minutes"
+    if [ -z "$ae_dry_run" ]; then
+        apt_logfile="$ae_tempdir/apt.log"
+        $ae_sudo apt-get update 1>"$apt_logfile" 2>&1 \
+            && rm -f "$apt_logfile" \
+            || {
+                 apt_log=$(cat "$apt_logfile")
+                 echo "$apt_log"
+                 if echo "$apt_log" | grep -q "Malformed line [0-9]* in source list $ae_output_file"; then
+                     $ae_sudo mv "${ae_output_file}" "${ae_output_file}-failed.disabled"
+                     error 6 "Update failed to possible errorneous APT listing file produced by this script.  Generated $ae_output_file renamed to ${ae_output_file}-failed.disabled to not interfer"
+                 fi
+                 error 5 "Update failed with exit code $? (above output logged into $apt_logfile)."
+                 }
+    else
+        eval_dry apt-get update
+    fi
 fi
 
 if [ "$ae_verbose" -ge 2 ]; then