* usr/bin/byobu-janitor:

- performance improvements, save a few forks
This commit is contained in:
Dustin Kirkland 2011-05-13 17:31:46 +02:00
commit dc2ee03a36
2 changed files with 8 additions and 6 deletions

2
debian/changelog vendored
View file

@ -30,6 +30,8 @@ byobu (4.1) unreleased; urgency=low
- performance improvements, save a few forks - performance improvements, save a few forks
* usr/bin/byobu-reconnect-sockets: * usr/bin/byobu-reconnect-sockets:
- performance improvements, save a few forks - performance improvements, save a few forks
* usr/bin/byobu-janitor:
- performance improvements, save a few forks
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 May 2011 23:34:58 +0200 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 10 May 2011 23:34:58 +0200

View file

@ -29,7 +29,7 @@ FLAG="$RUN/$PKG.reload-required"
# Let's get prepped to switch over to XDG one day; maintain symlink for now # Let's get prepped to switch over to XDG one day; maintain symlink for now
mkdir -p "$XDG" mkdir -p "$XDG"
if [ -d "$DATA" ] && [ ! -h "$DATA" ]; then if [ ! -h "$DATA" ]; then
mv -f "$DATA"/* "$DATA"/.* "$XDG" 2>/dev/null || true mv -f "$DATA"/* "$DATA"/.* "$XDG" 2>/dev/null || true
rmdir "$DATA" rmdir "$DATA"
fi fi
@ -44,8 +44,8 @@ fi
DEFAULT_PROFILE="light" DEFAULT_PROFILE="light"
PROFILE="$DATA/profile" PROFILE="$DATA/profile"
# Use gsed on non-Linux OS's # Use gsed on non-Linux OS's
which gsed 2>/dev/null && SED="gsed" || SED="sed" command -v gsed >/dev/null && SED="gsed" || SED="sed"
which greadlink 2>/dev/null && READLINK="greadlink" || READLINK="readlink" command -v greadlink >/dev/null && READLINK="greadlink" || READLINK="readlink"
# Create byobu-exchange buffer file, with secure permissions, if it doesn't exist # Create byobu-exchange buffer file, with secure permissions, if it doesn't exist
if [ -w "$RUN" ] && [ ! -e "$RUN/$PKG-exchange" ]; then if [ -w "$RUN" ] && [ ! -e "$RUN/$PKG-exchange" ]; then
@ -66,13 +66,13 @@ fi
# Affects: Symlinks pointing to color profiles # Affects: Symlinks pointing to color profiles
if [ -h "$PROFILE" ]; then if [ -h "$PROFILE" ]; then
case "$($READLINK -f $PROFILE)" in PROFILE_FP=$($READLINK -f "$PROFILE")
case "${PROFILE_FP}" in
$BYOBU_PREFIX/share/byobu/profiles/*) $BYOBU_PREFIX/share/byobu/profiles/*)
# Set default colors # Set default colors
BG=W BG=W
FG=k FG=k
color=$(ls -l "$PROFILE") color=${PROFILE_FP##*/}
color=${color##*/}
case "$color" in case "$color" in
common) BG=; FG=;; common) BG=; FG=;;
black|dark) BG=k; FG=W;; black|dark) BG=k; FG=W;;