[SCM] libdvd-pkg/master: big debconf scripts/templates update:

onlyjob at users.alioth.debian.org onlyjob at users.alioth.debian.org
Sun Jun 30 17:16:00 UTC 2013


The following commit has been merged in the master branch:
commit 7a06b45672cc201c1964b756e6924ac565e1fe16
Author: Dmitry Smirnov <onlyjob at member.fsf.org>
Date:   Mon Jul 1 01:01:16 2013 +1000

    big debconf scripts/templates update:
    
     * prompt for hook install according to its status.
     * show "manual rebuild needed" note on upgrade when hook is missing.
     * two separate messages to install and to remove hook (usability).
     * new note on first install.
     * recognise when package is updated.
     * recognise when guest package can be upgraded.
     * different logic for install/upgrade and reconfigure.
     * reset status for message to be shown on every upgrade.
     * don't spread fears regarding hook but mention "no known problems".
     * inject variables to debconf templates.

diff --git a/debian/config b/debian/config
index 9e65383..e8b9863 100644
--- a/debian/config
+++ b/debian/config
@@ -5,20 +5,85 @@ set -e
 
 # Source debconf library.
 . /usr/share/debconf/confmodule
-
 db_version 2.0
 db_capb escape
-db_settitle libdvd-pkg/title
 
-if [ "$1" = configure ] || [ "$1" = reconfigure ] ; then
-    db_input high libdvd-pkg/build || true
-    db_go || true
+if [ "$1" = configure ] ; then
+    if [ -z "$2" ]; then
+    ## first install
+        db_subst      libdvd-pkg/first-install PKGI ${PKGI}
+        db_subst      libdvd-pkg/first-install PKGG ${PKGG}
+        db_subst      libdvd-pkg/first-install VER /${VERGG}
+        db_input high libdvd-pkg/first-install || true
+        db_go || true
+    fi
 
-    db_get libdvd-pkg/build
-    if [ "$RET" = "true" ]; then
-        db_input medium libdvd-pkg/post-invoke_hook || true
+    ## APT post-invoke install prompt
+    if [ ! -h "/etc/apt/apt.conf.d/${P88}" ]; then
+        ## show prompt again if APT post-invoke hook is missing
+        db_fset       libdvd-pkg/post-invoke_hook-install seen false
+        db_subst      libdvd-pkg/post-invoke_hook-install PKGI ${PKGI}
+        db_input high libdvd-pkg/post-invoke_hook-install || true
         db_go || true
     fi
+
+    ## upgrade check
+    if [ "${VERGG}~local" != "${VERG}" ];then
+        db_get libdvd-pkg/post-invoke_hook-install
+        if [ "$RET" != "true" ]; then
+        ## no APT post-invoke hook: remind to upgrade manually
+            ## make sure notice shown more than once, if necessary
+            db_fset       libdvd-pkg/upgrade seen false
+            db_settitle   libdvd-pkg/title_u
+            db_subst      libdvd-pkg/upgrade PKGI ${PKGI}
+            db_subst      libdvd-pkg/upgrade PKGG_ALL ${PKGG_ALL}
+            db_subst      libdvd-pkg/upgrade VER ${VERGG}
+            db_input high libdvd-pkg/upgrade || true
+            db_go || true
+        fi
+    fi
+fi
+if [ "$1" = reconfigure ] ; then
+    ## build prompt (manual)
+    if [ "${VERGG}~local" != "${VERG}" ]; then
+        ## upgrade or new version exist
+        db_subst      libdvd-pkg/title_b-i PKGG ${PKGG}
+        db_subst      libdvd-pkg/title_b-i VER /${VERGG}
+        db_settitle   libdvd-pkg/title_b-i
+
+        db_subst      libdvd-pkg/build PKGG ${PKGG}
+        db_subst      libdvd-pkg/build VER /${VERGG}
+        db_reset      libdvd-pkg/build
+        db_input high libdvd-pkg/build || true
+        db_go || true
+    fi
+
+    ## remind to install hook if it is missing
+    if [ ! -h "/etc/apt/apt.conf.d/${P88}" ]; then
+        db_subst      libdvd-pkg/post-invoke_hook-install PKGI ${PKGI}
+        db_reset      libdvd-pkg/post-invoke_hook-install
+        db_input high libdvd-pkg/post-invoke_hook-install || true
+        db_go || true
+    else
+        db_get libdvd-pkg/build
+        if [ "$RET" != "true" ]; then
+            ## prompt to remove hook if it is installed and user don't want
+            ## to build guest package(s).
+            db_subst      libdvd-pkg/post-invoke_hook-remove PKGI ${PKGI}
+            db_reset      libdvd-pkg/post-invoke_hook-remove
+            db_input high libdvd-pkg/post-invoke_hook-remove || true
+            db_go || true
+
+            ## set primary debconf/DB-value to script symlink removal
+            ## "post-invoke_hook-remove" template exists merely to provide friendly prompt
+            db_get libdvd-pkg/post-invoke_hook-remove
+            if [ "$RET" = "true" ]; then
+                db_set libdvd-pkg/post-invoke_hook-install false
+            else
+                db_set libdvd-pkg/post-invoke_hook-install true
+            fi
+        fi
+    fi
 fi
 
 db_stop
diff --git a/debian/postinst b/debian/postinst
index 0000683..0e22546 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -8,21 +8,30 @@ set -e
 . /usr/share/debconf/confmodule
 db_version 2.0
 
