-
Notifications
You must be signed in to change notification settings - Fork 2
/
SPK_Pack_Stage.sh
executable file
·79 lines (60 loc) · 2.35 KB
/
SPK_Pack_Stage.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/bash
# Filename: SPK_Pack_Stage.sh - coded in utf-8
# DSM7DemoSPK
#
# Copyright (C) 2023 by Tommes
# Member of the German Synology Community Forum
# License GNU GPLv3
# https://www.gnu.org/licenses/gpl-3.0.html
# -------------------------------------------------------------------------------------------------
# Please make your desired changes here
# -------------------------------------------------------------------------------------------------
# Define package name and version
package_name="DSM7DemoSPK"
version="1.0-500"
# -------------------------------------------------------------------------------------------------
# Please do not make any changes below, unless you know what you are doing!
# -------------------------------------------------------------------------------------------------
# Create working directory
# -----------------------------------------------
path=$(pwd)
working_dir=/tmp/_${package_name}
if [ -d ${working_dir} ]; then
rm -rf ${working_dir}
else
mkdir -p ${working_dir}
fi
# Create pack stage
# -----------------------------------------------
package_dir=${working_dir}/package
mkdir -p ${package_dir}
cp -a ui ${package_dir}
# Create binary file(s)
# -----------------------------------------------
binary_dir=${package_dir}/usr/local/bin
mkdir -p ${binary_dir}
touch ${binary_dir}/${package_name}
echo "#!/bin/sh" >> ${binary_dir}/${package_name}
echo '/var/packages/'${package_name}'/scripts/start-stop-status "$@"' >> ${binary_dir}/${package_name}
# Create SPK
# -----------------------------------------------
cp -a conf ${working_dir}/conf
cp -a scripts ${working_dir}/scripts
cp -a WIZARD_UIFILES ${working_dir}/WIZARD_UIFILES
cp -a CHANGELOG ${working_dir}
cp -a LICENSE ${working_dir}
cp -a PACKAGE_ICON*.PNG ${working_dir}
sed '1d' INFO.sh > ${working_dir}/INFO.tmp
head -n -2 < ${working_dir}/INFO.tmp > ${working_dir}/INFO
rm ${working_dir}/INFO.tmp
chmod -R 777 ${working_dir}
chmod -R 755 ${package_dir}
# Build SPK
# -----------------------------------------------
tar -C ${package_dir}/ -czf ${working_dir}/package.tgz .
chmod 755 ${working_dir}/package.tgz
rm -rf ${package_dir}
cd ${working_dir}
tar --exclude=".git/*" --exclude=".gitignore/*" -cvf ${working_dir}/${package_name}-${version}.spk *
mv ${working_dir}/${package_name}-${version}.spk ${path}
rm -rf ${working_dir}