Skip to content

Commit

Permalink
Feat: packaging for alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 1, 2019
1 parent fd93a6d commit a545658
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
47 changes: 47 additions & 0 deletions contrib/alpine/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Contributor: Juergen Mang <[email protected]>
# Maintainer: Juergen Mang <[email protected]>
pkgname=myMPD
pkgver=5.5.1
pkgrel=0
pkgdesc="myMPD is a standalone and mobile friendly web mpdclient"
url="https://github.com/jcorporation/myMPD"
arch="all"
license="GPL-2.0-or-later"
depends="libmpdclient libmediainfo openssl"
makedepends="cmake libmpdclient-dev libmediainfo-dev openssl-dev linux-headers"
install="$pkgname.pre-install $pkgname.post-install"
source="
https://github.com/jcorporation/myMPD/archive/v5.5.1.zip
myMPD.initd
"
builddir="$srcdir/$pkgname-$pkgver"
options="!check"
#no test suite

build() {
cd "$builddir"
mkdir release
cd release
if [ "$CBUILD" != "$CHOST" ]; then
CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=True \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
${CMAKE_CROSSOPTS} ..
make
}

package() {
cd "$builddir/release"
make DESTDIR="$pkgdir" install

install -m755 -D "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname
chown -R mympd.mympd "$pkgdir"/var/lib/mympd
}

16 changes: 16 additions & 0 deletions contrib/alpine/myMPD.initd
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/sbin/openrc-run

# myMPD init.d file for alpine linux.

name=mympd
command="/usr/bin/$name"
command_args=""
command_background="yes"

start_stop_daemon_args=""
pidfile="/run/$name.pid"

depend() {
need net
after firewall
}
39 changes: 39 additions & 0 deletions contrib/alpine/myMPD.post-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

ETCDIR="/etc/mympd"
SHAREDIR="/usr/share/mympd"
VARDIR="/var/lib/mympd"

# move smartpls into place unless already existing
for PLDIST in "${VARDIR}"/smartpls/*.dist
do
if [ -f "$PLDIST" ]
then
PLS=$(basename "$PLDIST" .dist)
if [ -f "${VARDIR}/smartpls/$PLS" ]
then
rm "$PLDIST"
else
mv -v "$PLDIST" "${VARDIR}/smartpls/$PLS"
fi
fi
done

# move config into place unless already existing
if [ ! -f "${ETCDIR}/mympd.conf" ]
then
mv "${ETCDIR}/mympd.conf.dist" "${ETCDIR}/mympd.conf"
else
echo "mympd.conf installed as mympd.conf.dist"
fi

if [ -d "${VARDIR}/ssl" ]
then
echo "Certificates already created"
else
echo "Creating certificates"
"${SHAREDIR}/crcert.sh" "${VARDIR}/ssl"
fi

echo "myMPD installed"
echo "Edit ${ETCDIR}/mympd.conf before starting myMPD"
6 changes: 6 additions & 0 deletions contrib/alpine/myMPD.pre-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

addgroup -S mympd 2>/dev/null
adduser -S -D -H -s /bin/flase -G mympd -g mympd mympd 2>/dev/null

exit 0

0 comments on commit a545658

Please sign in to comment.