forked from thorsten/phpMyFAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit2package.sh
executable file
·78 lines (65 loc) · 2.11 KB
/
git2package.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
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#
# This is the shell script for building:
# 1. a TAR.GZ package;
# 2. a ZIP package
# of phpMyFAQ using what committed into Git.
#
# For creating a package simply run:
#
# ./git2package.sh
#
# The script will download the source code from branch and
# it will create the 2 packages plus their MD5 hashes.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
#
# @package phpMyFAQ
# @author Matteo Scaramuccia <[email protected]>
# @author Thorsten Rinne <[email protected]>
# @author Rene Treffer <[email protected]>
# @author David Soria Parra <[email protected]>
# @author Florian Anderiasch <[email protected]>
# @copyright 2008-2019 phpMyFAQ Team
# @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
# @link https://www.phpmyfaq.de
# @version 2008-09-10
# phpMyFAQ Version
. scripts/version.sh
if [ "x${MD5BIN}" = "x" ]; then
if which md5 > /dev/null; then
MD5BIN="$(which md5)"
else
MD5BIN="$(which md5sum)"
fi
fi
# Package Folder
if [ "x${PMF_PACKAGE_FOLDER}" = "x" ]; then
PMF_PACKAGE_FOLDER="phpmyfaq-${PMF_VERSION}"
fi
cwd=`pwd`
git checkout-index -f -a --prefix=$cwd/build/checkout/${PMF_PACKAGE_FOLDER}/
# Add missing directories
mkdir -p $cwd/build/package/${PMF_PACKAGE_FOLDER}/
cd $cwd/build/checkout/${PMF_PACKAGE_FOLDER}/
# add dependencies
composer install --no-dev
yarn install
grunt build
# prepare packaging
cd $cwd
mv $cwd/build/checkout/${PMF_PACKAGE_FOLDER}/phpmyfaq $cwd/build/package/${PMF_PACKAGE_FOLDER}
# build packages
tar cfvz ${PMF_PACKAGE_FOLDER}.tar.gz -C $cwd/build/package/${PMF_PACKAGE_FOLDER} phpmyfaq
cd $cwd/build/package/${PMF_PACKAGE_FOLDER}
zip -r $cwd/${PMF_PACKAGE_FOLDER}.zip phpmyfaq
cd $cwd
# md5sum
$MD5BIN "${PMF_PACKAGE_FOLDER}.tar.gz" > "${PMF_PACKAGE_FOLDER}.tar.gz.md5"
$MD5BIN "${PMF_PACKAGE_FOLDER}.zip" > "${PMF_PACKAGE_FOLDER}.zip.md5"
# clean up
rm -rf $cwd/build/checkout/${PMF_PACKAGE_FOLDER}
rm -rf $cwd/build/package/${PMF_PACKAGE_FOLDER}
echo "done.\n";