1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-26 02:50:26 +00:00

Feat: add debian packaging

This commit is contained in:
jcorporation 2018-09-07 00:10:40 +02:00
parent c293e87b3b
commit a9dcff3135
9 changed files with 93 additions and 9 deletions

View File

@ -40,10 +40,10 @@ add_executable(mympd ${SOURCES})
target_link_libraries(mympd ${LIBMPDCLIENT_LIBRARY} ${OPENSSL_LIBRARIES})
install(TARGETS mympd DESTINATION bin)
install(FILES contrib/mympd.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
install(PROGRAMS contrib/crcert.sh DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/)
install(FILES contrib/mympd.service DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/)
install(FILES contrib/mympd.conf DESTINATION /etc/${PROJECT_NAME}/)
install(FILES contrib/mympd.1 DESTINATION share/man/man1)
install(PROGRAMS contrib/crcert.sh DESTINATION share/${PROJECT_NAME}/)
install(FILES contrib/mympd.service DESTINATION share/${PROJECT_NAME}/)
install(FILES contrib/mympd.conf DESTINATION ../etc/${PROJECT_NAME}/)
install(FILES htdocs/mympd.webmanifest DESTINATION share/${PROJECT_NAME}/htdocs/)
install(FILES dist/htdocs/index.html DESTINATION share/${PROJECT_NAME}/htdocs/)
install(FILES dist/htdocs/player.html DESTINATION share/${PROJECT_NAME}/htdocs/)
@ -55,4 +55,4 @@ install(FILES dist/htdocs/css/bootstrap.min.css DESTINATION share/${PROJECT_NAME
install(FILES dist/htdocs/css/mympd.min.css DESTINATION share/${PROJECT_NAME}/htdocs/css/)
install(DIRECTORY htdocs/assets DESTINATION share/${PROJECT_NAME}/htdocs)
install(DIRECTORY DESTINATION share/${PROJECT_NAME}/htdocs/pics)
install(DIRECTORY DESTINATION /var/lib/${PROJECT_NAME}/)
install(DIRECTORY DESTINATION ../var/lib/${PROJECT_NAME}/)

View File

@ -39,9 +39,9 @@ make install DESTDIR=%{buildroot}
%post
getent group mympd > /dev/null
[ "$?" == "2" ] && groupadd mympd
[ "$?" = "2" ] && groupadd mympd
getent passwd mympd > /dev/null
[ "$?" == "2" ] && useradd mympd -g mympd
[ "$?" = "2" ] && useradd mympd -g mympd
if [ -d /usr/lib/systemd/ ]
then
[ -d /usr/lib/systemd/system ] || sudo mkdir /usr/lib/systemd/system

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
mympd (4.1.0-1) unstable; urgency=medium
* Initial release
-- Juergen Mang <mail@jcgames.de> Thu, 06 Sep 2018 22:57:18 +0200

12
debian/control vendored Normal file
View File

@ -0,0 +1,12 @@
Source: mympd
Section: unknown
Priority: optional
Maintainer: Juergen Mang <mail@jcgames.de>
Build-Depends: debhelper (>= 10)
Standards-Version: 4.1.2
Homepage: https://github.com/jcorporation/myMPD
Package: mympd
Architecture: any
Depends: libmpdclient2, openssl
Description: myMPD is a standalone and modern web mpdclient.

39
debian/postinst vendored Executable file
View File

@ -0,0 +1,39 @@
#/bin/bash
echo "Fixing ownership of /var/lib/mympd"
getent group mympd > /dev/null
[ "$?" = "2" ] && groupadd mympd
getent passwd mympd > /dev/null
[ "$?" = "2" ] && useradd mympd -g mympd
chown -R mympd.mympd /var/lib/mympd
echo "Trying to link musicdir to library"
if [ -f /etc/mpd.conf ]
then
LIBRARY=$(grep ^music_directory /etc/mpd.conf | awk {'print $2'} | sed -e 's/"//g')
[ "$LIBRARY" != "" ] && [ ! -e /usr/share/mympd/htdocs/library ] && ln -s "$LIBRARY" /usr/share/mympd/htdocs/library
else
echo "/etc/mpd.conf not found, you must link your music_directory manually to /usr/share/mympd/htdocs/library"
fi
if [ -d /usr/lib/systemd/ ]
then
echo "Installing systemd service"
[ -d /usr/lib/systemd/system ] || mkdir /usr/lib/systemd/system
if [ contrib/mympd.service -nt /usr/lib/systemd/system/mympd.service ]
then
cp contrib/mympd.service /usr/lib/systemd/system/
fi
fi
if [ -d /etc/mympd/ssl ]
then
echo "Certificates already created"
else
echo "Creating certificates"
sudo contrib/crcert.sh
fi
echo "myMPD installed"
echo "Edit /etc/mympd/mympd.conf before starting myMPD"

25
debian/rules vendored Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/make -f
export DH_VERBOSE = 1
BUILDDIR = release
build:
mkdir $(BUILDDIR)
cd $(BUILDDIR); cmake -DCMAKE_INSTALL_PREFIX:PATH=../debian/tmp/usr -DCMAKE_BUILD_TYPE=RELEASE ..
make -C $(BUILDDIR)
binary: binary-indep binary-arch
binary-indep:
binary-arch:
cd $(BUILDDIR); cmake -P cmake_install.cmake
mkdir debian/tmp/DEBIAN
cp debian/postinst debian/tmp/DEBIAN
dpkg-gencontrol -pmympd
dpkg --build debian/tmp ..
clean:
rm -rf $(BUILDDIR)
.PHONY: binary binary-arch binary-indep clean

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -1,6 +1,8 @@
#!/bin/sh
rm -rf release
rm -rf debug
rm -rf debian/tmp
rm -f debian/files
rm -f htdocs/js/bootstrap-native-v4.min.js
rm -f htdocs/css/bootstrap.min.css
find ./ -name \*~ -delete

View File

@ -51,9 +51,9 @@ cd ..
echo "Fixing ownership of /var/lib/mympd"
getent group mympd > /dev/null
[ "$?" == "2" ] && sudo groupadd mympd
[ "$?" = "2" ] && sudo groupadd mympd
getent passwd mympd > /dev/null
[ "$?" == "2" ] && sudo useradd mympd -g mympd
[ "$?" = "2" ] && sudo useradd mympd -g mympd
sudo chown -R mympd.mympd /var/lib/mympd
echo "Trying to link musicdir to library"