4
# Copyright (C) 2008 Canonical Ltd.
6
# Authors: Dustin Kirkland <kirkland@canonical.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, version 3 of the License.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
# Allow for local status scripts
24
if [ -x "$HOME/.$PKG/bin/$1" ]; then
25
echo "$HOME/.$PKG/bin/$1"
26
elif [ -x "/usr/lib/$PKG/$1" ]; then
27
echo "/usr/lib/$PKG/$1"
36
if [ -z "$1" ] || [ "$COLOR" = "none" ]; then
40
-) printf "$ESC{-}" ;;
42
bold1) printf "$ESC{=b }" ;;
43
bold2) printf "$ESC{+b }" ;;
44
none) printf "$ESC{= }" ;;
45
invert) printf "$ESC{=r }" ;;
47
if [ "$#" = "2" ]; then
48
[ "$COLOR" = "monochrome" ] && printf "$ESC{= }" || printf "$ESC{= $1$2}"
50
[ "$COLOR" = "monochrome" ] && printf "$ESC{=$1 }" || printf "$ESC{=$1 $2$3}"
56
# Source configurations
57
[ -r "$HOME/.$PKG/color" ] && . "$HOME/.$PKG/color"
58
[ -r "/etc/$PKG/statusrc" ] && . "/etc/$PKG/statusrc"
59
[ -r "$HOME/.$PKG/status" ] && . "$HOME/.$PKG/status"
60
[ -r "$HOME/.$PKG/statusrc" ] && . "$HOME/.$PKG/statusrc"
66
if which dpkg-query >/dev/null; then
67
VER=`dpkg-query --show $PKG | awk '{print "-" $2 }'`
69
printf "$PKG$VER Detailed Status Navigation\n Expand all - zr\t\tCollapse all - zm\n Expand one - zo\t\tCollapse one - zc\n\n"
70
for i in $(ls "/usr/lib/$PKG" "$HOME/.$PKG/bin" 2>/dev/null | grep -v "^/" | sort -u); do
71
[ "$i" = "menu" ] && continue
72
script=`find_script $i`
73
short=`$script --short | sed 's/^\s*//' | sed 's/\s*$//' | sed 's/.{[^}]*}//g'` || true
74
detail=`$script --detail | sed '/^$/d' | sed 's/^/\t/g'` || true
75
printf "%s\n\t(%s)\n" "$short" "$i"
76
[ -n "$detail" ] && printf "%s\n" "$detail"
80
[ -z "$FOREGROUND" ] && FOREGROUND="w"
81
[ -z "$BACKGROUND" ] && BACKGROUND="k"
82
printf "$ESC{= $BACKGROUND$FOREGROUND}"
85
eval x="\$$P" || exit 1
86
[ "$x" = "1" ] || exit 0