[Pkg-voip-commits] r10485 - in /asterisk-core-sounds/trunk/debian: mkcontrol template.postinst template.prerm

sharky at alioth.debian.org sharky at alioth.debian.org
Tue Jun 17 13:15:48 UTC 2014


Author: sharky
Date: Tue Jun 17 13:15:48 2014
New Revision: 10485

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=10485
Log:
generate postinst and prerm

Added:
    asterisk-core-sounds/trunk/debian/template.postinst
    asterisk-core-sounds/trunk/debian/template.prerm
Modified:
    asterisk-core-sounds/trunk/debian/mkcontrol

Modified: asterisk-core-sounds/trunk/debian/mkcontrol
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk-core-sounds/trunk/debian/mkcontrol?rev=10485&op=diff
==============================================================================
--- asterisk-core-sounds/trunk/debian/mkcontrol	(original)
+++ asterisk-core-sounds/trunk/debian/mkcontrol	Tue Jun 17 13:15:48 2014
@@ -140,12 +140,26 @@
 
 	my $dirname = $Template{$lang}{dirname};
 	my $dirname_full = "usr/share/asterisk/sounds/$dirname";
+	my $lang_full = $Template{$lang}{lang_full};
 	my $config_base = "debian/asterisk-core-sounds-$lang";
 	system("echo '$lang-gsm/core-sounds-$lang.txt' >$config_base.docs");
 	foreach my $format (@$formats) {
-		# FIXME: postinst and prerm scripts
 		system("echo '$lang-$format/* $dirname_full' >$config_base-$format.install");
 	}
+
+	# postinst and prerm
+	my %replacements = (
+		'@dirname@' => $dirname,
+		'@lang@' => $lang,
+		'@lang_full@' => $lang_full,
+		'@lang_full_caps@' => substr($lang_full, 0, 2) . '_' . uc(substr($lang_full, 3, 2)),
+	);
+	my $sed = 'sed';
+		foreach my $key (keys %replacements) {
+		$sed .= " -e 's/$key/$replacements{$key}/g'"
+	}
+	system("$sed debian/template.postinst > $config_base.postinst");
+	system("$sed debian/template.prerm > $config_base.prerm");
 }
 
 print_header;

Added: asterisk-core-sounds/trunk/debian/template.postinst
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk-core-sounds/trunk/debian/template.postinst?rev=10485&op=file
==============================================================================
--- asterisk-core-sounds/trunk/debian/template.postinst	(added)
+++ asterisk-core-sounds/trunk/debian/template.postinst	Tue Jun 17 13:15:48 2014
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+
+case "$1" in
+    configure)
+	update-alternatives --install \
+	    /usr/share/asterisk/sounds/@lang@ asterisk-prompt- at lang@ \
+	    /usr/share/asterisk/sounds/@dirname@ 50
+	update-alternatives --install \
+	    /usr/share/asterisk/sounds/@lang_full_caps@ asterisk-prompt- at lang_full@ \
+	    /usr/share/asterisk/sounds/@dirname@ 50
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+

Added: asterisk-core-sounds/trunk/debian/template.prerm
URL: http://svn.debian.org/wsvn/pkg-voip/asterisk-core-sounds/trunk/debian/template.prerm?rev=10485&op=file
==============================================================================
--- asterisk-core-sounds/trunk/debian/template.prerm	(added)
+++ asterisk-core-sounds/trunk/debian/template.prerm	Tue Jun 17 13:15:48 2014
@@ -0,0 +1,8 @@
+#! /bin/sh -e
+
+if [ "$1" = "remove" ]; then
+    update-alternatives --remove asterisk-prompt- at lang@    /usr/share/asterisk/sounds/@dirname@
+    update-alternatives --remove asterisk-prompt- at lang_full@ /usr/share/asterisk/sounds/@dirname@
+fi
+
+#DEBHELPER#




More information about the Pkg-voip-commits mailing list