summaryrefslogtreecommitdiff
path: root/scripts/makeppa
blob: e95d5501927eb1c1feef234d182288703611119e (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash

# check
if [ $# -lt 1 ]; then
    echo "Usage: ./scripts/makeppa [version] [patch]"
    exit
fi

# workdir
workdir=./xmake-ppa
if [ ! -d $workdir ]; then
    mkdir $workdir
fi

# version
version=$1

# patch number
patch="$2"
if [ -z $patch ]; then
    patch=1
fi

# tarball
tarball=$workdir/xmake-$version.tar.gz
if [ ! -f $tarball ]; then
    wget https://github.com/xmake-io/xmake/archive/v$version.tar.gz -O $workdir/xmake-$version.tar.gz
fi

# extract tarball
cd $workdir
if [ ! -d xmake-$version ]; then
    tar -xvf xmake-$version.tar.gz
fi

# enter project directory
cd xmake-$version

# make template
echo "making template .."
if [ -d debian ]; then
    rm -rf debian
fi
dh_make -e [email protected] -c apache -y -s -f ../xmake-$version.tar.gz

# copy debian
echo "instaling debian .."
if [ -d debian ]; then
    rm -rf debian
fi
cp -r ../../scripts/debian .

# build package
echo "building package .."
debuild -S -k8A0FFB63

# check package
echo "checking package .."
lintian ../xmake_$version-$patch.dsc

# upload package
source=xmake_$version-"$patch"_source
while true; do
    read -p "Do you wish to upload this package? (y/n)" yn
    case $yn in
        [Yy]* ) if [ -f ../$source.ppa.upload ]; then rm ../$source.ppa.upload; fi ; dput ppa:tboox/xmake ../$source.changes; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer y or n.";;
    esac
done

# remove workdir
cd ../..
while true; do
    read -p "Do you wish to remove working directory? (y/n)" yn
    case $yn in
        [Yy]* ) rm -rf xmake-ppa; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer y or n.";;
    esac
done