-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·40 lines (33 loc) · 1.01 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
#!/bin/sh
# Author: Valentin Popov
# Email: [email protected]
# Date: 2018-07-20
# Usage: /bin/sh ./build.sh
# Description: Build the final package for installation in Moodle.
# Updating the Environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export PATH="$PATH:/usr/local/scripts"
# Current project
PROJECT="auth_billing"
# Defining directories
DIRECTORY="$(pwd)"
NAMEDIR="$(basename $DIRECTORY)"
TMPDIR="$(mktemp --directory)"
# Creating a Temporary Directory
cp --recursive --verbose "../$NAMEDIR" "$TMPDIR/$PROJECT"
mkdir --parents --verbose "$DIRECTORY/build"
cd "$TMPDIR"
# Creating an archive
zip -9 -r "$DIRECTORY/build/$PROJECT.zip" "$PROJECT" \
-x "$PROJECT/.git*" \
-x "$PROJECT/.travis.yml" \
-x "$PROJECT/.vscode*" \
-x "$PROJECT/build*" \
-x "$PROJECT/composer.*" \
-x "$PROJECT/vendor*"
# Signature of archive
cd "$DIRECTORY/build"
gpg --sign "$PROJECT.zip"
sha256sum "$PROJECT.zip" > "$PROJECT.zip.sha256sum"
# End of work
exit 0