From 4eb1e3aea47c1a18ac1ac26412e965d5958979dc Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Wed, 17 Dec 2014 14:41:36 -0500 Subject: [PATCH] upmpdcli: Add UPnP icon. Use procd for start/stop. Add uci config support for multiple instances Signed-off-by: Ted Hess --- multimedia/upmpdcli/Makefile | 11 ++-- multimedia/upmpdcli/files/upmpdcli.config | 15 ++++++ multimedia/upmpdcli/files/upmpdcli.init | 49 +++++++++++++++--- multimedia/upmpdcli/files/upmpdcli.png | Bin 0 -> 1640 bytes .../patches/010-Add_icon_config.patch | 9 ++++ 5 files changed, 72 insertions(+), 12 deletions(-) create mode 100644 multimedia/upmpdcli/files/upmpdcli.config create mode 100644 multimedia/upmpdcli/files/upmpdcli.png create mode 100644 multimedia/upmpdcli/patches/010-Add_icon_config.patch diff --git a/multimedia/upmpdcli/Makefile b/multimedia/upmpdcli/Makefile index 62448d12a0..d921feecc8 100644 --- a/multimedia/upmpdcli/Makefile +++ b/multimedia/upmpdcli/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=upmpdcli PKG_VERSION:=0.9.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz @@ -39,10 +39,13 @@ endef define Package/upmpdcli/install $(INSTALL_DIR) $(1)/etc $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/upmpdcli.conf $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/upmpdcli.config $(1)/etc/config/upmpdcli $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/upmpdcli $(1)/usr/bin/ - $(INSTALL_DIR) $(1)/usr/share - $(CP) $(PKG_INSTALL_DIR)/usr/share/upmpdcli $(1)/usr/share/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upmpdcli $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/share/upmpdcli + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/upmpdcli/* $(1)/usr/share/upmpdcli/ + $(INSTALL_DATA) ./files/upmpdcli.png $(1)/usr/share/upmpdcli/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/upmpdcli.init $(1)/etc/init.d/upmpdcli endef diff --git a/multimedia/upmpdcli/files/upmpdcli.config b/multimedia/upmpdcli/files/upmpdcli.config new file mode 100644 index 0000000000..56b0ba3ea4 --- /dev/null +++ b/multimedia/upmpdcli/files/upmpdcli.config @@ -0,0 +1,15 @@ +config upmpdcli lan + option interface 'br-lan' +# option friendly_name 'upmpdcli' +# option mpd_host '127.0.0.1' +# option mpd_port '6600' +# option upmpd_port '0' +# option config '/etc/upmpdcli.conf' + +# Add additional interfaces +# +#config upmpdcli wifi +# option interface 'wlan0' + +#config upmpdcli wan +# option interface 'eth0' diff --git a/multimedia/upmpdcli/files/upmpdcli.init b/multimedia/upmpdcli/files/upmpdcli.init index b91e6f9256..6c69209c24 100644 --- a/multimedia/upmpdcli/files/upmpdcli.init +++ b/multimedia/upmpdcli/files/upmpdcli.init @@ -1,18 +1,51 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2014 OpenWrt.org +NAME=upmpdcli START=95 -create_user() { - group_exists upmpdcli || group_add upmpdcli 89 - user_exists upmpdcli || user_add upmpdcli 89 +UPMPD_BIN=/usr/bin/${NAME} + +USE_PROCD=1 + +append_arg() { + local cfg="$1" + local var="$2" + local opt="$3" + local def="$4" + local val + + config_get val "$cfg" "$var" + [ -n "$val" -o -n "$def" ] && procd_append_param command $opt "${val:-$def}" +} + +start_instance() { + local cfg="$1" + local interface + + procd_open_instance + + procd_set_param command "${UPMPD_BIN}" + +# config_get interface "$cfg" interface +# procd_add_reload_interface_trigger $interface + + append_arg "$cfg" interface "-i" + append_arg "$cfg" mpd_host "-h" + append_arg "$cfg" mpd_port "-p" + append_arg "$cfg" upmpd_port "-P" + + append_arg "$cfg" config "-c" + append_arg "$cfg" friendly_name "-f" + + procd_close_instance } -start() { - create_user - service_start /usr/bin/upmpdcli -D +service_triggers() { + procd_add_reload_trigger "${NAME}" } -stop() { - service_stop /usr/bin/upmpdcli +start_service() { + config_load ${NAME} + config_foreach start_instance ${NAME} } diff --git a/multimedia/upmpdcli/files/upmpdcli.png b/multimedia/upmpdcli/files/upmpdcli.png new file mode 100644 index 0000000000000000000000000000000000000000..ba50c644635a16c0e6de170ca53052f7928cd3d4 GIT binary patch literal 1640 zcmV-u2ABDXP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iyk& z6%#vq2&+N>00rntL_t(|+U=XkZyZGw#(zCC-s0G?J@(kfVO7|{k%+}2-~dR#0XVV+ zi5o&ff(w5H+&BjbiCZMZasUAWu}I+%ViLp}Ls*g+5**tzwqrZvS(?LqEtiUJPft&e z2aV@RE!)+tuBxxT_uf~p+K%hG>|{%@!>tWK8-O+dZ2;N;>|{%Yd1z{CDz5(a16Keg z{p|oh0e>`Na?{h(@c4q_y))VUBJFp z1K=9qQG@p8>i-B_6f0&lj&T9e5&(1nk1N0xt$PmegYoyQ+V%j0b@b`z`dAaH{M zoE;N#z?{)`4k&2y0}=b{2c86;Zio=7(Ix~yDWJc9ba{3WSXLH@0>CKnJa8Sb2z;oY zO<{loJRv$41NzHaL2(&aQCb{|(C3PN7Jy!0s+lfuFL0|5^*t*A7p%5*T|@+64LB|U zQ^57j0$>by%#gW$>?i`~t@cX>0DTerKCX8ZwbvML1^|x$!vWMc88C0P6}5`Ub)t;v zoUxb40GBli07o=4FM!*CJ1w;r1i(T-JHW1xV@k;1Ju6FFc;nfpj1y}X7*K9cTM@o& zAnsNHucV-7+p?H2q=6T!ME!^L>>I$6+JDyqB!H{rPPsS%xEr`HAixy^(w+@KF5tOU z0a@*kq7QgkAb4u?gnpmbH45yNJLTeXff3*y4K(j_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