-
Notifications
You must be signed in to change notification settings - Fork 2
/
newMajorVersion
executable file
·49 lines (40 loc) · 1.32 KB
/
newMajorVersion
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
#!/bin/bash
set -ue
if [ $# -ne 2 ]; then
echo "Usage: $0 oldversion newversion"
echo " eg: $0 6 7 -> Opencast 6.x-1 becomes Opencast 7.x-1"
echo " Note: oldversion *MUST* match current checkout version!"
exit 1
fi
old=$1
new=$2
package="opencast"
#Regenerate the changelog
./changelog $new x x unstable new
next=`bc <<< "$new + 1"`
echo "Creating r/$old.x"
git checkout -b r/$old.x
echo "Checking back out into develop"
git checkout develop
#Update the control file
sed -i "s/$new.x/$next.x/g" $package/debian/control
sed -i "s/$old.x/$new.x/g" $package/debian/control
sed -i "s/$package-$old/$package-$new/g" $package/debian/control
git add $package/debian/changelog $package/debian/control
#For all the packaging instruction files
ls opencast/debian/opencast-$old* | while read line
do
newname=`echo $line | sed "s/opencast-$old/opencast-$new/"`
#We do links first since links are a subset of files
if [ -L "$line" ]; then
#If it's a symlink, figure out where it should be linking to, remove the old one, and create a new one
git rm $line
allname=`echo $newname | sed "s/$new-.*.p/$new-all.p/" | sed "s/opencast\/debian\///"`
ln -s $allname $newname
git add -f $newname
elif [ -f "$line" ]; then
#If it's a plain file, rename it
git mv $line $newname
fi
done
git commit -m "Opencast $new.x"