chiark / gitweb /
preload-hacks: Some patches to make it work.
[termux-packages] / packages / mpd / mpd-script.sh
1 mpd_test=$(pgrep -f /data/data/com.termux/files/usr/libexec/mpd)
2 CmdArgs=$(echo "$@")
3 #echo $mpd_test
4 mkdir -p ~/.mpd
5 mkdir -p ~/.mpd/playlists
6 touch ~/.mpd/state
7 touch ~/.mpd/log
8 touch ~/.mpd/pid
9 if [ "x$CmdArgs" = x ] ; then
10         if [ -z "$MULTIPLE_MPDS"  ] ; then
11                 if [ -n "$mpd_test" ] ;  then
12                 echo -n "restart music player daemon (y/n)? "
13                 read answer
14                         if echo "$answer" | grep -iq "^y" ;then
15                         echo "restarting music player daemon"
16                         pgrep -f  /data/data/com.termux/files/usr/libexec/mpd  | while read line; do kill  "$line"; done
17                         else 
18                         echo "doing nothing"
19                         exit
20                         fi
21                 else
22                 echo "starting mpd the music player daemon"
23                 fi
24                 sleep 0.5;
25                 chmod +rw ~/.mpd/*  2>&1 > /dev/null
26                 rm -rf ~/.mpd/pid   2>&1 > /dev/null
27         fi
28 fi