-
Notifications
You must be signed in to change notification settings - Fork 41
/
package.sh
executable file
·57 lines (44 loc) · 1.85 KB
/
package.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
#!/bin/bash -xe
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
if [[ -z "$1" ]]; then
echo "usage $0 version"
exit 1
fi
NAME=platform
ARCH=$(uname -m)
VERSION=$1
CA_CERTIFICATES_VERSION=20240203
cd ${DIR}/build
BUILD_DIR=${DIR}/build/snap
apt update
apt install -y wget squashfs-tools dpkg-dev
cp -r ${DIR}/bin ${BUILD_DIR}
cp -r ${DIR}/config ${BUILD_DIR}
wget http://ftp.us.debian.org/debian/pool/main/c/ca-certificates/ca-certificates_${CA_CERTIFICATES_VERSION}_all.deb
dpkg -x ca-certificates_${CA_CERTIFICATES_VERSION}_all.deb .
mv usr/share/ca-certificates/mozilla ${BUILD_DIR}/certs
wget --retry-on-http-error=503 --progress=dot:giga https://github.com/syncloud/3rdparty/releases/download/nginx/nginx-${ARCH}.tar.gz
tar xf nginx-${ARCH}.tar.gz
mv nginx ${BUILD_DIR}
wget --retry-on-http-error=503 --progress=dot:giga https://github.com/syncloud/3rdparty/releases/download/gptfdisk/gptfdisk-${ARCH}.tar.gz
tar xf gptfdisk-${ARCH}.tar.gz
mv gptfdisk ${BUILD_DIR}
wget --retry-on-http-error=503 --progress=dot:giga https://github.com/syncloud/3rdparty/releases/download/openldap/openldap-${ARCH}.tar.gz
tar xf openldap-${ARCH}.tar.gz
mv openldap ${BUILD_DIR}
wget --retry-on-http-error=503 --progress=dot:giga https://github.com/syncloud/3rdparty/releases/download/btrfs/btrfs-${ARCH}.tar.gz
tar xf btrfs-${ARCH}.tar.gz
mv btrfs ${BUILD_DIR}
cd ${DIR}/build
echo "snapping"
ARCH=$(dpkg-architecture -q DEB_HOST_ARCH)
cp -r ${DIR}/meta ${BUILD_DIR}
echo ${VERSION} >> ${BUILD_DIR}/meta/version
echo "version: $VERSION" >> ${BUILD_DIR}/meta/snap.yaml
echo "architectures:" >> ${BUILD_DIR}/meta/snap.yaml
echo "- ${ARCH}" >> ${BUILD_DIR}/meta/snap.yaml
PACKAGE=${NAME}_${VERSION}_${ARCH}.snap
echo ${PACKAGE} > $DIR/package.name
mksquashfs ${BUILD_DIR} ${DIR}/${PACKAGE} -noappend -comp xz -no-xattrs -all-root
mkdir ${DIR}/artifact
cp ${DIR}/${PACKAGE} ${DIR}/artifact