-
-
Notifications
You must be signed in to change notification settings - Fork 135
/
build.sh
65 lines (36 loc) · 1.33 KB
/
build.sh
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
#!/usr/bin/env bash
if [ -z "$1" ];then
exec echo -e "
Build khs1994-docker/lnmp deb or rpm
Usage:
$ scripts/cli/build.sh deb \${TAG}
$ scripts/cli/build.sh rpm \${TAG}
Example:
$ scripts/cli/build.sh deb v18.05
$ scripts/cli/build.sh rpm v18.06-rc1
"
fi
set -ex
if [ -f khs1994-robot.enc ];then exit 1; fi
_deb(){
cd scripts/cli/deb
sed -i "s#KHS1994_DOCKER_LNMP_VERSION#${VERSION}#g" DEBIAN/control
rm -rf data/.gitignore data/* README.md
# https://github.com/khs1994-docker/lnmp/archive/v18.05.tar.gz
# wget -O lnmp.tar.gz https://github.com/khs1994-docker/lnmp/archive/v${VERSION}.tar.gz
# tar -zxvf lnmp.tar.gz ; mv lnmp-${VERSION} data/lnmp
git clone -b v${VERSION} --depth=1 --recursive https://github.com/khs1994-docker/lnmp.git data/lnmp
# rm git
sudo rm -rf data/lnmp/.git
chmod -R 755 DEBIAN
cd .. ; dpkg-deb -b deb khs1994-docker-lnmp_${VERSION}_amd64.deb
}
_rpm(){
sed -i "s#KHS1994_DOCKER_LNMP_VERSION#${VERSION}#g" scripts/cli/rpm/SPECS/khs1994-docker-lnmp.spec
rpmbuild -bb scripts/cli/rpm/SPECS/khs1994-docker-lnmp.spec || sed -i "s#${VERSION}#KHS1994_DOCKER_LNMP_VERSION#g" cli/rpm/SPECS/khs1994-docker-lnmp.spec
sed -i "s#${VERSION}#KHS1994_DOCKER_LNMP_VERSION#g" scripts/cli/rpm/SPECS/khs1994-docker-lnmp.spec
}
command=$1
VERSION=$( echo $2 | cut -d "v" -f 2 )
shift
_$command $VERSION