Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 87e24c835797f6ddf75b9bb0dca2f1f3 > files > 1

gdb-7.5.1-7.mga3.src.rpm

#!/usr/bin/sh
# Kamil Rytarowski 2012, <kamil AT mageia DOT org> | <n54 AT gmx DOT com>
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

if [ "$(id -u)" != "0" ]; then
  echo "This script must by run as root"
  exit 1
fi

urpmi_args=""

while [ "$1" ]; do
  if ! rpm -q --qf "%{n}-%{version}-%{release}.%{arch}\n" $1 &>/dev/null; then
    echo "$1 is not installed"
    exit 1
  fi

  new_arg="`rpm -q --qf '%{sourcerpm}\n' $1|sed 's/-[^-]*-[^-]*$/-debuginfo/'`"
  urpmi_args="$urpmi_args $new_arg"
  shift
done

urpmi $urpmi_args
ret=$?

if [ $ret -ne 0 ]; then
  echo "Something went wrong, make sure your Debug media are configured properly"
  exit 1
fi

exit 0