mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
support a BYOBU_PREFIX environment variable for relocation; default to /usr
This commit is contained in:
parent
f2c871cbb8
commit
e6171401ac
8 changed files with 35 additions and 20 deletions
|
@ -19,6 +19,7 @@
|
|||
|
||||
PKG="byobu"
|
||||
VERSION=2.83
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
|
||||
# Add a version argument for debugging purposes
|
||||
if [ "$#" = "1" ] && [ "$1" = "-v" ]; then
|
||||
|
@ -56,7 +57,7 @@ export BYOBU_WINDOWS
|
|||
grep -qs "^[^#]" "$BYOBU_WINDOWS" && DEFAULT_WINDOW= || DEFAULT_WINDOW="shell"
|
||||
|
||||
# Check if our terminfo supports 256 colors
|
||||
[ -x /usr/bin/tput ] && [ $(/usr/bin/tput colors 2>/dev/null || echo 0) -eq 256 ] && SCREEN_TERM="-T screen-256color"
|
||||
$(which tput >/dev/null) && [ $(tput colors 2>/dev/null || echo 0) -eq 256 ] && SCREEN_TERM="-T screen-256color"
|
||||
|
||||
# Create or update ssh-agent socket
|
||||
if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ] && [ -w "$RUN" ]; then
|
||||
|
@ -64,7 +65,7 @@ if [ -S "$SSH_AUTH_SOCK" ] && [ ! -h "$SSH_AUTH_SOCK" ] && [ -w "$RUN" ]; then
|
|||
ln -sf "$SSH_AUTH_SOCK" "$RUN/$PKG.ssh-agent"
|
||||
fi
|
||||
|
||||
PROFILE="-c /usr/share/$PKG/profiles/byoburc"
|
||||
PROFILE="-c $BYOBU_PREFIX/share/$PKG/profiles/byoburc"
|
||||
NAME="-S $PKG"
|
||||
# Zero out $NAME if user has specified a -S
|
||||
for i in $@; do
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#! /usr/bin/env python
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# byobu-config
|
||||
# Copyright (C) 2008 Canonical Ltd.
|
||||
|
@ -28,11 +28,15 @@ from snack import *
|
|||
|
||||
HOME=os.getenv("HOME")
|
||||
USER=os.getenv("USER")
|
||||
if os.getenv("BYOBU_PREFIX"):
|
||||
PREFIX = os.getenv("BYOBU_PREFIX")
|
||||
else:
|
||||
PREFIX = "/usr"
|
||||
PKG="byobu"
|
||||
SHARE='/usr/share/'+PKG
|
||||
SHARE=PREFIX+'/share/'+PKG
|
||||
if not os.path.exists(SHARE):
|
||||
SHARE = "%s/.%s/%s" % (HOME, PKG, SHARE)
|
||||
DOC='/usr/share/doc/'+PKG
|
||||
DOC=PREFIX+'/share/doc/'+PKG
|
||||
if not os.path.exists(DOC):
|
||||
DOC = "%s/.%s/%s" % (HOME, PKG, DOC)
|
||||
DEF_ESC="A"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen"
|
||||
RUN="$SOCKETDIR/S-$USER"
|
||||
FLAG="$RUN/$PKG.reload-required"
|
||||
|
@ -55,12 +56,12 @@ fi
|
|||
# Seed the configuration
|
||||
[ -d "$HOME/.$PKG" ] || mkdir -p "$HOME/.$PKG"
|
||||
[ -r "$HOME/.$PKG/color" ] || printf "BACKGROUND=k\nFOREGROUND=w\nMONOCHROME=0" > "$HOME/.$PKG/color"
|
||||
[ -r "$PROFILE" ] || ln -sf /usr/share/$PKG/profiles/common "$PROFILE"
|
||||
[ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE"
|
||||
|
||||
# Affects: Symlinks pointing to color profiles
|
||||
if [ -h "$PROFILE" ]; then
|
||||
case "$(stat $PROFILE)" in
|
||||
*File:*-\>*/usr/share/byobu/profiles/*)
|
||||
*File:*-\>*$BYOBU_PREFIX/share/byobu/profiles/*)
|
||||
# Set default colors
|
||||
BG=W
|
||||
FG=k
|
||||
|
@ -92,7 +93,7 @@ if [ -h "$PROFILE" ]; then
|
|||
esac
|
||||
fi
|
||||
|
||||
[ -s "$HOME/.$PKG/keybindings" ] || echo "source /usr/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings"
|
||||
[ -s "$HOME/.$PKG/keybindings" ] || echo "source $BYOBU_PREFIX/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings"
|
||||
[ -r "$HOME/.$PKG/status" ] || $(grep -A 999999 BEGIN_CUT_HERE /etc/$PKG/statusrc | grep -B 999999 END_CUT_HERE | grep -v CUT > "$HOME/.$PKG/status")
|
||||
[ -r "$HOME/.$PKG/windows" ] || touch "$HOME/.$PKG/windows"
|
||||
[ -r "$HOME/.screenrc" ] || touch "$HOME/.screenrc"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
|
||||
if [ ! -e "$HOME/.byobu/disable-autolaunch" ]; then
|
||||
case "$TERM" in
|
||||
*screen*)
|
||||
|
@ -38,14 +40,14 @@ if [ ! -e "$HOME/.byobu/disable-autolaunch" ]; then
|
|||
false
|
||||
;;
|
||||
*)
|
||||
exec /usr/bin/byobu "$@"
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
exec /usr/bin/byobu "$@"
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
fi
|
||||
else
|
||||
exec /usr/bin/byobu "$@"
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
@ -54,7 +56,7 @@ if [ ! -e "$HOME/.byobu/disable-autolaunch" ]; then
|
|||
esac
|
||||
;;
|
||||
*)
|
||||
exec /usr/bin/byobu "$@"
|
||||
exec $BYOBU_PREFIX/bin/byobu "$@"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
# ./debian/rules get-po
|
||||
|
||||
PKG="byobu"
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
[ -r "/etc/$PKG/socketdir" ] && . "/etc/$PKG/socketdir" || SOCKETDIR="/var/run/screen"
|
||||
|
||||
TEXTDOMAIN="$PKG"
|
||||
|
@ -62,7 +63,7 @@ EOT
|
|||
# Initialize variables
|
||||
FILE="$HOME"/."$PKG"/color
|
||||
PROFILE="$HOME/.$PKG/profile"
|
||||
[ -r "$PROFILE" ] || ln -sf /usr/share/$PKG/profiles/common "$PROFILE"
|
||||
[ -r "$PROFILE" ] || ln -sf $BYOBU_PREFIX/share/$PKG/profiles/common "$PROFILE"
|
||||
selected=-1
|
||||
color=
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ import commands, os, re, sys
|
|||
|
||||
PKG = "byobu"
|
||||
SHELL = os.getenv("SHELL", "/bin/bash")
|
||||
if os.getenv("BYOBU_PREFIX"):
|
||||
PREFIX = os.getenv("BYOBU_PREFIX")
|
||||
else:
|
||||
PREFIX = "/usr"
|
||||
choice = ""
|
||||
sessions = []
|
||||
text = []
|
||||
|
@ -68,10 +72,10 @@ if i > 1:
|
|||
if choice:
|
||||
if choice == i-1:
|
||||
# Create a new session
|
||||
os.execv("/usr/bin/byobu", ["", SHELL])
|
||||
os.execv(PREFIX+"/bin/byobu", ["", SHELL])
|
||||
else:
|
||||
# Attach to the chosen session; must use the 'screen' binary
|
||||
os.execv("/usr/bin/screen", ["", "-AOxRR", sessions[choice-1]])
|
||||
os.execv(PREFIX+"/bin/screen", ["", "-AOxRR", sessions[choice-1]])
|
||||
|
||||
# No valid selection, default to the youngest session, create if necessary
|
||||
os.execv("/usr/bin/byobu", ["", "-AOxRR"])
|
||||
os.execv(PREFIX+"/bin/byobu", ["", "-AOxRR"])
|
||||
|
|
|
@ -18,13 +18,14 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
PKG="byobu"
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
|
||||
find_script () {
|
||||
# Allow for local status scripts
|
||||
if [ -x "$HOME/.$PKG/bin/$1" ]; then
|
||||
echo "$HOME/.$PKG/bin/$1"
|
||||
elif [ -x "/usr/lib/$PKG/$1" ]; then
|
||||
echo "/usr/lib/$PKG/$1"
|
||||
elif [ -x "$BYOBU_PREFIX/lib/$PKG/$1" ]; then
|
||||
echo "$BYOBU_PREFIX/lib/$PKG/$1"
|
||||
else
|
||||
echo "/dev/null"
|
||||
fi
|
||||
|
@ -65,7 +66,7 @@ case "$P" in
|
|||
VER=$(set -- $(dpkg-query --show $PKG); echo "$2")
|
||||
fi
|
||||
printf "$PKG-$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
|
||||
for i in "/usr/lib/$PKG"/* "$HOME/.$PKG/bin"/*; do
|
||||
for i in "$BYOBU_PREFIX/lib/$PKG"/* "$HOME/.$PKG/bin"/*; do
|
||||
i=${i##*/}
|
||||
[ "$i" = "menu" ] && continue
|
||||
script=`find_script $i`
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
DETAIL=0
|
||||
PKG="byobu"
|
||||
[ -z "$BYOBU_PREFIX" ] && BYOBU_PREFIX="/usr"
|
||||
color 2>/dev/null || color() { true; }
|
||||
|
||||
for arg in $@; do
|
||||
|
@ -30,7 +31,7 @@ for arg in $@; do
|
|||
done
|
||||
|
||||
# Get the going rates
|
||||
[ -r "$HOME/.$PKG/ec2_rates" ] || ln -s /usr/share/$PKG/ec2/rates.us_ca "$HOME/.$PKG/ec2_rates"
|
||||
[ -r "$HOME/.$PKG/ec2_rates" ] || ln -s $BYOBU_PREFIX/share/$PKG/ec2/rates.us_ca "$HOME/.$PKG/ec2_rates"
|
||||
. "$HOME/.$PKG/ec2_rates" || exit 1
|
||||
|
||||
# Count CPUs, Memory, Architecture
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue