diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/config-switcher.sh | 10 | ||||
-rw-r--r-- | scripts/convert-help-to-standard.pd | 2 | ||||
-rwxr-xr-x | scripts/pd | 88 | ||||
-rwxr-xr-x | scripts/pd-diff | 48 |
4 files changed, 148 insertions, 0 deletions
diff --git a/scripts/config-switcher.sh b/scripts/config-switcher.sh new file mode 100755 index 00000000..04e77f52 --- /dev/null +++ b/scripts/config-switcher.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# location of plist that Pd reads +PLIST_ROOT=~/Library/Preferences/org.puredata.pd +PLIST=$PLIST_ROOT.plist + +# which config to use (first argument) +CONFIG=$1 + +cp -f "$PLIST_ROOT.$CONFIG.plist" "$PLIST" diff --git a/scripts/convert-help-to-standard.pd b/scripts/convert-help-to-standard.pd new file mode 100644 index 00000000..13f47935 --- /dev/null +++ b/scripts/convert-help-to-standard.pd @@ -0,0 +1,2 @@ +#!/bin/sh + diff --git a/scripts/pd b/scripts/pd new file mode 100755 index 00000000..14a5a25a --- /dev/null +++ b/scripts/pd @@ -0,0 +1,88 @@ +#!/bin/bash -e +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/pd +NAME=pd +DESC="Pure Data" + +test -x $DAEMON || exit 0 + + +function start() { + /bin/su - arw -c "/usr/bin/pd -nogui" > /tmp/pd-`date +20%y-%m-%d_%H.%M.%S`.log 2>&1 & +} + +function stop() { + echo "quit;quit;quit;" | /usr/bin/pdsend 5555 + sleep 5 + /usr/bin/killall -KILL pd || echo "Warning: $DESC was not running" +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + start + #start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ + # --exec $DAEMON + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME " + stop + #start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + # --exec $DAEMON + echo "." + ;; + #reload) + # + # If the daemon can reload its config files on the fly + # for example by sending it SIGHUP, do it here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this a do-nothing entry. + # + # echo -n "Reloading $DESC configuration..." + # start-stop-daemon --stop --signal 1 --quiet --pidfile \ + # /var/run/$NAME.pid --exec $DAEMON + # echo "done." + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: $NAME" + stop + #start-stop-daemon --stop --quiet --pidfile \ + # /var/run/$NAME.pid --exec $DAEMON + sleep 5 + start + #start-stop-daemon --start --quiet --pidfile \ + # /var/run/$NAME.pid --exec $DAEMON + echo "." + ;; + *) + N=/etc/init.d/$NAME + # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/scripts/pd-diff b/scripts/pd-diff new file mode 100755 index 00000000..4c8837e0 --- /dev/null +++ b/scripts/pd-diff @@ -0,0 +1,48 @@ +#!/bin/sh + +DATE=`date '+%Y-%m-%d_%H.%M.%S'` +TMPDIR=/tmp/pd-diff + +#------------------------------------------------------------------------------ +# FUNCTIONS +generate_tmp_filename () { + echo $TMPDIR/`echo $1 | sed -e 's|/|_|g'`-$DATE +} + +prep_for_diff () { + TMPFILE=`generate_tmp_filename "$1"` + cat "$1" | \ + tail +2 | \ + grep -v '#X connect ' | \ + sed 's/\(#[XN] [a-z]+\) [0-9]+ [0-9]+/\1/' \ + > $TMPFILE +} + +#------------------------------------------------------------------------------ +# THE PROGRAM + +if [ $# -ne 2 ]; then + echo "ERROR: Invalid number of arguments ($#)" + echo "Usage: $0 FILE FILE" +else + if [ ! -d $TMPDIR ]; then + mkdir $TMPDIR + fi + + + TMP1=`generate_tmp_filename "$1"` + TMP2=`generate_tmp_filename "$2"` + + prep_for_diff "$1" + prep_for_diff "$2" + +# diff of everything except "#X connect"'s + diff -uw "$TMP1" "$TMP2" + + file1count=`grep -v '#X connect ' "$1" | wc -l` + file2count=`grep -v '#X connect ' "$2" | wc -l` + if [ $file1count -ne $file2count ]; then + echo "---------------------------------------------------------" + echo Connections differ: $file1count vs. $file2count + fi +fi |