From 251f8292b3da066e0888c01b985ce10837781380 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Thu, 10 Apr 2008 16:01:19 +0200 Subject: [PATCH] check-symbols: justify sudo privilegies requirement (LP: #194622), add exit codes, formatting changes. --- check-symbols | 44 ++++++++++++++++++++++++++++---------------- debian/changelog | 4 ++++ 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/check-symbols b/check-symbols index a6bfbd7..800764a 100755 --- a/check-symbols +++ b/check-symbols @@ -13,30 +13,40 @@ DEBLINE="" DEBUG=False if [[ -z $1 ]]; then - echo "Missing argument: source package name."; - exit; + echo "Missing argument: source package name." + exit 1 fi if [[ -z $2 ]]; then - DEBDIR="/var/cache/pbuilder/result"; + DEBDIR="/var/cache/pbuilder/result" else - DEBDIR="$2"; + DEBDIR="$2" +fi + +if [ `id -u` != "0" ] +then + echo + echo -n "You might now be asked for your password, as this script requires" + echo " sudo privilegies in order to install the packages you want to check." + echo fi sudo apt-get install $PACKAGES +echo for pack in $PACKAGES; do - for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; + for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u` do - LIBNAME=$(basename $lib); - nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.old; + LIBNAME=$(basename $lib) + nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.old done; - DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "; + DEBLINE="$DEBLINE $DEBDIR/$pack*.deb " done if [[ -z $DEBLINE ]]; then - echo "Package doesn't exist: $1."; exit + echo "Package doesn't exist: $1." + exit 1 fi NOFILE=True @@ -48,19 +58,21 @@ for filename in $DEBLINE; do done if [[ $NOFILE == True ]]; then - echo "No matching binary files found in «$DEBDIR»."; exit + echo "No matching binary files found in «$DEBDIR»." + exit 1 fi sudo dpkg -i $DEBLINE; +echo for pack in $PACKAGES; do - for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`; + for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u` do - LIBNAME=$(basename $lib); - nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.new; - echo "Checking: $lib"; - diff -u /tmp/$LIBNAME.{old,new}; - rm /tmp/$LIBNAME.{old,new}; + LIBNAME=$(basename $lib) + nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.new + echo "Checking: $lib" + diff -u /tmp/$LIBNAME.{old,new} + rm /tmp/$LIBNAME.{old,new} done; done diff --git a/debian/changelog b/debian/changelog index f6c3e20..13f13e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,10 @@ ubuntu-dev-tools (0.31) UNRELEASED; urgency=low * what-patch: - If cdbs-edit-patch is used, output "cdbs (patchsys.mk)" instead of just "cdbs" (LP: #195795). + * check-symbols: + - Add a brief explanation about why sudo privilegies are required + in order to run this script (LP: #194622). + - End with exit code 1 if there's an error. -- Siegfried-Angel Gevatter Pujals (RainCT) Tue, 08 Apr 2008 16:48:35 +0200