blob: a82ab49e232274209bdb3924e814552b0de1ebe8 (
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
48
49
50
51
52
|
#!/bin/bash
#
# Copyright (c) 2012, Al Stone <ahs3@ahs3.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 (only) of the GNU General
# Public License as published by the Free Software Foundation.
#
#-- 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
}
|