-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·38 lines (28 loc) · 926 Bytes
/
package.sh
File metadata and controls
executable file
·38 lines (28 loc) · 926 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
#!/bin/bash -ex
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
ARCH=$(dpkg --print-architecture)
SNAP_DIR=${DIR}/build/snap
apt update
apt -y install squashfs-tools wget
cp -r ${DIR}/bin ${SNAP_DIR}
mkdir ${SNAP_DIR}/config
cp -r ${SNAP_DIR}/crowdsec/staging/etc/crowdsec ${SNAP_DIR}/config
cp -r ${DIR}/config ${SNAP_DIR}
cp ${DIR}/snap.yaml ${SNAP_DIR}/meta
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 ${DIR}/artifact
cp ${DIR}/${PACKAGE} ${DIR}/artifact