-PKG=libdvd-pkg
-P88=88libdvdcss-pkg
+#echo "${PKGI}/postinst: $1 $2::${VERGG}" >&2
 
 case "$1" in
     configure*)
-        db_get ${PKG}/build
+        ## install or remove APT post-install hook, according to user
+        ## selection in 'config'.
+        db_get ${PKGI}/post-invoke_hook-install
         if [ "$RET" = "true" ]; then
-            db_get ${PKG}/post-invoke_hook
+            [ -h "/etc/apt/apt.conf.d/${P88}" ] \
+            || ln -s /usr/lib/${PKGI}/${P88} /etc/apt/apt.conf.d/${P88}
+        else
+            rm -fv /etc/apt/apt.conf.d/${P88} || true
+        fi
+
+        # check if particular version of guest package is already installed.
+        if [ "${VERGG}~local" = "${VERG}" ]; then
+            echo "${PKGI}: guest package [${PKGG}/${VERG}] is already installed." >&2
+        else
+            ## Build package
+            db_get ${PKGI}/build
             if [ "$RET" = "true" ]; then
-                [ -h "/etc/apt/apt.conf.d/${P88}" ] \
-                || ln -s /usr/lib/${PKG}/${P88} /etc/apt/apt.conf.d/${P88}
-            else
-                rm -f /etc/apt/apt.conf.d/${P88} || true
+                rm -f /usr/src/${PKGI}/*.is-installed
+                /usr/lib/${PKGI}/b-i_libdvdcss.sh
             fi
-            /usr/lib/${PKG}/b-i_libdvdcss.sh
         fi
     ;;
 esac
diff --git a/debian/templates b/debian/templates
index 5c70a40..3762088 100644
--- a/debian/templates
+++ b/debian/templates
@@ -1,27 +1,68 @@
-Template: libdvd-pkg/title
-Type: title
-_Description: build and install libdvdcss library.
-
 Template: libdvd-pkg/build
 Type: boolean
-Default: false
+Default: true
 _Description: Continue?
  This application is about to download, compile from source code and
- install libdvdcss library as Debian package.
+ install "${PKGG}${VER}" as Debian package (source files will be
+ downloaded from videolan.org).
+
+Template: libdvd-pkg/first-install
+Type: note
+_Description:
+ This application automates download, compile from source code and
+ install "${PKGG}${VER}" as Debian package (source files will be
+ downloaded from videolan.org).
  .
- Source files will be downloaded from videolan.org.
+ Please remember to run `sudo dpkg-reconfigure ${PKGI}`
+ to build and install guest package(s) for the first time.
 
-Template: libdvd-pkg/post-invoke_hook
+Template: libdvd-pkg/title_b-i
+Type: title
+_Description: Build and install ${PKGG}${VER}.
+
+Template: libdvd-pkg/title_u
+Type: title
+_Description: Guest package(s) upgrade note.
+
+Template: libdvd-pkg/upgrade
+Type: note
+_Description:
+ An update to guest package(s) [${PKGG_ALL}] version ${VER} is available
+ but automatic upgrade is disabled.
+ .
+ Please remember to run `sudo dpkg-reconfigure ${PKGI}` to build and
+ install guest package(s) or consider installing APT post-invoke hook.
+
+Template: libdvd-pkg/post-invoke_hook-install
 Type: boolean
-Default: false
+Default: true
 _Description: Install APT post-invoke hook?
- Optional experimental APT post-invoke hook may be installed to allow
- automatic re-build/re-install of guest package(s) on host package
- upgrade. After every APT operation hook will check whenever guest
- package(s) can be updated. If upgrade detected it will attempt to build
- and install package(s) using `dpkg -i`. Otherwise guest packages may be
- rebuild on manual invocation of `dpkg-reconfigure`.
+ APT post-invoke hook takes care of future automatic upgrades of guest
+ package(s) on host package upgrade. After end of batch of APT
+ operations hook will check whenever guest package(s) can be updated.
+ If upgrade detected then hook will attempt to download/build and
+ install package(s) using `dpkg -i` but only if `apt-get check` reported
+ no errors.
+ .
+ At the moment there are no known problems associated with APT
+ post-invoke hook which maintainer recommends to use with this package.
+ .
+ Alternatively guest package(s) can be built by manual invocation of
+ `dpkg-reconfigure ${PKGI}`.
+
+Template: libdvd-pkg/post-invoke_hook-remove
+Type: boolean
+Default: false
+_Description: Remove APT post-invoke hook?
+ APT post-invoke hook takes care of future automatic upgrades of guest
+ package(s) on host package upgrade. After end of batch of APT
+ operations hook will check whenever guest package(s) can be updated.
+ If upgrade detected then hook will attempt to download/build and
+ install package(s) using `dpkg -i` but only if `apt-get check` reported
+ no errors.
+ .
+ At the moment there are no known problems associated with APT
+ post-invoke hook which maintainer recommends to use with this package.
  .
- Although at the moment there are no known problems associated with APT
- post-invoke hook it is considered unsafe due to its potential to
- interfere with APT/dpkg operations. Use at your own risk.
+ Alternatively guest package(s) can be built on manual invocation of
+ `dpkg-reconfigure ${PKGI}`.

-- 
libdvdcss-pkg packaging



More information about the pkg-multimedia-commits mailing list