From 308c9aa65018554b044f07c2eb75eea02b656983 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Thu, 24 Jun 2010 10:28:20 -0500 Subject: [PATCH] usr/bin/byobu-janitor --- debian/changelog | 1 + usr/bin/byobu-janitor | 56 ++++++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/debian/changelog b/debian/changelog index d1de6b78..41958c6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,7 @@ byobu (2.81) unreleased; urgency=low - usr/bin/byobu-launcher - usr/bin/byobu - usr/bin/byobu-export + - usr/bin/byobu-janitor * usr/bin/byobu-config, usr/share/doc/byobu/help.txt: improve help text, per feedback from Turnkey Linux users diff --git a/usr/bin/byobu-janitor b/usr/bin/byobu-janitor index 618b174b..37be4dc0 100755 --- a/usr/bin/byobu-janitor +++ b/usr/bin/byobu-janitor @@ -58,32 +58,38 @@ fi [ -r "$PROFILE" ] || ln -sf /usr/share/$PKG/profiles/common "$PROFILE" # Affects: Symlinks pointing to color profiles -if [ -h "$PROFILE" ] && \ - stat "$PROFILE" | grep -qs "File:.*->.*/usr/share/byobu/profiles/" && \ - ! stat "$PROFILE" | grep -qs "File:.*->.*/usr/share/byobu/profiles/common" ; then - # Set default colors - BG=W - FG=k - color=$(ls -l "$PROFILE" | sed "s/^.*\///") - case $color in - black|dark) BG=k; FG=W;; - dark_blue) BG=b; FG=W;; - dark_cyan) BG=c; FG=W;; - dark_green) BG=g; FG=W;; - dark_purple) BG=m; FG=W;; - dark_red) BG=r; FG=W;; - dark_yellow) BG=y; FG=W;; - light) BG=W; FG=k;; - light_blue) BG=B; FG=k;; - light_cyan) BG=C; FG=k;; - light_green) BG=G; FG=k;; - light_purple) BG=M; FG=k;; - light_red) BG=R; FG=k;; - light_yellow) BG=Y; FG=k;; - *) BG=W; FG=k;; +if [ -h "$PROFILE" ]; then + case "$(stat $PROFILE)" in + *File:*-\>*/usr/share/byobu/profiles/common) + # All good, nothing to do + true + ;; + *File:*-\>*/usr/share/byobu/profiles/*) + # Set default colors + BG=W + FG=k + color=$(ls -l "$PROFILE" | sed "s/^.*\///") + case $color in + black|dark) BG=k; FG=W;; + dark_blue) BG=b; FG=W;; + dark_cyan) BG=c; FG=W;; + dark_green) BG=g; FG=W;; + dark_purple) BG=m; FG=W;; + dark_red) BG=r; FG=W;; + dark_yellow) BG=y; FG=W;; + light) BG=W; FG=k;; + light_blue) BG=B; FG=k;; + light_cyan) BG=C; FG=k;; + light_green) BG=G; FG=k;; + light_purple) BG=M; FG=k;; + light_red) BG=R; FG=k;; + light_yellow) BG=Y; FG=k;; + *) BG=W; FG=k;; + esac + rm -f "$PROFILE" 2>/dev/null + byobu-select-profile -b $BG -f $FG >/dev/null 2>&1 + ;; esac - rm -f "$PROFILE" 2>/dev/null - byobu-select-profile -b $BG -f $FG >/dev/null 2>&1 fi [ -s "$HOME/.$PKG/keybindings" ] || echo "source /usr/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings"