From be50c29d9e371c0595c5fb838a2903c36fced66e Mon Sep 17 00:00:00 2001 From: Live session user Date: Wed, 28 Jul 2010 13:19:18 +0000 Subject: [PATCH] massive changeset to use BYOBU_PREFIX and allow for relocation (or installation as non-root) --- usr/bin/byobu | 9 ++++++++- usr/bin/byobu-janitor | 2 +- usr/bin/byobu-launcher | 3 ++- usr/bin/byobu-select-profile | 3 ++- usr/bin/byobu-status | 3 ++- usr/share/byobu/keybindings/f-keys | 2 +- usr/share/byobu/keybindings/screen-escape-keys | 2 +- usr/share/byobu/tests/byobu-time-notifications | 2 ++ 8 files changed, 19 insertions(+), 7 deletions(-) diff --git a/usr/bin/byobu b/usr/bin/byobu index 362c10e6..14dfd648 100755 --- a/usr/bin/byobu +++ b/usr/bin/byobu @@ -19,7 +19,14 @@ PKG="byobu" VERSION=2.83 -[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +[ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" +export BYOBU_PREFIX + +if [ ! -x "$BYOBU_PREFIX/bin/$PKG" ]; then + echo "ERROR: Cannot find $BYOBU_PREFIX/bin/$PKG" 2>&1 + echo "ERROR: If you have installed it elsewhere, export BYOBU_PREFIX in your shell" 2>&1 + exit 1 +fi # Add a version argument for debugging purposes if [ "$#" = "1" ] && [ "$1" = "-v" ]; then diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 447d108d..3423a8ef 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -20,7 +20,7 @@ # along with this program. If not, see . PKG="byobu" -[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +[ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen" RUN="$SOCKETDIR/S-$USER" FLAG="$RUN/$PKG.reload-required" diff --git a/usr/bin/byobu-launcher b/usr/bin/byobu-launcher index 130f2054..ce15f490 100755 --- a/usr/bin/byobu-launcher +++ b/usr/bin/byobu-launcher @@ -17,7 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +[ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" +export BYOBU_PREFIX if [ ! -e "$HOME/.byobu/disable-autolaunch" ]; then case "$TERM" in diff --git a/usr/bin/byobu-select-profile b/usr/bin/byobu-select-profile index 2966075f..9327d01b 100755 --- a/usr/bin/byobu-select-profile +++ b/usr/bin/byobu-select-profile @@ -23,7 +23,8 @@ # ./debian/rules get-po PKG="byobu" -[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +[ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" +export BYOBU_PREFIX [ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen" TEXTDOMAIN="$PKG" diff --git a/usr/bin/byobu-status b/usr/bin/byobu-status index 36b7c0fc..3fe4b835 100755 --- a/usr/bin/byobu-status +++ b/usr/bin/byobu-status @@ -18,7 +18,8 @@ # along with this program. If not, see . PKG="byobu" -[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +[ -z "$BYOBU_PREFIX" ] && export BYOBU_PREFIX="/usr" +export BYOBU_PREFIX find_script () { # Allow for local status scripts diff --git a/usr/share/byobu/keybindings/f-keys b/usr/share/byobu/keybindings/f-keys index 4aac9f00..d3f75f49 100644 --- a/usr/share/byobu/keybindings/f-keys +++ b/usr/share/byobu/keybindings/f-keys @@ -41,5 +41,5 @@ register s "^a[g G$>^h" # Goes with ^a~ definition bind ~ eval 'process s' 'exec sed -i "/./,/^$/!d" /var/run/screen/S-$USER/byobu-exchange' 'echo "See: /var/run/screen/S-$USER/byobu-exchange"' # ctrl-a ~ | write the buffer to file # toggle f-key keybindings off -register d "^a:source /usr/share/byobu/keybindings/screen-escape-keys^M" +register d "^a:source $BYOBU_PREFIX/share/byobu/keybindings/screen-escape-keys^M" bind ! eval 'process d' 'backtick 111 9999999 9999999 byobu-status menu --disable-f-keys' diff --git a/usr/share/byobu/keybindings/screen-escape-keys b/usr/share/byobu/keybindings/screen-escape-keys index 076b5ae9..75103c3b 100644 --- a/usr/share/byobu/keybindings/screen-escape-keys +++ b/usr/share/byobu/keybindings/screen-escape-keys @@ -48,5 +48,5 @@ bind @ screen -t config 0 byobu-config # ctrl-a-$ Show detailed status bind $ screen -t status 0 byobu-status-detail # ctrl-a-! Toggle f-key keybindings on -register e "^a:source /usr/share/byobu/keybindings/f-keys^M" +register e "^a:source $BYOBU_PREFIX/share/byobu/keybindings/f-keys^M" bind ! eval 'process e' 'backtick 111 9999999 9999999 byobu-status menu' diff --git a/usr/share/byobu/tests/byobu-time-notifications b/usr/share/byobu/tests/byobu-time-notifications index a7d0c462..f1edf0f3 100755 --- a/usr/share/byobu/tests/byobu-time-notifications +++ b/usr/share/byobu/tests/byobu-time-notifications @@ -21,6 +21,8 @@ PKG=byobu RUNS=100 +[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr" +export BYOBU_PREFIX loop() { for j in $(seq 1 $RUNS); do