41 lines
943 B
Plaintext
41 lines
943 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
VERSION=1.1.0
|
||
|
|
||
|
[ -e ./lib/function.sh ] && source ./lib/function.sh
|
||
|
|
||
|
APP=mailhog
|
||
|
DEPOT=https://github.com/mailhog/MailHog.git
|
||
|
GIT_VERSION=v$VERSION-beta1
|
||
|
DEB_VERSION=$VERSION-$(date +%Y%m%d%H%M)
|
||
|
DEBIAN_VERSION_CODENAME=bullseye
|
||
|
IMAGE_SIZE=2
|
||
|
|
||
|
STEP="envinit prebuild build makedeb"
|
||
|
|
||
|
envinit() {
|
||
|
apt-get update
|
||
|
apt-get dist-upgrade -y
|
||
|
apt install -y --no-install-recommends build-essential git wget ca-certificates dpkg fakeroot
|
||
|
wget -qO - https://go.dev/dl/go1.18.linux-amd64.tar.gz | tar -C /usr/local -xz
|
||
|
}
|
||
|
|
||
|
prebuild(){
|
||
|
[ -e /tmp/${APP} ] && rm -fr /tmp/${APP}
|
||
|
git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/${APP}
|
||
|
}
|
||
|
|
||
|
build() {
|
||
|
cd /tmp/${APP}
|
||
|
PATH=$PATH:/usr/local/go/bin
|
||
|
go build -o mailhog main.go
|
||
|
}
|
||
|
|
||
|
makedeb(){
|
||
|
PATH_DEB=/tmp/src/rootfs
|
||
|
|
||
|
cp /tmp/${APP}/mailhog ${PATH_DEB}/usr/bin/mailhog
|
||
|
sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control
|
||
|
fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist
|
||
|
}
|