X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fqtc_packaging%2Fdebian_fremantle%2Fkitchenalert.postrm;fp=src%2Fqtc_packaging%2Fdebian_fremantle%2Fkitchenalert.postrm;h=01e44f4d7fcbc340b1b1bf7b6f217a007f810e1e;hb=dcd64866c2ff93bb3e06ac8a57d9bbf0543291ff;hp=0000000000000000000000000000000000000000;hpb=9a5278861b2b61209cce7ee2d215045d8dcbdd12;p=kitchenalert diff --git a/src/qtc_packaging/debian_fremantle/kitchenalert.postrm b/src/qtc_packaging/debian_fremantle/kitchenalert.postrm new file mode 100644 index 0000000..01e44f4 --- /dev/null +++ b/src/qtc_packaging/debian_fremantle/kitchenalert.postrm @@ -0,0 +1,34 @@ +#! /bin/sh + +set -e + +#This checks whether there is a newline at the end of the file and adds one if there was not. +#Needed because sed deletes the last line if it does not end with a newline + +perl -e 'use strict;' \ +-e 'use warnings;' \ +-e 'open(my $in, "<", "/usr/share/policy/etc/current/pulse/xpolicy.conf") or die "Cannot open /usr/share/policy/etc/current/pulse/xpolicy.conf: $!";' \ +-e 'my @lines = <$in>;' \ +-e 'my $lastlineishere = $#lines;' \ +-e 'my $lastline = $lines[$lastlineishere];' \ +-e 'unless ($lastline =~ /\n$/){open(my $log, ">>", "/usr/share/policy/etc/current/pulse/xpolicy.conf") or die "Cannot open /usr/share/policy/etc/current/pulse/xpolicy.conf: $!"; print $log "\n"; }' + +#This removes three subsequent lines from xpolicy.conf if they all match (the lines added by the postinstall script) + +sed -i ' +/'[stream]'/ { +#append a line +N +#search for KitchenAlert on the second line +/\nexe\t= KitchenAlert/ { +N +#searh next line +/\ngroup\t= alarm/ { + +#s/'[stream]'.*alarm// +d +}}}' /usr/share/policy/etc/current/pulse/xpolicy.conf + +exit 0 + +