summaryrefslogtreecommitdiff
path: root/scripts/makeppa
blob: cb4fbe60fe4da39716245e95f789289d5c9542fb (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash

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

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

# version
version=`cat ./core/xmake.lua | grep -E "^set_version" | grep -oE "[0-9]*\.[0-9]*\.[0-9]*"`

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

# tarball
tarball=$workdir/xmake-$version.tar.gz
if [ ! -f $tarball ]; then
    ./scripts/archive-all
    cp ./artifacts/xmake.tar.gz $tarball
fi

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

# enter project directory
cd xmake-$version

# make template
echo "making template .."
if [ -d debian ]; then
    rm -rf debian
fi
USER=ruki 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 -k2C0C68C9

# 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:xmake-io/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

# install dh-make and gpg
# sudo apt install dh-make rng-tools
#
# @see https://help.ubuntu.com/community/GnuPrivacyGuardHowto
#
# generate key
# gpg --gen-key
#
# save public/private key
# gpg -a --export 2C0C68C9 > /mnt/xmake_ppa_pgp.pub
# gpg -a --export-secret-keys 2C0C68C9 > /mnt/xmake_ppa_pgp.sec
#
# submit to keykserver and import this key to launchpad.net
# @see https://launchpad.net/+help-registry/import-pgp-key.html
# gpg --send-keys --keyserver keyserver.ubuntu.com 2C0C68C9
#
# recv email and validate this gpg key
# gpg --decrypt file.txt
# goto link
#
# show gpg
# gpg --fingerprint
# pub   2048R/2C0C68C9 2020-09-08
#      Key fingerprint = 0271 3554 FA2C E4AA DA20  AB23 167A 22F2 2C0C 68C9
#
# build package and upload ppa to launchpad.net
# https://launchpad.net/~xmake-io/+archive/ubuntu/xmake
#
# recv and import key on ubuntu
# gpg --keyserver keyserver.ubuntu.com --recv 2C0C68C9
# gpg --export --armor 2C0C68C9 | sudo apt-key add -
#