|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
1 |
#!/bin/bash
|
2 |
#update-maintainer
|
|
3 |
#small - thus not perfect - script to update maintainer field in ubuntu packages
|
|
4 |
#written and (c) 2007 by Albin Tonnerre <lut1n.tne@gmail.com> (Lutin)
|
|
5 |
#this code is under the GNU GPL V2 licence
|
|
6 |
||
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
7 |
if [ ${#@} -ge 1 ]; then |
8 |
for argv in "$@"; do |
|
9 |
param=`echo $argv | cut -d'=' -f1` |
|
10 |
value=`echo $argv | cut -d'=' -f2` |
|
11 |
case $param in |
|
12 |
"--path") path="$value" ;; |
|
13 |
"--section") section=$value ;; |
|
14 |
"--help") echo -e "Options: \n --path=PATH : specify the path of the source folder\n --section=SECTION : specify the section of the package (if the package is not yet in the archive or if you don't have the gutsy source repo in your sources.list)"; exit 0 ;; |
|
15 |
*) echo "Bad parameter, please use --help" >&2; exit 1 ;; |
|
16 |
esac
|
|
17 |
done
|
|
18 |
fi
|
|
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
19 |
|
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
20 |
cd ${path-.} |
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
21 |
|
22 |
# look for the debian directory
|
|
23 |
if [ -f debian/control -a -f debian/changelog ]; then |
|
24 |
DEBIANDIR=debian |
|
25 |
elif [ -f control -a -f changelog ]; then |
|
26 |
DEBIANDIR=. |
|
27 |
else
|
|
28 |
echo "Please run that script in the source folder" >&2 && exit 1 |
|
29 |
fi
|
|
30 |
||
31 |
IGNORE_DOMAINS="ubuntu\.com|ubuntu\.com\.au" |
|
32 |
||
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
33 |
[ -n "`head -n 1 $DEBIANDIR/changelog | grep -E "\(*ubuntu.*\)"`" ] && |
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
34 |
[ -z "`grep -E "^Maintainer: .*($IGNORE_DOMAINS)>" $DEBIANDIR/control`" ] || \ |
35 |
{ echo "Not an ubuntu package or already maintained by the ubuntu team" >&2 && \ |
|
36 |
exit 1; } |
|
37 |
||
38 |
mail=$(grep -E "^Maintainer" $DEBIANDIR/control | sed -r 's/.*<(.*)>/\1/') |
|
|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
39 |
case $mail in |
40 |
"adconrad@0c3.net") email="Adam Conrad <adconrad@ubuntu.com>" ;; |
|
41 |
"mpitt@debian.org") email="Martin Pitt <martin.pitt@ubuntu.com>" ;; |
|
42 |
esac
|
|
43 |
||
44 |
if [ -z "$email" ]; then |
|
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
45 |
if [ -z "$section" ]; then |
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
46 |
DISTRO=$(head -n 1 $DEBIANDIR/changelog|sed -r 's/.*\) (.*);.*/\1/' | cut -d'-' -f1) |
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
47 |
pkgline=$(apt-cache madison `head -n 1 $DEBIANDIR/changelog | cut -d' ' \ |
48 |
-f1`| grep -m 1 "$DISTRO.*Sources") |
|
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
49 |
[ -z "$pkgline" ] && echo "You don't have $DISTRO in your source repos" \ |
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
50 |
>&2 && exit 1 |
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
51 |
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") |
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
52 |
fi
|
|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
53 |
case $section in |
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
54 |
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;; |
55 |
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;; |
|
|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
56 |
esac
|
57 |
fi
|
|
58 |
||
|
5
by Michael Bienia
Updated to Lutin's last version and made it also work from the debian/ dir. |
59 |
sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/control |
60 |
[ -f $DEBIANDIR/control.in ] && sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/control.in |
|
|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
61 |
|
|
7
by Albin Tonnerre
A bit cleaner. add a --prefix option to specify a path to the source folder, and --section to specify the section |
62 |
dch "Modify Maintainer value to match Debian-Maintainer-Field Spec"
|
|
4
by Luke Yelavich
* Add update-maintainer script to change the maintainer field in |
63 |
echo "Maintainer changed to $email" |