-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·38 lines (27 loc) · 899 Bytes
/
package.sh
File metadata and controls
executable file
·38 lines (27 loc) · 899 Bytes
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
#!/bin/bash -xe
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd ${DIR}
if [[ -z "$2" ]]; then
echo "usage $0 app version"
exit 1
fi
NAME=$1
VERSION=$2
apt update
apt install -y dpkg-dev squashfs-tools wget
ARCH=$(dpkg-architecture -q DEB_HOST_ARCH)
SNAP_DIR=${DIR}/build/snap
mkdir -p ${SNAP_DIR}/meta
cp -r ${DIR}/bin/. ${SNAP_DIR}/bin/
cp -r ${DIR}/config ${SNAP_DIR}
cp ${DIR}/snap.yaml ${SNAP_DIR}/meta/snap.yaml
echo "version: $VERSION" >> ${SNAP_DIR}/meta/snap.yaml
echo "architectures:" >> ${SNAP_DIR}/meta/snap.yaml
echo "- ${ARCH}" >> ${SNAP_DIR}/meta/snap.yaml
echo $VERSION > ${SNAP_DIR}/version
du -d10 -h $SNAP_DIR | sort -h | tail -100
PACKAGE=${NAME}_${VERSION}_${ARCH}.snap
echo ${PACKAGE} > ${DIR}/package.name
mksquashfs ${SNAP_DIR} ${DIR}/${PACKAGE} -noappend -comp xz -no-xattrs -all-root
mkdir -p ${DIR}/artifact
cp ${DIR}/${PACKAGE} ${DIR}/artifact