From a3d6820e15e97ac3cd278bf7f61488ed91b2ab2c Mon Sep 17 00:00:00 2001 From: kibergus Date: Tue, 22 Jun 2010 20:29:00 +0000 Subject: [PATCH] Patcher from Dani Church, removed coreutils-gnu dependance and fixed init script. git-svn-id: file:///svnroot/ussd-widget/trunk@38 d197f4d6-dc93-42ad-8354-0da1f58e353f --- ussd4all/debian/control | 4 +- ussd4all/debian/postinst | 19 +------ ussd4all/debian/rules | 3 +- ussd4all/rtcom/librtcom-call-ui.patch | Bin 8 -> 0 bytes ussd4all/rtcom/rtcompatcher.py | 98 +++++++++++++++++++++++++++++++++ ussd4all/src/event.d/ussdd | 4 +- 6 files changed, 105 insertions(+), 23 deletions(-) delete mode 100644 ussd4all/rtcom/librtcom-call-ui.patch create mode 100644 ussd4all/rtcom/rtcompatcher.py diff --git a/ussd4all/debian/control b/ussd4all/debian/control index 418b5ca..dd4ccc0 100644 --- a/ussd4all/debian/control +++ b/ussd4all/debian/control @@ -2,12 +2,12 @@ Source: ussd4all Section: user/system Priority: extra Maintainer: Alexey Guseynov -Build-Depends: debhelper (>= 5) +Build-Depends: debhelper (>= 5), libqt4-dev Standards-Version: 3.7.2 Package: ussd4all Architecture: any -Depends: coreutils-gnu, python2.5, pexpect, python-dbus, python-gobject, libc6 (>= 2.5.0-1), libgcc1 (>= 3.4.4), libqt4-core (>= 4.4.0), libqt4-gui (>= 4.4.0), libstdc++6 (>= 3.4.4), ${shlibs:Depends} +Depends: python2.5, pexpect, python-dbus, python-gobject, libc6 (>= 2.5.0-1), libgcc1 (>= 3.4.4), libqt4-core (>= 4.4.0), libqt4-gui (>= 4.4.0), libstdc++6 (>= 3.4.4), ${shlibs:Depends} XB-Maemo-Display-Name: USSD for all Description: Command line and GUI utility for making USSD queries This package fixes https://bugs.maemo.org/show_bug.cgi?id=10353 which nokia is unable to fix. This allows other applications to make USSD queries. diff --git a/ussd4all/debian/postinst b/ussd4all/debian/postinst index bd72170..5489aab 100644 --- a/ussd4all/debian/postinst +++ b/ussd4all/debian/postinst @@ -1,23 +1,6 @@ #!/bin/sh -SUM=`md5sum /usr/lib/librtcom-call-ui.so.0.0.0` -if [ "$SUM" = "5a51e4fbb38dac338e4444e6b713e9b3 /usr/lib/librtcom-call-ui.so.0.0.0" ] || [ "$SUM" = "44d6b8258fb4fb9c849162704120ba53 /usr/lib/librtcom-call-ui.so.0.0.0" ] ; then - cp /usr/lib/librtcom-call-ui.so.0.0.0 /usr/lib/librtcom-call-ui.so.0.0.0.orig - - # Unfortunatelu maemo has castrated busybox which does not suppot -c argument for head and tail, so we need coreutils-gnu - - /opt/maemo/usr/bin/gnu/head -c 194380 /usr/lib/librtcom-call-ui.so.0.0.0.orig > /usr/lib/librtcom-call-ui.so.0.0.0 - cat /usr/lib/librtcom-call-ui.patch >> /usr/lib/librtcom-call-ui.so.0.0.0 - /opt/maemo/usr/bin/gnu/head -c 195340 /usr/lib/librtcom-call-ui.so.0.0.0.orig | /opt/maemo/usr/bin/gnu/tail -c +194389 >> /usr/lib/librtcom-call-ui.so.0.0.0 - cat /usr/lib/librtcom-call-ui.patch >> /usr/lib/librtcom-call-ui.so.0.0.0 - /opt/maemo/usr/bin/gnu/tail -c +195349 /usr/lib/librtcom-call-ui.so.0.0.0.orig >> /usr/lib/librtcom-call-ui.so.0.0.0 - - rm /usr/lib/librtcom-call-ui.so.0 - ln -s librtcom-call-ui.so.0.0.0 /usr/lib/librtcom-call-ui.so.0 -else - echo "Your /usr/lib/librtcom-call-ui.so.0.0.0 is not recognized. So I won't patch it." -fi - +rtcompatcher.py pkill rtcom-call-ui chmod +s /usr/bin/pnatd diff --git a/ussd4all/debian/rules b/ussd4all/debian/rules index f16ce04..34c6f39 100755 --- a/ussd4all/debian/rules +++ b/ussd4all/debian/rules @@ -34,6 +34,7 @@ install: build cp -a "ussdquery/gsmdecode.py" "$(CURDIR)/debian/ussd4all/usr/lib/python2.5/gsmdecode.py" mkdir -p "$(CURDIR)/debian/ussd4all/usr/bin/" cp -a "ussdquery/ussdquery.py" "$(CURDIR)/debian/ussd4all/usr/bin/ussdquery.py" + cp -a "rtcom/rtcompatcher.py" "$(CURDIR)/debian/ussd4all/usr/bin/rtcompatcher.py" # Build architecture-independent files here. binary-indep: build install @@ -47,7 +48,7 @@ binary-arch: build install dh_installexamples dh_installman dh_link - dh_strip --dbg-package=my-application-dbg + dh_strip dh_compress dh_fixperms dh_installdeb diff --git a/ussd4all/rtcom/librtcom-call-ui.patch b/ussd4all/rtcom/librtcom-call-ui.patch deleted file mode 100644 index 58ae0a318c3753be3fe59fe92af3d93c3e64f8f3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 PcmZP&Sn!xZVER)43hDzO diff --git a/ussd4all/rtcom/rtcompatcher.py b/ussd4all/rtcom/rtcompatcher.py new file mode 100644 index 0000000..450defe --- /dev/null +++ b/ussd4all/rtcom/rtcompatcher.py @@ -0,0 +1,98 @@ +#!/usr/bin/python + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; version 2 and higer. +## +## Dani Church 2010 + +import hashlib + +patch_config = { + 'known_md5sums': [ + '5a51e4fbb38dac338e4444e6b713e9b3', + '44d6b8258fb4fb9c849162704120ba53', + ], + 'check_ranges': [ + (194380, 'f04f2de920b08de2'), + (195340, 'f04f2de920b08de2'), + ], + 'patch_ranges': [ + (194380, '0010a0e3001097e5'), + (195340, '0010a0e3001097e5'), + ], +} + +class Patcher: + known_md5sums = [] + check_ranges = [] + patch_ranges = [] + + def __init__(self, config): + self.known_md5sums = config['known_md5sums'] + self.check_ranges = config['check_ranges'] + self.patch_ranges = config['patch_ranges'] + + def check_md5sum(self, filename): + md5 = hashlib.md5() + f = open(filename, 'rb') + while True: + d = f.read(8096) + if not d: break + md5.update(d) + f.close() + + md5sum = md5.hexdigest() + for known_sum in self.known_md5sums: + if md5sum == known_sum: return True + + return False + + def check_data(self, filename): + f = open(filename, 'rb') + + for seek, hexbytes in self.check_ranges: + bytes = hexbytes.decode('hex') + f.seek(seek) + actual = f.read(len(bytes)) + if actual != bytes: + f.close() + return False + + f.close() + return True + + def patch_file(self, filename): + f = open(filename, 'r+b') + + for seek, hexbytes in self.patch_ranges: + bytes = hexbytes.decode('hex') + f.seek(seek) + f.write(bytes) + + f.close() + +if __name__ == '__main__': + import sys, os, shutil + + library = '/usr/lib/librtcom-call-ui.so.0.0.0' + + if os.access(library+'.orig', os.F_OK): + print "It looks like %s has already been patched. Aborting." % (library,) + sys.exit(1) + + patcher = Patcher(patch_config) + + if not patcher.check_md5sum(library): + if not patcher.check_data(library): + print "Your %s is not recognized. So I won't patch it." % (library,) + sys.exit(1) + if len(sys.argv) > 1 and sys.argv[1] == '--force': + print "Patching an unrecognized %s. Please test your system before rebooting." % (library,) + else: + message = "Your %s is not recognized, but it seems to match the patterns.\nRun '%s --force' to try patching anyway, but understand that\nTHIS MAY BREAK YOUR SYSTEM. If you do, test your system thoroughly before rebooting." % (library,library,sys.argv[0]) + subprocess.call(["dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog string:\""+message+"\" uint32:0 string:\"OK\""],shell=True) + sys.exit(1) + + shutil.copy2(library, library+'.orig') + patcher.patch_file(library) diff --git a/ussd4all/src/event.d/ussdd b/ussd4all/src/event.d/ussdd index a11b98c..39c3c28 100644 --- a/ussd4all/src/event.d/ussdd +++ b/ussd4all/src/event.d/ussdd @@ -1,7 +1,7 @@ start on XSESSIONS_STARTING stop on stopped hal -#respawn -#respawn limit 15 3 +respawn +respawn limit 15 3 script export DISPLAY=:0.0 -- 1.7.9.5