49 lines
1.4 KiB
Bash
Executable file
49 lines
1.4 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
set -exo pipefail
|
|
|
|
|
|
ROOT=$(pwd)
|
|
function fetch() {
|
|
cd "${SRCDIR}"
|
|
git clone https://github.com/jonans/bsnotify
|
|
cd bsnotify
|
|
export VERSION=0.$(git rev-list --count HEAD)
|
|
}
|
|
|
|
function prepare() {
|
|
chmod +x "${SRCDIR}/bsnotify/bsnotify"
|
|
mkdir -p \
|
|
"${PKGDIR}/DEBIAN" \
|
|
"${PKGDIR}/usr/bin" \
|
|
"${PKGDIR}/etc/default" \
|
|
"${PKGDIR}/lib/systemd/system"
|
|
cp "${SRCDIR}/bsnotify" "${PKGDIR}/usr/bin/bsnotify"
|
|
cp "${ROOT}/bsnotify.defaults" "${PKGDIR}/etc/default/bsnotify"
|
|
cp "${ROOT}/bsnotify.service" "${PKGDIR}/lib/systemd/system/bsnotify.service"
|
|
cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control"
|
|
cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles"
|
|
cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst"
|
|
cp "${ROOT}/debian.prerm" "${PKGDIR}/DEBIAN/prerm"
|
|
cp "${ROOT}/debian.postrm" "${PKGDIR}/DEBIAN/postrm"
|
|
sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control"
|
|
sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control"
|
|
find "${PKGDIR}" -exec touch -m -d "${ISODATE}" {} \;
|
|
}
|
|
|
|
function package() {
|
|
cd "${BUILDDIR}"
|
|
dpkg-deb --build "${PKGDIR}" "${BUILDDIR}"
|
|
}
|
|
|
|
function build() {
|
|
export BUILDDIR=${ROOT}/build
|
|
export SRCDIR=${ROOT}/build/srcdir
|
|
export PKGDIR=${ROOT}/build/pkgdir
|
|
mkdir -p ${SRCDIR} ${PKGDIR}
|
|
fetch
|
|
prepare
|
|
package
|
|
}
|
|
|
|
build
|