50 lines
1.4 KiB
Bash
Executable File
50 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
[ -e ./lib/function.sh ] && source ./lib/function.sh
|
|
|
|
APP=gotify
|
|
VERSION=2.1.4
|
|
GIT_VERSION=v$VERSION
|
|
DEB_VERSION=$VERSION-2
|
|
DEBIAN_VERSION_CODENAME=bullseye
|
|
IMAGE_SIZE=4
|
|
|
|
STEP="envinit prebuild build makedeb"
|
|
|
|
envinit() {
|
|
apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot
|
|
wget -qO - https://deb.nodesource.com/setup_16.x | bash
|
|
wget -qO - https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor > /usr/share/keyrings/yarnkey.gpg
|
|
echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" > /etc/apt/sources.list.d/yarn.list
|
|
apt-get update
|
|
apt-get install -y nodejs yarn
|
|
wget -qO - https://go.dev/dl/go1.17.7.linux-amd64.tar.gz | tar -C /usr/local -xz
|
|
}
|
|
|
|
prebuild(){
|
|
GIT_VERSION=$1
|
|
git clone --depth 1 -b ${GIT_VERSION} https://github.com/gotify/server.git /tmp/server
|
|
}
|
|
|
|
build() {
|
|
cd /tmp/server/
|
|
PATH=${PATH}:/usr/local/go/bin
|
|
export GO111MODULE=on
|
|
make download-tools
|
|
go get -d
|
|
(cd ui && yarn && yarn build)
|
|
go run hack/packr/packr.go
|
|
go build -ldflags="$LD_FLAGS" -o gotify-server
|
|
}
|
|
|
|
makedeb(){
|
|
GIT_VERSION=$1
|
|
DEB_VERSION=$2
|
|
PATH_DEB=/tmp/src/rootfs
|
|
|
|
cp /tmp/server/gotify-server ${PATH_DEB}/usr/bin/
|
|
cp /tmp/server/config.example.yml ${PATH_DEB}/etc/gotify/config.yml
|
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
|
}
|