summaryrefslogtreecommitdiffstats
path: root/packages/debian
blob: dbf056c19b11f00c79e563c4084923fd5f72a8ce (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
#!/bin/bash
#-- make sure we know how to handle the distro
#   Each file needs to define a function called get_source that will
#   be passed the working directory and a package name, and that must
#   return the full absolute path to the source tree.
#
#   A similar remove_source function must also be defined (same parameters)
#   that just removes everything created in the working directory for this
#   package.
#

get_source() {
        pwd=$(pwd)
        workdir="$1"
        pkg="$2"

        #-- set up the proper environment
        cd "$workdir"
        [ ! -d $pkg ] && mkdir $pkg
        cd $pkg

        #-- fetch the source package
        res=$(apt-get source $pkg >/dev/null 2>&1)

        #-- all done.  as you were.  and report the path.
        path=$(ls -d ${pkg}-[0-9].* | head -1)
        if [ ! -z $path ]
        then
                echo $workdir/$pkg/$path
        else
                echo ""
        fi
        cd $pwd
}

remove_source () {
        pwd=$(pwd)
        workdir="$1"
        pkg="$2"

        cd "$workdir"
        rm -rf $pkg >/dev/null 2>&1

        cd $pwd
}