From 80edd25c5eeeef4dee8d86c90d2fe931adb80467 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 14 Jan 2014 20:57:00 +0400 Subject: [PATCH] Remove absolute directory ~/lib to make it portable --- TODO | 3 --- audio/mk_list_recursive.sh | 2 +- audio/mp3/recode-tags-list.sh | 2 +- audio/mp3/recode-tags-recursive.sh | 2 +- audio/mp3/recode-tags.sh | 2 +- audio/ogg/playlist2tags.sh | 2 +- audio/pa-bt | 2 +- audio/pa-bt-BT3030 | 2 +- audio/pa-bt-Backbeat903 | 2 +- audio/pa-speaker | 2 +- audio/pa-toggle-mute | 4 ++-- audio/playlist2name.sh | 2 +- audio/rip | 2 +- audio/toggle-mute | 4 ++-- audio/volume | 10 ++++++---- cdr-dvdrw-tools/.config | 4 +--- cdr-dvdrw-tools/cdr-complete | 2 +- set-path | 4 ++++ video/video | 7 ------- 19 files changed, 27 insertions(+), 33 deletions(-) create mode 100644 set-path delete mode 100644 video/video diff --git a/TODO b/TODO index baceee5..ce8ae29 100644 --- a/TODO +++ b/TODO @@ -1,4 +1 @@ -Remove absolute directory ~/lib to make it portable. - - Add apeinfo, flacinfo, ogginfo like id3info.py. diff --git a/audio/mk_list_recursive.sh b/audio/mk_list_recursive.sh index bee4b99..8d0260c 100755 --- a/audio/mk_list_recursive.sh +++ b/audio/mk_list_recursive.sh @@ -1,6 +1,6 @@ #! /bin/sh -PATH=$HOME/lib/audio:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 [ "$1" ] && cd "$1" || exit 1 # or just do it in current directory diff --git a/audio/mp3/recode-tags-list.sh b/audio/mp3/recode-tags-list.sh index 89ae0f1..e460a2b 100755 --- a/audio/mp3/recode-tags-list.sh +++ b/audio/mp3/recode-tags-list.sh @@ -23,7 +23,7 @@ if [ "`wc -c \"$1\" | awk '{print $1}'`" -ge 10000 ]; then exit 2 fi -PATH=$HOME/lib/audio/mp3:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 recode-tags.sh . $direction || exit 1 diff --git a/audio/mp3/recode-tags-recursive.sh b/audio/mp3/recode-tags-recursive.sh index d534b8b..9e52fb6 100755 --- a/audio/mp3/recode-tags-recursive.sh +++ b/audio/mp3/recode-tags-recursive.sh @@ -17,7 +17,7 @@ else exit 1 fi -PATH=$HOME/lib/audio/mp3:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 if [ "$2" ]; then diff --git a/audio/mp3/recode-tags.sh b/audio/mp3/recode-tags.sh index 28c5d8d..8f31112 100755 --- a/audio/mp3/recode-tags.sh +++ b/audio/mp3/recode-tags.sh @@ -20,7 +20,7 @@ fi cd "$1" || exit 1 -PATH=$HOME/lib/audio/mp3:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 if [ "$direction" = "koi2win" ]; then diff --git a/audio/ogg/playlist2tags.sh b/audio/ogg/playlist2tags.sh index 7c48768..8504cce 100755 --- a/audio/ogg/playlist2tags.sh +++ b/audio/ogg/playlist2tags.sh @@ -5,7 +5,7 @@ if [ "$1" = "" ]; then exit 1 fi -PATH=$HOME/lib/audio/ogg:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 playlist="$1" diff --git a/audio/pa-bt b/audio/pa-bt index 5baf8ab..775eca1 100755 --- a/audio/pa-bt +++ b/audio/pa-bt @@ -1,6 +1,6 @@ #! /bin/sh -"$HOME"/lib/audio/pa-kill +"`dirname \"$0\"`"/pa-kill sleep 1 pulseaudio -L "module-bluetooth-device address="$1" sink_name=btheadset profile=a2dp" -D && diff --git a/audio/pa-bt-BT3030 b/audio/pa-bt-BT3030 index 823ed77..803aed8 100755 --- a/audio/pa-bt-BT3030 +++ b/audio/pa-bt-BT3030 @@ -1,2 +1,2 @@ #! /bin/sh -exec "$HOME"/lib/audio/pa-bt 00:23:78:11:D6:4B +exec "`dirname \"$0\"`"/pa-bt 00:23:78:11:D6:4B diff --git a/audio/pa-bt-Backbeat903 b/audio/pa-bt-Backbeat903 index 2c1915c..866a689 100755 --- a/audio/pa-bt-Backbeat903 +++ b/audio/pa-bt-Backbeat903 @@ -1,2 +1,2 @@ #! /bin/sh -exec "$HOME"/lib/audio/pa-bt 00:1C:EF:7C:81:D6 +exec "`dirname \"$0\"`"/pa-bt 00:1C:EF:7C:81:D6 diff --git a/audio/pa-speaker b/audio/pa-speaker index bc8b7b9..a5466a8 100755 --- a/audio/pa-speaker +++ b/audio/pa-speaker @@ -2,7 +2,7 @@ default_sink=`cat "$HOME"/.pulse/default` -"$HOME"/lib/audio/pa-kill +"`dirname \"$0\"`"/pa-kill sleep 1 pulseaudio -D && echo "\ diff --git a/audio/pa-toggle-mute b/audio/pa-toggle-mute index 743b953..8ae6b83 100755 --- a/audio/pa-toggle-mute +++ b/audio/pa-toggle-mute @@ -6,13 +6,13 @@ test "$MUTE" = "1" RETURN=$? if [[ $RETURN -eq 0 ]] then - "$HOME"/lib/audio/pa-volume unmute + "`dirname \"$0\"`"/pa-volume unmute echo "0" > ~/.pulse/mute exit fi if [[ $RETURN -eq 1 ]] then - "$HOME"/lib/audio/pa-volume mute + "`dirname \"$0\"`"/pa-volume mute echo "1" > ~/.pulse/mute exit fi diff --git a/audio/playlist2name.sh b/audio/playlist2name.sh index 4ef4182..eb4c6f4 100755 --- a/audio/playlist2name.sh +++ b/audio/playlist2name.sh @@ -1,6 +1,6 @@ #! /bin/sh -PATH=$HOME/lib/audio:$PATH +. "`dirname \"$0\"`"/../set-path umask 022 if [ "$1" ]; then diff --git a/audio/rip b/audio/rip index a0dc974..23f48c7 100755 --- a/audio/rip +++ b/audio/rip @@ -10,4 +10,4 @@ fi mkdir cdrip && cd cdrip || exit 1 cdparanoia -d "$device" -B && -exec $HOME/lib/audio/mjack "$device" "$@" +exec "`dirname \"$0\"`"/mjack "$device" "$@" diff --git a/audio/toggle-mute b/audio/toggle-mute index 6206772..2818a28 100755 --- a/audio/toggle-mute +++ b/audio/toggle-mute @@ -1,7 +1,7 @@ #! /bin/sh if pulseaudio --check; then - exec "$HOME"/lib/audio/pa-toggle-mute + exec "`dirname \"$0\"`"/pa-toggle-mute else - exec "$HOME"/lib/audio/amixer-toggle-mute + exec "`dirname \"$0\"`"/amixer-toggle-mute fi diff --git a/audio/volume b/audio/volume index 1a2fa50..d1af7aa 100755 --- a/audio/volume +++ b/audio/volume @@ -1,5 +1,7 @@ #! /bin/sh +. "`dirname \"$0\"`"/../set-path + if pulseaudio --check; then if [ "$1" = increase ]; then vol=increase @@ -7,15 +9,15 @@ if pulseaudio --check; then vol=decrease elif [ "$1" = INCREASE ]; then vol=increase - "$HOME"/lib/audio/pa-volume "$vol" + pa-volume "$vol" elif [ "$1" = DECREASE ]; then vol=decrease - "$HOME"/lib/audio/pa-volume "$vol" + pa-volume "$vol" else echo "Usage: $0 [increase|decrease|INCREASE|DECREASE]" >&2 exit 1 fi - exec "$HOME"/lib/audio/pa-volume "$vol" + exec pa-volume "$vol" else - exec "$HOME"/lib/audio/amixer-volume "$@" + exec amixer-volume "$@" fi diff --git a/cdr-dvdrw-tools/.config b/cdr-dvdrw-tools/.config index 58764bb..656abac 100644 --- a/cdr-dvdrw-tools/.config +++ b/cdr-dvdrw-tools/.config @@ -1,6 +1,4 @@ -if echo "$PATH" | grep -vq "phd/lib/cdr-dvdrw-tools"; then - PATH="$HOME/lib/cdr-dvdrw-tools:$PATH" -fi +. "`dirname \"$0\"`"/../set-path cd_image_iso="$HOME/tmp/cd-image.iso" source_dir="$HOME/tmp/cdrw" diff --git a/cdr-dvdrw-tools/cdr-complete b/cdr-dvdrw-tools/cdr-complete index e09a23f..2dec1a5 100755 --- a/cdr-dvdrw-tools/cdr-complete +++ b/cdr-dvdrw-tools/cdr-complete @@ -50,7 +50,7 @@ if [ "$source" ]; then fi if [ $setattrs = YES ]; then - "$HOME"/lib/audio/setattrs.sh "$source_dir" + setattrs.sh "$source_dir" fi if [ -z "$label" ]; then diff --git a/set-path b/set-path new file mode 100644 index 0000000..04dc7c5 --- /dev/null +++ b/set-path @@ -0,0 +1,4 @@ +CWD="`pwd`" +if echo "$PATH" | grep -vq "\(^\|:\)$CWD\(:\|$\)"; then + PATH="$CWD:$PATH" +fi diff --git a/video/video b/video/video deleted file mode 100644 index 09f5101..0000000 --- a/video/video +++ /dev/null @@ -1,7 +0,0 @@ -if echo "$PATH" | grep -vq "video"; then - PATH=$HOME/lib/video:$PATH - -else - - echo "video config has already been installed" -fi -- 2.39.5