mpd: move scripts and config from mpfire to mpd

this allows to use mpd without mpfire installed.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
Arne Fitzenreiter 2024-02-24 16:39:59 +01:00
parent db4977b30a
commit 3de42257d0
16 changed files with 124 additions and 51 deletions

View File

@ -0,0 +1,4 @@
/etc/asound.state
/var/ipfire/mpd/db/
/var/ipfire/mpd/mpd.conf
/var/ipfire/mpd/mpd_state

View File

@ -1,6 +1,2 @@
/etc/asound.state
/var/ipfire/mpfire/db/
/var/ipfire/mpfire/mpd.conf
/var/ipfire/mpfire/mpd_state
/var/ipfire/mpfire/settings
/var/ipfire/mpfire/webradio

View File

@ -5,7 +5,7 @@
##################### REQUIRED ###########################
port "6600"
music_directory "/var/mp3"
playlist_directory "/var/ipfire/mpfire"
playlist_directory "/var/ipfire/mpd"
log_file "/var/log/mpd.log"
pid_file "/var/run/mpd.pid"
##########################################################
@ -18,7 +18,7 @@ pid_file "/var/run/mpd.pid"
#
# Location of DB file
#
db_file "/var/ipfire/mpfire/db/mpd.db"
db_file "/var/ipfire/mpd/db/mpd.db"
#
# The state file (if set) will be a file
# for storing all current information
@ -27,7 +27,7 @@ db_file "/var/ipfire/mpfire/db/mpd.db"
# to recreate your last MPD session after
# restart.
#
state_file "/var/ipfire/mpfire/mpd_state"
state_file "/var/ipfire/mpd/mpd_state"
#
##########################################################
@ -104,12 +104,6 @@ audio_output {
#
audio_buffer_size "2048"
#
# This means exactly what it says, it will
# buffer your file up to the percentage of
# the buffer before it begins playing.
#
buffer_before_play "25%"
#
##########################################################
@ -189,9 +183,6 @@ connection_timeout "60"
#
filesystem_charset "UTF-8"
#
# The encoding that ID3v1 tags should be converted from.
#
id3v1_encoding "UTF-8"
metadata_to_use "artist,album,title,track,name,comment,date,genre"
#
################################################################

View File

@ -87,7 +87,7 @@ sub shuffle(){
}
sub checkplaylist(){
my $Datei = "/var/ipfire/mpfire/playlist.m3u";
my $Datei = "/var/ipfire/mpd/playlist.m3u";
my @Info = stat($Datei);
if ( $Info[7] eq '' || $Info[7] eq '0' ){print "There is no playlist";exit(1);}
}

View File

@ -387,4 +387,5 @@ usr/share/gnump3d
var/cache/gnump3d
var/cache/gnump3d/serving
var/log/gnump3d
#var/mp3
var/mp3/info

View File

@ -8,3 +8,10 @@ usr/bin/mpd
#usr/share/icons/hicolor/scalable/apps/mpd.svg
var/log/mpd.error.log
var/log/mpd.log
var/ipfire/backup/addons/includes/mpd
#var/ipfire/mpd
#var/ipfire/mpd/db
var/ipfire/mpd/db/info
var/ipfire/mpd/mpd.conf
var/ipfire/mpd/playlist.m3u
var/mp3/info

View File

@ -27,15 +27,9 @@ var/ipfire/menu.d/EX-mpfire.menu
var/ipfire/mpfire
var/ipfire/mpfire/bin
var/ipfire/mpfire/bin/mpfire.pl
#var/ipfire/mpfire/db
var/ipfire/mpfire/db/info
var/ipfire/mpfire/mpd.conf
var/ipfire/mpfire/playlist.m3u
var/ipfire/mpfire/settings
var/ipfire/mpfire/webradio
var/mp3/info
usr/local/bin/mpfirectrl
srv/web/ipfire/cgi-bin/mpfire.cgi
srv/web/ipfire/html/images/mpfire
var/ipfire/menu.d/EX-mpfire.menu
#var/mp3

View File

@ -214,11 +214,11 @@ if ( $mpfiresettings{'ACTION'} eq "scan" ){
delete $mpfiresettings{'PAGE'}; delete $mpfiresettings{'FRAME'};
&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);
open(DATEI, "<${General::swroot}/mpfire/mpd.conf") || die "Datei nicht gefunden";
open(DATEI, "<${General::swroot}/mpd/mpd.conf") || die "Datei nicht gefunden";
my @Zeilen = <DATEI>;
close(DATEI);
open(DATEI, ">${General::swroot}/mpfire/mpd.conf") || die "Datei nicht gefunden";
open(DATEI, ">${General::swroot}/mpd/mpd.conf") || die "Datei nicht gefunden";
foreach (@Zeilen){
if ( $_ =~ /music_directory/){
print DATEI "music_directory \"".$mpfiresettings{'MUSICDIR'}."\"\n";

14
lfs/mpd
View File

@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2023 IPFire Team <info@ipfire.org> #
# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@ -34,7 +34,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/${THISAPP}
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = mpd
PAK_VER = 33
PAK_VER = 35
# SUP_ARCH = aarch64 x86_64
DEPS = alsa avahi faad2 ffmpeg flac lame libmad libshout libogg libid3tag libvorbis opus soxr fmt
@ -105,6 +105,16 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
#install initscripts
$(call INSTALL_INITSCRIPTS,$(SERVICES))
-mkdir -p /var/ipfire/mpd/db
touch /var/ipfire/mpd/playlist.m3u
install -v -m 664 $(DIR_SRC)/config/mpd/mpd.conf /var/ipfire/mpd/
echo "Folder for mpd database" > /var/ipfire/mpd/db/info
-mkdir -p /var/mp3
echo "Folder for music files" > /var/mp3/info
chown root.nobody /var/ipfire/mpd/{mpd.conf,playlist.m3u}
chmod 664 /var/ipfire/mpd/playlist.m3u
install -v -m 644 $(DIR_SRC)/config/backup/includes/mpd /var/ipfire/backup/addons/includes/mpd
@rm -rf $(DIR_APP)
touch /var/log/mpd.error.log
touch /var/log/mpd.log

View File

@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007-2019 IPFire Team <info@ipfire.org> #
# Copyright (C) 2007-2024 IPFire Team <info@ipfire.org> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
@ -32,7 +32,7 @@ THISAPP = mpfire-$(VER)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = mpfire
PAK_VER = 16
PAK_VER = 17
DEPS = mpd mpc
@ -61,17 +61,11 @@ dist:
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
-mkdir -p /var/ipfire/mpfire/{bin,db}
touch /var/ipfire/mpfire/{settings,playlist.m3u}
-mkdir -p /var/ipfire/mpfire/bin
touch /var/ipfire/mpfire/settings
install -v -m 755 $(DIR_SRC)/config/mpfire/mpfire.pl /var/ipfire/mpfire/bin
install -v -m 664 $(DIR_SRC)/config/mpfire/mpd.conf /var/ipfire/mpfire/
install -v -m 644 $(DIR_SRC)/config/mpfire/webradio /var/ipfire/mpfire/
echo "Folder for mpd database" > /var/ipfire/mpfire/db/info
-mkdir -p /var/mp3
echo "Folder for music files" > /var/mp3/info
chown root.nobody /var/ipfire/mpfire/{mpd.conf,playlist.m3u}
chown nobody.nobody /var/ipfire/mpfire/{settings,webradio}
chmod 664 /var/ipfire/mpfire/playlist.m3u
chmod 755 /srv/web/ipfire/html/images/mpfire
install -v -m 644 $(DIR_SRC)/config/backup/includes/mpfire /var/ipfire/backup/addons/includes/mpfire
-mkdir -p /usr/lib/perl5/site_perl/5.36.0/Audio/

32
src/paks/mpd/install.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
############################################################################
# #
# This file is part of the IPFire Firewall. #
# #
# IPFire is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# IPFire is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
extract_files
ln -svf /etc/init.d/mpd /etc/rc.d/rc3.d/S65mpd
ln -svf /etc/init.d/mpd /etc/rc.d/rc0.d/K35mpd
ln -svf /etc/init.d/mpd /etc/rc.d/rc6.d/K35mpd
ln -svf /var/ipfire/mpd/mpd.conf /etc/mpd.conf
touch /var/log/mpd.log
restore_backup ${NAME}
/etc/init.d/mpd start

28
src/paks/mpd/uninstall.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
############################################################################
# #
# This file is part of the IPFire Firewall. #
# #
# IPFire is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# IPFire is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
/etc/init.d/mpd stop
make_backup ${NAME}
remove_files
rm -f /etc/rc.d/rc*.d/???mpd /var/log/mpd.error.log /var/log/mpd.log /etc/mpd.conf

27
src/paks/mpd/update.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
############################################################################
# #
# This file is part of the IPFire Firewall. #
# #
# IPFire is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# IPFire is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
extract_backup_includes
./uninstall.sh
./install.sh

View File

@ -17,20 +17,11 @@
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2011 IPFire-Team <info@ipfire.org>. #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
extract_files
ln -svf /etc/init.d/mpd /etc/rc.d/rc3.d/S65mpd
ln -svf /etc/init.d/mpd /etc/rc.d/rc0.d/K35mpd
ln -svf /etc/init.d/mpd /etc/rc.d/rc6.d/K35mpd
ln -svf /var/ipfire/mpfire/mpd.conf /etc/mpd.conf
chmod 755 /srv/web/ipfire/html/images/mpfire
touch /var/log/mpd.log
restore_backup ${NAME}
# comment removed option from config
sed -i -e "s|^error_file|#error_file|g" /var/ipfire/mpfire/mpd.conf
#
/etc/init.d/mpd start

View File

@ -17,12 +17,10 @@
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007 IPFire-Team <info@ipfire.org>. #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#
. /opt/pakfire/lib/functions.sh
/etc/init.d/mpd stop
make_backup ${NAME}
remove_files
rm -f /etc/rc.d/rc*.d/???mpd /var/log/mpd.error.log /var/log/mpd.log /etc/mpd.conf

View File

@ -17,7 +17,7 @@
# along with IPFire; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
# Copyright (C) 2007-2020 IPFire-Team <info@ipfire.org>. #
# Copyright (C) 2007-2024 IPFire-Team <info@ipfire.org>. #
# #
############################################################################
#