forked from polymetric/prines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package
executable file
·48 lines (43 loc) · 1002 Bytes
/
package
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
#!/bin/bash
gen_basic_version() {
filename=$1
cp ${call_dir}/version_template.xml ./version.xml
sed -i "s/{EXEC_NAME}/${filename}/" ./version.xml
}
add_version() {
set -eu
call_dir=$(pwd)
name=$1
version=$2
arch=$3
executable=${call_dir}/$4
apps_root=${call_dir}/apps
version_dir=${apps_root}/${name}/${version}/${arch}
if [ ! -e $executable ]; then
echo "executable file does not exist"
exit 1
fi
mkdir -p ${version_dir}
pushd ${version_dir}
cp ${executable} .
gen_basic_version $(ls .)
popd
}
case $1 in
add-version)
if [ "$#" -ne 5 ]; then
echo "usage: ./package add-version <appname> <version> <arch> <file>"
exit 1
fi
add_version $2 $3 $4 $5
echo "done"
;;
archive)
if [ -z $2 ]; then
echo "need name of archive"
exit 1
fi
tar cJvf $2.tar.xz apps/
echo "done"
;;
esac