From ca8a4eca9e811d57c62007a05e413f999363965b Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Wed, 10 Jun 2009 20:47:03 -0500 Subject: [PATCH] * bin/updates-available, byobu, byobu-export, byobu-status, screen-launcher-install: remove hardcoded /usr/bin paths; some users install without root privileges and want to run from a location other than /usr/bin, LP: #385762 Signed-off-by: Dustin Kirkland --- bin/updates-available | 16 ++++++++-------- byobu | 10 +++++----- byobu-export | 2 +- byobu-status | 4 ++-- debian/changelog | 6 +++++- screen-launcher-install | 2 +- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/bin/updates-available b/bin/updates-available index 9462be37..4226b113 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -18,8 +18,8 @@ # along with this program. If not, see . if [ "$1" = "--detail" -o "$1" = "--short" ]; then - if [ -x "/usr/bin/apt-get" ]; then - detail=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade` + if which apt-get >/dev/null; then + detail=`apt-get -s -o Debug::NoLocking=true upgrade` if [ "$1" = "--detail" ]; then printf "$detail" else @@ -97,16 +97,16 @@ ionice -c3 -p $$ >/dev/null 2>&1 || true if [ -x /usr/lib/update-notifier/apt-check ]; then # If apt-check binary exists, use it /usr/lib/update-notifier/apt-check 2>&1 | tail -n 1 | sed "s/;/ /" > $mycache & -elif [ -x /usr/bin/apt-get ]; then +elif which apt-get 2>/dev/null; then # If apt-get exists, use it - /usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst > $mycache & -elif [ -x /usr/bin/zypper ]; then + apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst > $mycache & +elif which zypper; then # If zypper exists, use it - /usr/bin/zypper --no-refresh lu --best-effort | grep 'v |' | wc -l > $mycache & -elif [ -x /usr/bin/yum ]; then + zypper --no-refresh lu --best-effort | grep 'v |' | wc -l > $mycache & +elif which yum; then # If yum exists, use it # TODO: We need a better way of counting updates available from a RH expert - /usr/bin/yum list updates | egrep -v "Updated Packages|Loaded plugins" | wc -l > $mycache & + yum list updates | egrep -v "Updated Packages|Loaded plugins" | wc -l > $mycache & else # If we're here, we have no idea print_updates "?" diff --git a/byobu b/byobu index ae57529a..3c0cc945 100755 --- a/byobu +++ b/byobu @@ -19,7 +19,7 @@ OLDPKG="screen-profiles" PKG="byobu" -SCREEN_REAL="/usr/bin/screen" +SCREEN_REAL="screen" # Upgrade old config dir to the new name [ -d "$HOME/.$OLDPKG" -a ! -e "$HOME/.$PKG" ] && mv -f "$HOME/.$OLDPKG" "$HOME/.$PKG" @@ -49,7 +49,7 @@ DEFAULT_PROFILE="light" # Ensure that the user has selected a screen profile profile="$HOME/.$PKG/profile" -[ -h "$profile" ] || /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" +[ -h "$profile" ] || select-screen-profile -s "$DEFAULT_PROFILE" # Previously, profiles were prepended with ubuntu-. # This is no longer the case, for cross-distro compatibility. @@ -60,12 +60,12 @@ if [ -h "$profile" -a ! -r "$profile" ]; then if [ -r "$newsrc" ]; then ln -sf "$newsrc" "$profile" else - /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" + select-screen-profile -s "$DEFAULT_PROFILE" fi elif stat "$profile" | head -n1 | grep -qs ".*->.*plain'$"; then ln -sf "/usr/share/$PKG/profiles/NONE" "$profile" else - /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" + select-screen-profile -s "$DEFAULT_PROFILE" fi fi @@ -93,7 +93,7 @@ if grep -qs "^[^#]" "$HOME/.$PKG/windows"; then DEFAULT_WINDOW= else # User has no default windows, so launch motd+shell - DEFAULT_WINDOW="$SHELL /usr/bin/motd+shell" + DEFAULT_WINDOW="$SHELL motd+shell" fi # Ensure that the user's $SCREENRC at least exists diff --git a/byobu-export b/byobu-export index 1a4547b6..edab2a46 100755 --- a/byobu-export +++ b/byobu-export @@ -220,7 +220,7 @@ PROFILE="$DIR/.screenrc" STATUS="$DIR/.$PKG/status" mkdir -p "$DIR/.$PKG/bin" touch "$DIR/.$PKG/profile" -[ -x /usr/bin/dpkg-query ] && /usr/bin/dpkg-query --show --showformat '${Package} ${Version}\n' $PKG > "$DIR/.$PKG/version" +dpkg-query --show --showformat '${Package} ${Version}\n' $PKG > "$DIR/.$PKG/version" 2>/dev/null || true echo "http://launchpad.net/$PKG" >> "$DIR/.$PKG/version" # Copy status scripts diff --git a/byobu-status b/byobu-status index b3c835de..8177e642 100755 --- a/byobu-status +++ b/byobu-status @@ -68,8 +68,8 @@ case "$P" in ;; --detail) VER= - if [ -x "/usr/bin/dpkg-query" ]; then - VER=`/usr/bin/dpkg-query --show $PKG | awk '{print "-" $2 }'` + if which dpkg-query >/dev/null; then + VER=`dpkg-query --show $PKG | awk '{print "-" $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 `ls "$DIR"`; do diff --git a/debian/changelog b/debian/changelog index 54d9435f..1479bb10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,12 @@ byobu (2.10) unreleased; urgency=low * byobu: don't create an extra shell, if the user has some default windows specified + * bin/updates-available, byobu, byobu-export, byobu-status, + screen-launcher-install: remove hardcoded /usr/bin paths; some users + install without root privileges and want to run from a location other + than /usr/bin, LP: #385762 - -- Dustin Kirkland Wed, 10 Jun 2009 14:18:23 -0500 + -- Dustin Kirkland Wed, 10 Jun 2009 20:46:16 -0500 byobu (2.9-0ubuntu1) karmic; urgency=low diff --git a/screen-launcher-install b/screen-launcher-install index e6cbfcb7..e3b31645 100755 --- a/screen-launcher-install +++ b/screen-launcher-install @@ -22,7 +22,7 @@ PKG="byobu" install_screen_launcher() { dest=$1 - launcher="/usr/bin/screen-launcher" + launcher="screen-launcher" launcher_line="\`echo \$- | grep -qs i\` && [ -x $launcher ] && $launcher" # Add it at the end echo "$launcher_line" >> "$dest"