From a47990987f404c3e59f51e4242f24cc64552187e Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 5 May 2009 13:09:16 -0500 Subject: [PATCH] * bin/ec2-cost, bin/hostname, bin/ip-address, bin/logo, bin/mem-available, bin/network-down, bin/network-up, bin/updates-available, debian/postrm, debian/preinst, debian/release.sh, debian/rules, screen, screen-launcher-install, screen-profiles, screen-profiles-export, screen-profiles-status, select-screen-profile: abstract the package name (currently, screen-profiles) to a variable Signed-off-by: Dustin Kirkland --- bin/ec2-cost | 7 ++++--- bin/hostname | 4 +++- bin/ip-address | 6 ++++-- bin/logo | 10 ++++++---- bin/mem-available | 6 ++++-- bin/network-down | 4 +++- bin/network-up | 4 +++- bin/updates-available | 4 +++- debian/changelog | 9 ++++++++- debian/postrm | 4 +++- debian/preinst | 4 +++- debian/release.sh | 8 +++++--- debian/rules | 16 ++++++++-------- screen | 28 +++++++++++++++------------- screen-launcher-install | 3 ++- screen-profiles | 33 +++++++++++++++++---------------- screen-profiles-export | 30 +++++++++++++++--------------- screen-profiles-status | 16 +++++++++------- select-screen-profile | 13 +++++++------ 19 files changed, 122 insertions(+), 87 deletions(-) diff --git a/bin/ec2-cost b/bin/ec2-cost index a6d282a6..c48a7b27 100755 --- a/bin/ec2-cost +++ b/bin/ec2-cost @@ -19,11 +19,12 @@ FORCE=0 DETAIL=0 +PKG="screen-profiles" # Default is "off" p="ec2-cost" -grep -qs "^$p=1$" "$HOME/.screen-profiles/status" && FORCE=1 -grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && FORCE=0 +grep -qs "^$p=1$" "$HOME/.$PKG/status" && FORCE=1 +grep -qs "^$p=0$" "$HOME/.$PKG/status" && FORCE=0 for arg in $@; do case "$arg" in @@ -38,7 +39,7 @@ done # Exit immediately if this is not an Amazon EC2 instance, we're not # manually turned on, and we're not in force mode -[ -r "/etc/ec2_version" -o -r "$HOME/.screen-profiles/ec2-cost" -o "$FORCE" = "1" ] +[ -r "/etc/ec2_version" -o -r "$HOME/.$PKG/ec2-cost" -o "$FORCE" = "1" ] [ "$?" = "0" ] || exit 0 # Approximate Instance Cost Basis diff --git a/bin/hostname b/bin/hostname index 6c0fb0d4..bca3a866 100755 --- a/bin/hostname +++ b/bin/hostname @@ -17,12 +17,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="screen-profiles" + if [ "$1" = "--detail" ]; then hostname -f exit 0 fi at= -grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && at="@" +grep -qs "^whoami=1$" "$HOME/.$PKG/status" && at="@" printf "\005{=b }%s%s\005{-}" "$at" $(hostname -s 2>/dev/null || hostname) diff --git a/bin/ip-address b/bin/ip-address index 8a072747..1ce13591 100755 --- a/bin/ip-address +++ b/bin/ip-address @@ -17,13 +17,15 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="screen-profiles" + if [ "$1" = "--detail" ]; then hostname -i exit 0 fi space= -grep -qs "^hostname=1$" "$HOME/.screen-profiles/status" && space=" " -grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && space=" " +grep -qs "^hostname=1$" "$HOME/.$PKG/status" && space=" " +grep -qs "^whoami=1$" "$HOME/.$PKG/status" && space=" " printf "%s\005{=b }%s\005{-}" "$space" $(hostname -i 2>/dev/null) diff --git a/bin/logo b/bin/logo index 9471aa77..43d5b73d 100755 --- a/bin/logo +++ b/bin/logo @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="screen-profiles" + if [ "$1" = "--detail" ]; then MARKUP="false" else @@ -68,14 +70,14 @@ print_logo() { fi } -if [ -r "$HOME/.screen-profiles/logo" ]; then +if [ -r "$HOME/.$PKG/logo" ]; then # Allow users to define their own logo - cat "$HOME/.screen-profiles/logo" && exit 0 || true + cat "$HOME/.$PKG/logo" && exit 0 || true fi -if [ -r "$HOME/.screen-profiles/distro" ]; then +if [ -r "$HOME/.$PKG/distro" ]; then # Allow manual override of distro - distro=`cat "$HOME/.screen-profiles/distro"` + distro=`cat "$HOME/.$PKG/distro"` print_logo "$distro" && exit 0 || true fi diff --git a/bin/mem-available b/bin/mem-available index c021a210..5e56a1d8 100755 --- a/bin/mem-available +++ b/bin/mem-available @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="screen-profiles" + if [ "$1" = "--detail" ]; then free exit 0 @@ -24,8 +26,8 @@ fi comma= whitespace= -if [ -r "$HOME/.screen-profiles/status" ]; then - grep -qs "^mem-used=1$" "$HOME/.screen-profiles/status" && comma="," || whitespace=" " +if [ -r "$HOME/.$PKG/status" ]; then + grep -qs "^mem-used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" " else comma="," fi diff --git a/bin/network-down b/bin/network-down index c56f5db6..4c71ddd7 100755 --- a/bin/network-down +++ b/bin/network-down @@ -17,7 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cache="$HOME/.screen-profiles/network-down" +PKG="screen-profiles" + +cache="$HOME/.$PKG/network-down" interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` unit="kB/s" diff --git a/bin/network-up b/bin/network-up index f74bc9d2..891f24aa 100755 --- a/bin/network-up +++ b/bin/network-up @@ -17,7 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cache="$HOME/.screen-profiles/network-up" +PKG="screen-profiles" + +cache="$HOME/.$PKG/network-up" interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` unit="kB/s" diff --git a/bin/updates-available b/bin/updates-available index 13b9d61d..869bce56 100755 --- a/bin/updates-available +++ b/bin/updates-available @@ -29,6 +29,8 @@ if [ "$1" = "--detail" ]; then exit 0 fi +PKG="screen-profiles" + # expire the cache in X seconds; 1 hour by default EXPIRATION=3600 @@ -50,7 +52,7 @@ print_updates() { } cache=/var/run/updates-available -mycache=$HOME/.screen-profiles/updates-available +mycache=$HOME/.$PKG/updates-available now=`date +%s` cache_timestamp=`stat -c "%Y" $cache 2>/dev/null || echo 0` mycache_timestamp=`stat -c "%Y" $mycache 2>/dev/null || echo 0` diff --git a/debian/changelog b/debian/changelog index df3a4b56..26421f58 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,15 @@ screen-profiles (1.55) jaunty; urgency=low * bin/users: make the --detail output match the status output + * bin/ec2-cost, bin/hostname, bin/ip-address, bin/logo, + bin/mem-available, bin/network-down, bin/network-up, + bin/updates-available, debian/postrm, debian/preinst, + debian/release.sh, debian/rules, screen, screen-launcher-install, + screen-profiles, screen-profiles-export, screen-profiles-status, + select-screen-profile: abstract the package name (currently, + screen-profiles) to a variable - -- Dustin Kirkland Mon, 04 May 2009 10:14:48 -0500 + -- Dustin Kirkland Tue, 05 May 2009 13:04:06 -0500 screen-profiles (1.54-0ubuntu1) karmic; urgency=low diff --git a/debian/postrm b/debian/postrm index 0da7dda5..7ee4de6b 100644 --- a/debian/postrm +++ b/debian/postrm @@ -1,7 +1,9 @@ #!/bin/sh -e +PKG="screen-profiles" + if [ "$1" = "remove" ]; then - dpkg-divert --package screen-profiles --rename --remove /usr/bin/screen + dpkg-divert --package "$PKG" --rename --remove /usr/bin/screen fi #DEBHELPER# diff --git a/debian/preinst b/debian/preinst index 70933a30..86b6c90f 100644 --- a/debian/preinst +++ b/debian/preinst @@ -1,7 +1,9 @@ #!/bin/sh -e +PKG="screen-profiles" + if [ "install" = "$1" ] || [ "upgrade" = "$1" ]; then - dpkg-divert --package screen-profiles --divert /usr/bin/screen.real --rename /usr/bin/screen + dpkg-divert --package "$PKG" --divert /usr/bin/screen.real --rename /usr/bin/screen fi #DEBHELPER# diff --git a/debian/release.sh b/debian/release.sh index 232b319a..a23b2525 100755 --- a/debian/release.sh +++ b/debian/release.sh @@ -1,5 +1,7 @@ #!/bin/sh -e +PKG="screen-profiles" + error() { echo "ERROR: $@" exit 1 @@ -24,7 +26,7 @@ ver=`expr $curver + 1` dch -v "1.$ver" "UNRELEASED" sed -i "s/1.$ver) karmic;/1.$ver) unreleased;/" debian/changelog -gpg --armor --sign --detach-sig ../screen-profiles_*.orig.tar.gz +gpg --armor --sign --detach-sig ../"$PKG"_*.orig.tar.gz echo echo @@ -32,13 +34,13 @@ echo "To test:" echo " sudo dpkg -i ../*.deb" echo echo "To upload PPA packages:" -echo " dput screen-profiles-ppa ../*ppa*changes" +echo " dput $PKG-ppa ../*ppa*changes" echo echo "To commit and push:" echo " bzr cdiff" echo " bzr commit -m "releasing $curver, opening $ver" && bzr push" echo echo "Publish tarball at:" -echo " https://launchpad.net/screen-profiles/trunk/+addrelease" +echo " https://launchpad.net/$PKG/trunk/+addrelease" echo echo diff --git a/debian/rules b/debian/rules index e3f73e1c..f7af7592 100755 --- a/debian/rules +++ b/debian/rules @@ -4,30 +4,30 @@ # Uncomment this to turn on verbose mode. # export DH_VERBOSE=1 -PACKAGE=screen-profiles +PKG=screen-profiles VER=`head -n 1 debian/changelog | sed 's/^.*(//' | sed 's/).*//' | sed 's/-.*//'` get-orig-source: dh_testdir - bzr export ../${PACKAGE}_${VER}.orig.tar.gz + bzr export ../${PKG}_${VER}.orig.tar.gz install-po: update-pot for po in po/*.po ; do \ lang=$${po#po/}; lang=$${lang%.po}; \ mkdir -p po/locale/$${lang}/LC_MESSAGES/; \ - msgfmt $${po} -o po/locale/$${lang}/LC_MESSAGES/${PACKAGE}.mo ; \ + msgfmt $${po} -o po/locale/$${lang}/LC_MESSAGES/${PKG}.mo ; \ done update-pot: - rm -f po/${PACKAGE}.pot + rm -f po/${PKG}.pot grep -v "^#" po/POTFILES.sh | while read po ; do \ - xgettext -o po/${PACKAGE}.pot -L Shell $${po} ; \ + xgettext -o po/${PKG}.pot -L Shell $${po} ; \ done grep -v "^#" po/POTFILES.python | while read po ; do \ - xgettext -o po/${PACKAGE}.pot -L Python $${po} ; \ + xgettext -o po/${PKG}.pot -L Python $${po} ; \ done for po in po/*.po ; do \ - msgmerge $${po} po/${PACKAGE}.pot -o $${po} ; \ + msgmerge $${po} po/${PKG}.pot -o $${po} ; \ done prebuild: @@ -41,7 +41,7 @@ clean: ./profiles/generate --clean for po in po/*.po ; do \ lang=$${po#po/}; lang=$${lang%.po}; \ - rm -f po/locale/$${lang}/LC_MESSAGES/${PACKAGE}.mo ; \ + rm -f po/locale/$${lang}/LC_MESSAGES/${PKG}.mo ; \ done install: build install-po diff --git a/screen b/screen index 082ce105..36920573 100755 --- a/screen +++ b/screen @@ -17,16 +17,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Create the screen-profiles directory, if it doesn't already exist -[ -d "$HOME/.screen-profiles" ] || mkdir -p "$HOME/.screen-profiles" +PKG="screen-profiles" + +# Create the .$PKG directory, if it doesn't already exist +[ -d "$HOME/.$PKG" ] || mkdir -p "$HOME/.$PKG" # Use $SCREENRC if non-empty, and readable; otherwise, use the one in $HOME [ -n "$SCREENRC" -a -r "$SCREENRC" ] || SCREENRC="$HOME/.screenrc" -# If $SCREENRC exists but $HOME/.screen-profiles/profile does not, +# If $SCREENRC exists but $HOME/.$PKG/profile does not, # this shows that the user has an existing custom screen configuration, -# and thus we will not force screen-profiles on them. -if [ -r "$SCREENRC" -a ! -e "$HOME/.screen-profiles/profile" -a ! -h "$HOME/.screen-profiles/profile" ]; then +# and thus we will not force $PKG on them. +if [ -r "$SCREENRC" -a ! -e "$HOME/.$PKG/profile" -a ! -h "$HOME/.$PKG/profile" ]; then exec /usr/bin/screen.real -c "$SCREENRC" "$@" exit $? fi @@ -34,7 +36,7 @@ fi DEFAULT_PROFILE="light" # Ensure that the user has selected a screen profile -profile="$HOME/.screen-profiles/profile" +profile="$HOME/.$PKG/profile" [ -h "$profile" ] || /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" # Previously, profiles were prepended with ubuntu-. @@ -49,7 +51,7 @@ if [ -h "$profile" -a ! -r "$profile" ]; then /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" fi elif stat "$profile" | head -n1 | grep -qs ".*->.*plain'$"; then - ln -sf "/usr/share/screen-profiles/profiles/NONE" "$profile" + ln -sf "/usr/share/$PKG/profiles/NONE" "$profile" else /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" fi @@ -63,16 +65,16 @@ if [ ! -r "$profile" ]; then echo " $ select-screen-profile" echo echo "Or install the extras package:" - echo " $ sudo apt-get install screen-profiles-extras" + echo " $ sudo apt-get install $PKG-extras" echo exit 1 fi # Ensure that their keybindings are seeded -[ -s "$HOME/.screen-profiles/keybindings" ] || echo "source /usr/share/screen-profiles/keybindings/common" > "$HOME/.screen-profiles/keybindings" +[ -s "$HOME/.$PKG/keybindings" ] || echo "source /usr/share/$PKG/keybindings/common" > "$HOME/.$PKG/keybindings" # Ensure that their default windows are seeded -[ -r "$HOME/.screen-profiles/windows" ] || touch "$HOME/.screen-profiles/windows" +[ -r "$HOME/.$PKG/windows" ] || touch "$HOME/.$PKG/windows" # Ensure that the user's $SCREENRC at least exists [ -r "$SCREENRC" ] || touch "$SCREENRC" @@ -81,10 +83,10 @@ fi if [ "$#" = "0" ]; then # Create a temporary config file *with* the default windows # but if we refresh, we'll just source the profile, without - temp=$(mktemp -t screen-profiles-XXXXXXXX) - cat "$HOME/.screen-profiles/profile" "$HOME/.screen-profiles/windows" > "$temp" + temp=$(mktemp -t $PKG-XXXXXXXX) + cat "$HOME/.$PKG/profile" "$HOME/.$PKG/windows" > "$temp" [ -n "$SHELL" -a -x "$SHELL" ] || SHELL="/bin/sh" exec /usr/bin/screen.real -c "$temp" $SHELL /usr/bin/motd+shell "$temp" else - exec /usr/bin/screen.real -c "$HOME/.screen-profiles/profile" "$@" + exec /usr/bin/screen.real -c "$HOME/.$PKG/profile" "$@" fi diff --git a/screen-launcher-install b/screen-launcher-install index 9e822aa6..4e0abec5 100755 --- a/screen-launcher-install +++ b/screen-launcher-install @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +PKG="screen-profiles" install_screen_launcher() { dest=$1 @@ -28,7 +29,7 @@ install_screen_launcher() { } # Sanitize the environment -/usr/share/screen-profiles/screen-launcher-uninstall || true +/usr/share/$PKG/screen-launcher-uninstall || true # Install in $HOME/.profile unconditionally install_screen_launcher "$HOME/.profile" diff --git a/screen-profiles b/screen-profiles index 5badf307..e1236209 100755 --- a/screen-profiles +++ b/screen-profiles @@ -27,13 +27,14 @@ from ConfigParser import SafeConfigParser from snack import * HOME=os.getenv("HOME") -SHARE='/usr/share/screen-profiles' -DOC='/usr/share/doc/screen-profiles' +PKG="screen-profiles" +SHARE='/usr/share/'+PKG +DOC='/usr/share/doc/'+PKG DEF_ESC="A" RELOAD = "If you are using the default set of keybindings, press\n to activate these changes.\n\nOtherwise, exit this screen session and start a new one." -gettext.bindtextdomain('screen-profiles', SHARE+'/po') -gettext.textdomain('screen-profiles') +gettext.bindtextdomain(PKG, SHARE+'/po') +gettext.textdomain(PKG) _ = gettext.gettext # Command presets for windows creation @@ -155,7 +156,7 @@ def keybindings(screen, size): return 100 def switch_keybindings(set): - commands.getoutput("sed -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+HOME+"/.screen-profiles/keybindings") + commands.getoutput("sed -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+HOME+"/."+PKG+"/keybindings") def newwindow(screen, size): title=Entry(8, text="bash", returnExit=1) @@ -208,7 +209,7 @@ def newwindow(screen, size): return 100 def appendwindow(win): - f=open(HOME+'/.screen-profiles/windows', 'a') + f=open(HOME+'/.'+PKG+'/windows', 'a') try: f.write(win+"\n") @@ -219,7 +220,7 @@ def appendwindow(win): f.close() def readwindows(): - f=open(HOME+'/.screen-profiles/windows', 'r') + f=open(HOME+'/.'+PKG+'/windows', 'r') try: li=[] for line in f.readlines(): @@ -267,8 +268,8 @@ def readstatus(): status["uptime"]=1 status["whoami"]=0 status["wifi-quality"]=0 - if os.path.exists(HOME+'/.screen-profiles/status'): - f=open(HOME+'/.screen-profiles/status', 'r') + if os.path.exists(HOME+'/.'+PKG+'/status'): + f=open(HOME+'/.'+PKG+'/status', 'r') for line in f.readlines(): try: line = line.rstrip() @@ -287,7 +288,7 @@ def readstatus(): return li def writestatus(items): - f=open(HOME+'/.screen-profiles/status', 'w') + f=open(HOME+'/.'+PKG+'/status', 'w') try: for i in items: if i[0] == 1: @@ -325,7 +326,7 @@ def togglestatus(screen, size): return 100 def writewindows(winlist): - f=open(HOME+'/.screen-profiles/windows', 'w') + f=open(HOME+'/.'+PKG+'/windows', 'w') try: for win in winlist: if win[0] == -1: @@ -370,7 +371,7 @@ def defaultwindows(screen, size): def install(screen, size, isInstalled): if not isInstalled: - out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-install") + out = commands.getoutput("bash /usr/share/"+PKG+"/screen-launcher-install") if out == "": out = _("Screen will be launched automatically next time you login.") @@ -378,7 +379,7 @@ def install(screen, size, isInstalled): buttons=((_("Menu"), ))) return 100 else: - out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-uninstall") + out = commands.getoutput("bash /usr/share/"+PKG+"/screen-launcher-uninstall") if out == "": out = _("Screen will not be used next time you login.") @@ -398,7 +399,7 @@ def appendtofile(p, s): def getesckey(): - path=HOME+'/.screen-profiles/keybindings' + path=HOME+'/.'+PKG+'/keybindings' if not os.path.exists(path): return DEF_ESC line = commands.getoutput("grep ^escape "+path) @@ -407,7 +408,7 @@ def getesckey(): return line[line.find('^')+1] def setesckey(key): - path = HOME+'/.screen-profiles/keybindings' + path = HOME+'/.'+PKG+'/keybindings' if key != "": u = key[0].upper() l = key[0].lower() @@ -457,7 +458,7 @@ def chgesc(screen, size): return 100 def main(): - """This is the main loop of our screen-profiles utility + """This is the main loop of our utility """ size = terminal_size() diff --git a/screen-profiles-export b/screen-profiles-export index 838f43ef..b96c2f5f 100755 --- a/screen-profiles-export +++ b/screen-profiles-export @@ -17,9 +17,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -PROG="screen-profiles" -SHARE="/usr/share/$PROG" -DIR=`mktemp -t -d screen-profiles.XXXXXXXX` || error "Could not create a temporary directory" +PKG="screen-profiles" +SHARE="/usr/share/$PKG" +DIR=`mktemp -t -d $PKG.XXXXXXXX` || error "Could not create a temporary directory" # Grab list of available colors colors=`find $SHARE/profiles/ -type f | sed "s/^.*\///" | sed "s/^.*-//" | sort -u | egrep -v "common|plain|NONE"` @@ -85,9 +85,9 @@ choose() { status_config() { # Generate the status configuration - # Disable the menu, since screen-profiles configurator is not available + # Disable the menu, since configurator is not available # Enable user@host in its place - for i in $(ls /usr/lib/screen-profiles/); do + for i in $(ls /usr/lib/$PKG/); do case "$i" in cpu-count|cpu-freq|date|hostname|load-average|logo|mem-available|mem-used|reboot-required|release|time|updates-available|whoami) echo "$i=1" @@ -105,12 +105,12 @@ hr() { header() { hr - echo "# This GNU Screen profile was generated by the screen-profile-export" - echo "# program, which is part of the screen-profiles package, and contains a" + echo "# This GNU Screen profile was generated by the $PKG-export" + echo "# program, which is part of the $PKG package, and contains a" echo "# subset of the functionality available from the full package." echo "#" echo "# For more information, source code, questions, and bugs, see:" - echo "# * https://launchpad.net/screen-profiles" + echo "# * https://launchpad.net/$PKG" echo "#" echo "# Copyright (C) 2008 Canonical Ltd." echo "#" @@ -133,7 +133,7 @@ header() { sources() { # insert the common profile, replace the status exe path echo - cat $SHARE/profiles/common | sed "s:$PROG-status:\$HOME/.$PROG/$PROG-status:" + cat $SHARE/profiles/common | sed "s:$PKG-status:\$HOME/.$PKG/$PKG-status:" hr echo cat $SHARE/keybindings/common @@ -169,7 +169,7 @@ done if [ -z "$file" ]; then # Generate a temp archive filename while true; do - file=`mktemp -t screen-profiles.XXXXXX` || error "Could not generate random filename" + file=`mktemp -t $PKG.XXXXXX` || error "Could not generate random filename" if [ ! -e "$file.tar.gz" ]; then mv -i "$file" "$file.tar.gz" file="$file.tar.gz" @@ -217,12 +217,12 @@ done # Create workspace PROFILE="$DIR/.screenrc" -STATUS="$DIR/.$PROG/status" -mkdir -p "$DIR/.$PROG/bin" +STATUS="$DIR/.$PKG/status" +mkdir -p "$DIR/.$PKG/bin" # Copy status scripts -cp -a /usr/lib/$PROG/* "$DIR/.$PROG/bin" -cp -a /usr/bin/$PROG-status "$DIR/.$PROG" +cp -a /usr/lib/$PKG/* "$DIR/.$PKG/bin" +cp -a /usr/bin/$PKG-status "$DIR/.$PKG" # Generate the monolithic profile header > "$PROFILE" @@ -233,7 +233,7 @@ status_config > "$STATUS" # Drop additional "source" calls sed -i "s:^source .*::" "$PROFILE" # Use .screenrc instead -sed -i "s:.$PROG/profile\":\.screenrc\":" "$PROFILE" +sed -i "s:.$PKG/profile\":\.screenrc\":" "$PROFILE" # Drop the F9->Menu key sed -i "s:^bindkey -k k9 screen -t help:#bindkey -k k9 screen -t help:" "$PROFILE" diff --git a/screen-profiles-status b/screen-profiles-status index 8c6054cd..5c0ec311 100755 --- a/screen-profiles-status +++ b/screen-profiles-status @@ -26,10 +26,12 @@ # but not at screen startup. ########################################################### -if [ -d "$HOME/.screen-profiles/bin" ]; then - DIR="$HOME/.screen-profiles/bin" -elif [ -d "/usr/lib/screen-profiles" ]; then - DIR="/usr/lib/screen-profiles" +PKG="screen-profiles" + +if [ -d "$HOME/.$PKG/bin" ]; then + DIR="$HOME/.$PKG/bin" +elif [ -d "/usr/lib/$PKG" ]; then + DIR="/usr/lib/$PKG" else exit 1 fi @@ -43,15 +45,15 @@ HR=" case "$P" in # default = on, user must override to turn off cpu-count|cpu-freq|date|load-average|logo|mem-available|mem-used|menu|reboot-required|release|time|updates-available|uptime) - grep -qs -m1 "^$P=0$" "$HOME/.screen-profiles/status" && exit 0 + grep -qs -m1 "^$P=0$" "$HOME/.$PKG/status" && exit 0 ;; # default = off, user must override to turn on arch|battery|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|whoami|wifi-quality) - grep -qs -m1 "^$P=1$" "$HOME/.screen-profiles/status" || exit 0 + grep -qs -m1 "^$P=1$" "$HOME/.$PKG/status" || exit 0 ;; --detail) printf "\033[1m" - [ -x "/usr/bin/dpkg-query" ] && /usr/bin/dpkg-query --show screen-profiles | awk '{print "# screen-profiles (" $2 ") detailed status:"}' + [ -x "/usr/bin/dpkg-query" ] && /usr/bin/dpkg-query --show $PKG | awk '{print "# $PKG (" $2 ") detailed status:"}' printf "$X\n" for i in `ls "$DIR"`; do [ "$i" = "menu" ] && continue diff --git a/select-screen-profile b/select-screen-profile index 9c4f9c59..5e913c76 100755 --- a/select-screen-profile +++ b/select-screen-profile @@ -22,8 +22,9 @@ # If you change any strings, please generate localization information with: # ./debian/rules get-po +PKG="screen-profiles" -TEXTDOMAIN="screen-profiles" +TEXTDOMAIN="$PKG" usage () { cat <