File: blend-get-names

package info (click to toggle)
blends 0.7.11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,260 kB
  • sloc: xml: 4,904; python: 1,226; sh: 705; makefile: 290
file content (58 lines) | stat: -rwxr-xr-x 1,475 bytes parent folder | download | duplicates (4)
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
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh

# Read Blend specific names from debian/control.stub
#
# Copyright (C) Andreas Tille <tille@debian.org>
# License: GPL

# Return codes according to
# http://epydoc.sourceforge.net/stdlib/posix-module.html

CONTROLFILE=debian/control.stub

GetShortName () {
    grep '^Source:' $CONTROLFILE | \
        sed -e 's/^Source:[[:space:]]*//' -e 's/^debian-//'
}

if [ ! -e "$CONTROLFILE" ] ; then
        echo "Missing control file $CONTROLFILE"
        exit 72   # EX_OSFILE
fi

if [ "$#" -ne 1 ] ; then
        echo "Missing argument"
        echo "Usage: $0 blendname|blendshortname|blendtitle|metapackageprefix"
        exit 64   #  EX_USAGE
fi

case "$1" in
    blendname)
        grep '^Source:[[:space:]]*' "$CONTROLFILE" | \
            sed 's/^Source:[[:space:]]*//'
        exit 0
        ;;
    blendshortname)
        GetShortName
        exit 0
        ;;
    blendtitle) # default title is the short name with capital first char
        GetShortName | sed 's/.*/Debian \u&/'
        exit 0
        ;;
    metapackageprefix)
        mprefix=`grep '^Package:[[:space:]]*' "$CONTROLFILE" |head -1| \
            sed 's/^Package:[[:space:]]*\([[:alnum:]]\+\)-*.*/\1/'`
        if [ -z $mprefix ] ; then
            GetShortName
        else
            echo $mprefix
        fi
        exit 0
        ;;
    *)
        echo "Unknown argument $1"
        echo "Usage: $0 blendname|blendshortname|metapackageprefix"
        exit 64   #  EX_USAGE
        ;;
esac