From 71839611649f7e59704d777f2df42fbd6ce40410 Mon Sep 17 00:00:00 2001 From: Albert Hopkins Date: Thu, 24 Feb 2011 23:35:34 -0500 Subject: [PATCH] teamplayer: Added optional zeroconf broadcast support --- teamplayer/Makefile | 43 +++++++++++++++++++++-------------- teamplayer/teamplayer.service | 7 ++++++ 2 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 teamplayer/teamplayer.service diff --git a/teamplayer/Makefile b/teamplayer/Makefile index f0e9786..11b7e05 100644 --- a/teamplayer/Makefile +++ b/teamplayer/Makefile @@ -4,46 +4,55 @@ TP_HOME = /opt/teamplayer TP_DB = /var/lib/teamplayer PGVER = 9.0 INSTALL = install +AVAHI := NO M4_DEFS += -D TP_USER=$(TP_USER) -D TP_HOME=$(TP_HOME) -D TP_DB=$(TP_DB) M4C = $(M4) $(M4_DEFS) +inroot := chroot $(CHROOT) + post_files = bash_profile settings_local.py start-teamplayer stop-teamplayer -post_files += local.start local.stop issue lighttpd.conf +post_files += local.start local.stop issue lighttpd.conf teamplayer.service preinstall: postinstall: $(post_files) - chroot $(CHROOT) $(EMERGE) -n $(USEPKG) =dev-db/postgresql-server-$(PGVER)* - chroot $(CHROOT) passwd -d postgres + $(inroot) $(EMERGE) -n $(USEPKG) =dev-db/postgresql-server-$(PGVER)* + $(inroot) passwd -d postgres echo 'PG_INITDB_OPTS="--locale=en_US.UTF-8"' >> $(CHROOT)/etc/conf.d/postgresql-$(PGVER) - yes | chroot $(CHROOT) $(EMERGE) --config =postgresql-server-$(PGVER)* - chroot $(CHROOT) rc-update add postgresql-$(PGVER) default - chroot $(CHROOT) getent passwd $(TP_USER) || \ - chroot $(CHROOT) useradd -c "Teamplayer Server" -G postgres -U -d $(TP_HOME) $(TP_USER) + yes | $(inroot) $(EMERGE) --config =postgresql-server-$(PGVER)* + $(inroot) rc-update add postgresql-$(PGVER) default +ifeq ($(AVAHI),YES) + $(inroot) $(EMERGE) -n $(USEPKG) net-dns/avahi + $(inroot) rm -f /etc/avahi/services/* + cp teamplayer.service $(CHROOT)/etc/avahi/services + $(inroot) rc-update add avahi-daemon default +endif + $(inroot) getent passwd $(TP_USER) || \ + $(inroot) useradd -c "Teamplayer Server" -G postgres -U -d $(TP_HOME) $(TP_USER) rm -rf $(CHROOT)/$(TP_HOME) hg clone --pull $(HG_REPO) $(CHROOT)/$(TP_HOME) cp bash_profile $(CHROOT)$(TP_HOME)/.bash_profile - chroot $(CHROOT) mkdir -p /etc/teamplayer + $(inroot) mkdir -p /etc/teamplayer $(M4C) settings_local.py > $(CHROOT)/etc/teamplayer/settings_local.py mkdir -p $(CHROOT)$(TP_HOME)/bin $(M4C) start-teamplayer > $(CHROOT)$(TP_HOME)/bin/start-teamplayer chmod +x $(CHROOT)$(TP_HOME)/bin/start-teamplayer $(M4C) stop-teamplayer > $(CHROOT)$(TP_HOME)/bin/stop-teamplayer chmod +x $(CHROOT)$(TP_HOME)/bin/stop-teamplayer - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB) - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/songs - chroot $(CHROOT) rm -rf $(TP_HOME)/web/media/songs - chroot $(CHROOT) ln -s $(TP_DB)/songs $(TP_HOME)/web/media/songs - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/mpd - chroot $(CHROOT) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) /var/log/teamplayer + $(inroot) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB) + $(inroot) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/songs + $(inroot) rm -rf $(TP_HOME)/web/media/songs + $(inroot) ln -s $(TP_DB)/songs $(TP_HOME)/web/media/songs + $(inroot) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) $(TP_DB)/mpd + $(inroot) $(INSTALL) -d -o $(TP_USER) -g $(TP_USER) /var/log/teamplayer $(M4C) local.start > $(CHROOT)/etc/conf.d/local.start $(M4C) local.stop > $(CHROOT)/etc/conf.d/local.stop cp issue $(CHROOT)/etc/issue $(M4C) lighttpd.conf > $(CHROOT)/etc/lighttpd/lighttpd.conf - chroot $(CHROOT) gpasswd -a lighttpd teamplayer - chroot $(CHROOT) rc-update add lighttpd default - chroot $(CHROOT) rc-update add ntpd default + $(inroot) gpasswd -a lighttpd teamplayer + $(inroot) rc-update add lighttpd default + $(inroot) rc-update add ntpd default clean: diff --git a/teamplayer/teamplayer.service b/teamplayer/teamplayer.service new file mode 100644 index 0000000..20027cc --- /dev/null +++ b/teamplayer/teamplayer.service @@ -0,0 +1,7 @@ + + TeamPlayer + + _http._tcp + 80 + +