summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_rpm_package_name.sh
blob: f6019097043e70439bf2674a03ebac09d753a5d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

# Gets the RPM package name from the component name.
# This is useful because some RPM packages do not have prefix "trinity"
# while others do.
#
# E.g :
#  trinity-qt3 => qt3
#  trinity-tdelibs => trinity-tdelibs


PKGCATEGORY="${1%%/*}"
PKGNAME="${1##*/}"
DEVEL="$2"

# Language package: install only French language package
case "${PKGNAME}" in
  "k3b-i18n"|"koffice-i18n"|"tde-i18n") PKGNAME="${PKGNAME}-French";;
  "koffice") PKGNAME="${PKGNAME}-suite";;
esac

# Use the Trinity Prefix, or not.
case "${PKGNAME}" in
  "trinity-"*|"qt3"|"python-qt3"|"esound") PREFIX="";;
  "autoconf"|"automake"|"cmake"|"gnuchess"|"htdig"|"imlib1"|"libotr3"|"libtool"|"lilypond"|"m4"|"mftrace"|"pcsc-perl"|"torsocks"|"wv2") PREFIX="";;
  "curl") PREFIX="trinity-lib";;
  *) PREFIX="trinity-";;
esac

echo "${PREFIX}${PKGNAME}"

if [ -n "${DEVEL}" ]; then
  # Check if development package is required.
  # Applications do NOT have development packages, except K3B
  case "${PKGCATEGORY}" in
    "applications") if [ "${PKGNAME}" != "k3b" ]; then exit 0; fi;;
    "extras") if [ "${PKGNAME}" != "akode" ]; then exit 0; fi;;
  esac
  # Other packags NOT having development package
  case "${PKGNAME}" in
    "hal-info"|"lilypond"|"mftrace"|"pcsc-perl"|"torsocks") exit 0;;
    "tqca-tls"|"tdeadmin"|"tdetoys"|"tde-i18n"*|"tdeaddons"|"tdeartwork"|"libtqt-perl") exit 0;;
  esac
  
  echo "${PREFIX}${PKGNAME}-devel"
fi