From 414fce9d9e944760139bca142dfda272e7642233 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Aug 2011 00:04:03 +0200 Subject: streams/ fixed starter script for streams all stream starter scripts are now symlinks. streams now is able to list all implemented streams --- streams/deepmix | 27 +-------------------------- streams/groove | 17 +---------------- streams/radiotux | 30 +----------------------------- streams/stream-starter | 18 ++++++++++++++++++ streams/streams | 2 +- 5 files changed, 22 insertions(+), 72 deletions(-) mode change 100755 => 120000 streams/deepmix mode change 100755 => 120000 streams/groove mode change 100755 => 120000 streams/radiotux create mode 100755 streams/stream-starter (limited to 'streams') diff --git a/streams/deepmix b/streams/deepmix deleted file mode 100755 index b8f8fba8..00000000 --- a/streams/deepmix +++ /dev/null @@ -1,26 +0,0 @@ -#! /bin/bash -set -euf -CMD="mplayer http://deepmix.ru/deepmix128.pls" -function start() { - stop - tmux start-server - tmux new-session -d "$CMD" -} -function stop() { - pkill mplayer || : -} -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "aidsballs" - ;; -esac diff --git a/streams/deepmix b/streams/deepmix new file mode 120000 index 00000000..b0148d72 --- /dev/null +++ b/streams/deepmix @@ -0,0 +1 @@ +stream-starter \ No newline at end of file diff --git a/streams/groove b/streams/groove deleted file mode 100755 index 8c2faddd..00000000 --- a/streams/groove +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash -set -euf -STR=$PWD/streams -case "$1" in - start) - $STR start groove - stop) - $STR stop - ;; - restart) - $STR restart groove - ;; - *) - echo "aidsballs" - ;; -esac diff --git a/streams/groove b/streams/groove new file mode 120000 index 00000000..b0148d72 --- /dev/null +++ b/streams/groove @@ -0,0 +1 @@ +stream-starter \ No newline at end of file diff --git a/streams/radiotux b/streams/radiotux deleted file mode 100755 index 9d671493..00000000 --- a/streams/radiotux +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/bash -set -euf -function stop() -{ - pkill mplayer || true -} - -CMD="while true; do exec mplayer http://streams.xenim.de/radiotux.ogg; sleep 1;done" -case "$1" in - start) - stop - if tmux list-sessions; - then - tmux new-window "$CMD" & - else - tmux new-session "$CMD" & - fi - ;; - stop) - stop - ;; - restart) - stop - start - ;; - *) - echo "aidsballs" - ;; -esac diff --git a/streams/radiotux b/streams/radiotux new file mode 120000 index 00000000..b0148d72 --- /dev/null +++ b/streams/radiotux @@ -0,0 +1 @@ +stream-starter \ No newline at end of file diff --git a/streams/stream-starter b/streams/stream-starter new file mode 100755 index 00000000..8f6c6a9d --- /dev/null +++ b/streams/stream-starter @@ -0,0 +1,18 @@ +#! /bin/bash +set -euf +STR=$PWD/streams +NAME=`basename $0` +case "$1" in + start) + $STR start $NAME + ;; + stop) + $STR stop + ;; + restart) + $STR restart $NAME + ;; + *) + echo "aidsballs" + ;; +esac diff --git a/streams/streams b/streams/streams index f3cbc300..01097aea 100755 --- a/streams/streams +++ b/streams/streams @@ -19,7 +19,7 @@ function start() { exit 1 fi done; then - echo "!! Stream not found!" + echo "!! Stream '$REQ' not found!" exit 1 fi } -- cgit v1.2.3 From ab14e45883fd46a5f083ac95ae2293d16e90001e Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Aug 2011 00:36:12 +0200 Subject: streams/* updated Makefile/stream now in file Makefile: now creates symlinks to the krebs folder stream.db: streams are stored in a file --- streams/Makefile | 9 ++++++--- streams/stream-starter | 3 ++- streams/stream.db | 3 +++ streams/streams | 5 ++--- 4 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 streams/stream.db (limited to 'streams') diff --git a/streams/Makefile b/streams/Makefile index 9f3076c0..dcf1ca45 100644 --- a/streams/Makefile +++ b/streams/Makefile @@ -1,10 +1,13 @@ -INITD = /etc/init.d/ +#INITD = /etc/init.d/ +INITD = /etc/rc.d/ streams = groove deepmix radiotux +CURRDIR = ${PWD} .PHONY: all .PHONY: $(streams) all: $(streams) - update-rc.d groove defaults + @update-rc.d groove defaults 2>/dev/null || echo "** put groove daemon in DAEMONS in /etc/rc.conf" + $(streams): - cp $@ $(INITD)$@ + ln -n -s -f $$PWD/stream-starter $(INITD)$@ diff --git a/streams/stream-starter b/streams/stream-starter index 8f6c6a9d..cfcf91d4 100755 --- a/streams/stream-starter +++ b/streams/stream-starter @@ -1,6 +1,7 @@ #! /bin/bash set -euf -STR=$PWD/streams +HERE=`readlink -f $(dirname $0)` +STR=$HERE/streams NAME=`basename $0` case "$1" in start) diff --git a/streams/stream.db b/streams/stream.db new file mode 100644 index 00000000..168cc68d --- /dev/null +++ b/streams/stream.db @@ -0,0 +1,3 @@ +http://somafm.com/groovesalad.pls groove +http://deepmix.ru/deepmix128.pls deepmix +http://streams.xenim.de/radiotux.ogg radiotux diff --git a/streams/streams b/streams/streams index 01097aea..a2b5bee4 100755 --- a/streams/streams +++ b/streams/streams @@ -1,7 +1,6 @@ #! /bin/sh -URLS="http://somafm.com/groovesalad.pls groove -http://deepmix.ru/deepmix128.pls deepmix -http://streams.xenim.de/radiotux.ogg radiotux" +HERE=`readlink -f $(dirname $0)` +URLS=`cat $HERE/stream.db` function start() { # start the given stream von $1 -- cgit v1.2.3 From d67a6ef70f8d255fa7afa018286cdbd38ab56f83 Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Aug 2011 01:11:10 +0200 Subject: streams/Makefile patched to be less stupid Makefile now has logic to find scripts to be installled and will not overwrite evevery script in your initd. --- streams/Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'streams') diff --git a/streams/Makefile b/streams/Makefile index dcf1ca45..0922e38f 100644 --- a/streams/Makefile +++ b/streams/Makefile @@ -1,13 +1,11 @@ -#INITD = /etc/init.d/ -INITD = /etc/rc.d/ -streams = groove deepmix radiotux +INITD = $(shell test -e /etc/rc.d/ && echo /etc/rc.d/ || echo /etc/init.d/) +streams = $(shell cut -d\ -f2 stream.db) CURRDIR = ${PWD} -.PHONY: all -.PHONY: $(streams) +.PHONY: all $(streams) all: $(streams) @update-rc.d groove defaults 2>/dev/null || echo "** put groove daemon in DAEMONS in /etc/rc.conf" - $(streams): - ln -n -s -f $$PWD/stream-starter $(INITD)$@ + @test -L $(INITD)$@ || test ! -e $(INITD)$@ && \ + ln -n -s -f $$PWD/stream-starter $(INITD)$@ && echo "writing $@ to $(INITD)" -- cgit v1.2.3 From e3e8a7e7d7d3210996187d88456d4d4b02116038 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Aug 2011 01:05:51 +0200 Subject: streams/ fixed readlink fuckup in scripts --- streams/deepmix | 1 - streams/groove | 1 - streams/radiotux | 1 - streams/stream-starter | 2 +- streams/streams | 4 ++-- 5 files changed, 3 insertions(+), 6 deletions(-) delete mode 120000 streams/deepmix delete mode 120000 streams/groove delete mode 120000 streams/radiotux (limited to 'streams') diff --git a/streams/deepmix b/streams/deepmix deleted file mode 120000 index b0148d72..00000000 --- a/streams/deepmix +++ /dev/null @@ -1 +0,0 @@ -stream-starter \ No newline at end of file diff --git a/streams/groove b/streams/groove deleted file mode 120000 index b0148d72..00000000 --- a/streams/groove +++ /dev/null @@ -1 +0,0 @@ -stream-starter \ No newline at end of file diff --git a/streams/radiotux b/streams/radiotux deleted file mode 120000 index b0148d72..00000000 --- a/streams/radiotux +++ /dev/null @@ -1 +0,0 @@ -stream-starter \ No newline at end of file diff --git a/streams/stream-starter b/streams/stream-starter index cfcf91d4..4d3a406f 100755 --- a/streams/stream-starter +++ b/streams/stream-starter @@ -1,6 +1,6 @@ #! /bin/bash set -euf -HERE=`readlink -f $(dirname $0)` +HERE=$(dirname $(readlink -f $0)) STR=$HERE/streams NAME=`basename $0` case "$1" in diff --git a/streams/streams b/streams/streams index a2b5bee4..a8408b4a 100755 --- a/streams/streams +++ b/streams/streams @@ -1,5 +1,5 @@ -#! /bin/sh -HERE=`readlink -f $(dirname $0)` +#! /bin/bash +HERE=$(dirname $(readlink -f $0)) URLS=`cat $HERE/stream.db` function start() { -- cgit v1.2.3