Merge branch 'main/rendor-staging' into main/atys-live
[ryzomcore.git] / dist / debian / update_debian.sh
blob8c2c5dd7dce4419029a5ca28a4329e557ca13866
1 #!/bin/sh
3 HGBIN="/usr/bin/hg"
4 DCHBIN="/usr/bin/dch"
6 if [ ! -e $DCHBIN ]
7 then
8 apt-get install devscripts debhelper
9 fi
11 DISTRIB=$1
12 MINORDISTRIB=$2
14 if [ -z "$DISTRIB" ]
15 then
16 echo "You must specify a distribution"
17 exit 1
20 if [ -z "$MINORDISTRIB" ]
21 then
22 MINORDISTRIB=1
25 if [ ! -d "$DISTRIB" ]
26 then
27 echo "$DISTRIB is not supported, you can create the folder or compile for another version."
28 exit 1
31 echo "Targetting $DISTRIB..."
33 VERSION=$(./ryzomcore_version.sh)
35 if [ -z "$VERSION" ]
36 then
37 echo "Can't parse version from $VERSION_FILE, aborting..."
38 exit 1
41 REVISION=$($HGBIN identify -n | grep -o -P "[0-9]+")
43 DSTFOLDER=ryzom-core-$VERSION.$REVISION
45 if [ ! -d "$DSTFOLDER.orig" ]
46 then
47 echo "$DSTFOLDER.orig doesn't exist, did you forget to launch ./update.sh?"
48 exit 1
51 # copy files if directory doesn't exist
52 if [ ! -d $DSTFOLDER ]
53 then
54 # copy all files
55 echo "Copying files to $DSTFOLDER..."
56 cp -r -p $DSTFOLDER.orig $DSTFOLDER
59 cd $DSTFOLDER
61 echo "Copying debian directory..."
62 # delete debian directory if present
63 rm -rf debian
64 # create debian folder
65 mkdir -p debian
66 # copy debian folder
67 cp -r -p ../$DISTRIB/debian .
69 # returning the line with the version
70 LAST_VERSION=`grep $VERSION.$REVISION debian/changelog`
71 FULL_VERSION=$VERSION.$REVISION-1~$DISTRIB$MINORDISTRIB
73 # adding the new version to changelog
74 if [ -z "$LAST_VERSION" ]
75 then
76 echo "Adding $FULL_VERSION to debian/changelog for $DISTRIB"
77 $DCHBIN --force-distribution -b -v $FULL_VERSION -D $DISTRIB "New upstream release (revision $REVISION)"
78 else
79 echo "Last version is $LAST_VERSION"
82 echo "Creating source package..."
83 debuild -S
85 cd ..
87 echo "Done."
88 echo "If you want to upload source to your PPA, type: dput <ppa> ryzom-core_"$FULL_VERSION"_source.changes"