* 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 <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-05-05 13:09:16 -05:00
commit a47990987f
19 changed files with 122 additions and 87 deletions

View file

@ -19,11 +19,12 @@
FORCE=0 FORCE=0
DETAIL=0 DETAIL=0
PKG="screen-profiles"
# Default is "off" # Default is "off"
p="ec2-cost" p="ec2-cost"
grep -qs "^$p=1$" "$HOME/.screen-profiles/status" && FORCE=1 grep -qs "^$p=1$" "$HOME/.$PKG/status" && FORCE=1
grep -qs "^$p=0$" "$HOME/.screen-profiles/status" && FORCE=0 grep -qs "^$p=0$" "$HOME/.$PKG/status" && FORCE=0
for arg in $@; do for arg in $@; do
case "$arg" in case "$arg" in
@ -38,7 +39,7 @@ done
# Exit immediately if this is not an Amazon EC2 instance, we're not # Exit immediately if this is not an Amazon EC2 instance, we're not
# manually turned on, and we're not in force mode # 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 [ "$?" = "0" ] || exit 0
# Approximate Instance Cost Basis # Approximate Instance Cost Basis

View file

@ -17,12 +17,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="screen-profiles"
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
hostname -f hostname -f
exit 0 exit 0
fi fi
at= 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) printf "\005{=b }%s%s\005{-}" "$at" $(hostname -s 2>/dev/null || hostname)

View file

@ -17,13 +17,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="screen-profiles"
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
hostname -i hostname -i
exit 0 exit 0
fi fi
space= space=
grep -qs "^hostname=1$" "$HOME/.screen-profiles/status" && space=" " grep -qs "^hostname=1$" "$HOME/.$PKG/status" && space=" "
grep -qs "^whoami=1$" "$HOME/.screen-profiles/status" && space=" " grep -qs "^whoami=1$" "$HOME/.$PKG/status" && space=" "
printf "%s\005{=b }%s\005{-}" "$space" $(hostname -i 2>/dev/null) printf "%s\005{=b }%s\005{-}" "$space" $(hostname -i 2>/dev/null)

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="screen-profiles"
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
MARKUP="false" MARKUP="false"
else else
@ -68,14 +70,14 @@ print_logo() {
fi fi
} }
if [ -r "$HOME/.screen-profiles/logo" ]; then if [ -r "$HOME/.$PKG/logo" ]; then
# Allow users to define their own logo # Allow users to define their own logo
cat "$HOME/.screen-profiles/logo" && exit 0 || true cat "$HOME/.$PKG/logo" && exit 0 || true
fi fi
if [ -r "$HOME/.screen-profiles/distro" ]; then if [ -r "$HOME/.$PKG/distro" ]; then
# Allow manual override of distro # Allow manual override of distro
distro=`cat "$HOME/.screen-profiles/distro"` distro=`cat "$HOME/.$PKG/distro"`
print_logo "$distro" && exit 0 || true print_logo "$distro" && exit 0 || true
fi fi

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="screen-profiles"
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
free free
exit 0 exit 0
@ -24,8 +26,8 @@ fi
comma= comma=
whitespace= whitespace=
if [ -r "$HOME/.screen-profiles/status" ]; then if [ -r "$HOME/.$PKG/status" ]; then
grep -qs "^mem-used=1$" "$HOME/.screen-profiles/status" && comma="," || whitespace=" " grep -qs "^mem-used=1$" "$HOME/.$PKG/status" && comma="," || whitespace=" "
else else
comma="," comma=","
fi fi

View file

@ -17,7 +17,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
cache="$HOME/.screen-profiles/network-down" PKG="screen-profiles"
cache="$HOME/.$PKG/network-down"
interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"`
unit="kB/s" unit="kB/s"

View file

@ -17,7 +17,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
cache="$HOME/.screen-profiles/network-up" PKG="screen-profiles"
cache="$HOME/.$PKG/network-up"
interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"` interface=`/sbin/route -n | tail -n 1 | sed "s/^.* //"`
unit="kB/s" unit="kB/s"

View file

@ -29,6 +29,8 @@ if [ "$1" = "--detail" ]; then
exit 0 exit 0
fi fi
PKG="screen-profiles"
# expire the cache in X seconds; 1 hour by default # expire the cache in X seconds; 1 hour by default
EXPIRATION=3600 EXPIRATION=3600
@ -50,7 +52,7 @@ print_updates() {
} }
cache=/var/run/updates-available cache=/var/run/updates-available
mycache=$HOME/.screen-profiles/updates-available mycache=$HOME/.$PKG/updates-available
now=`date +%s` now=`date +%s`
cache_timestamp=`stat -c "%Y" $cache 2>/dev/null || echo 0` cache_timestamp=`stat -c "%Y" $cache 2>/dev/null || echo 0`
mycache_timestamp=`stat -c "%Y" $mycache 2>/dev/null || echo 0` mycache_timestamp=`stat -c "%Y" $mycache 2>/dev/null || echo 0`

9
debian/changelog vendored
View file

@ -1,8 +1,15 @@
screen-profiles (1.55) jaunty; urgency=low screen-profiles (1.55) jaunty; urgency=low
* bin/users: make the --detail output match the status output * 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 <kirkland@ubuntu.com> Mon, 04 May 2009 10:14:48 -0500 -- Dustin Kirkland <kirkland@ubuntu.com> Tue, 05 May 2009 13:04:06 -0500
screen-profiles (1.54-0ubuntu1) karmic; urgency=low screen-profiles (1.54-0ubuntu1) karmic; urgency=low

4
debian/postrm vendored
View file

@ -1,7 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
PKG="screen-profiles"
if [ "$1" = "remove" ]; then if [ "$1" = "remove" ]; then
dpkg-divert --package screen-profiles --rename --remove /usr/bin/screen dpkg-divert --package "$PKG" --rename --remove /usr/bin/screen
fi fi
#DEBHELPER# #DEBHELPER#

4
debian/preinst vendored
View file

@ -1,7 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
PKG="screen-profiles"
if [ "install" = "$1" ] || [ "upgrade" = "$1" ]; then 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 fi
#DEBHELPER# #DEBHELPER#

8
debian/release.sh vendored
View file

@ -1,5 +1,7 @@
#!/bin/sh -e #!/bin/sh -e
PKG="screen-profiles"
error() { error() {
echo "ERROR: $@" echo "ERROR: $@"
exit 1 exit 1
@ -24,7 +26,7 @@ ver=`expr $curver + 1`
dch -v "1.$ver" "UNRELEASED" dch -v "1.$ver" "UNRELEASED"
sed -i "s/1.$ver) karmic;/1.$ver) unreleased;/" debian/changelog 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
echo echo
@ -32,13 +34,13 @@ echo "To test:"
echo " sudo dpkg -i ../*.deb" echo " sudo dpkg -i ../*.deb"
echo echo
echo "To upload PPA packages:" echo "To upload PPA packages:"
echo " dput screen-profiles-ppa ../*ppa*changes" echo " dput $PKG-ppa ../*ppa*changes"
echo echo
echo "To commit and push:" echo "To commit and push:"
echo " bzr cdiff" echo " bzr cdiff"
echo " bzr commit -m "releasing $curver, opening $ver" && bzr push" echo " bzr commit -m "releasing $curver, opening $ver" && bzr push"
echo echo
echo "Publish tarball at:" echo "Publish tarball at:"
echo " https://launchpad.net/screen-profiles/trunk/+addrelease" echo " https://launchpad.net/$PKG/trunk/+addrelease"
echo echo
echo echo

16
debian/rules vendored
View file

@ -4,30 +4,30 @@
# Uncomment this to turn on verbose mode. # Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1 # export DH_VERBOSE=1
PACKAGE=screen-profiles PKG=screen-profiles
VER=`head -n 1 debian/changelog | sed 's/^.*(//' | sed 's/).*//' | sed 's/-.*//'` VER=`head -n 1 debian/changelog | sed 's/^.*(//' | sed 's/).*//' | sed 's/-.*//'`
get-orig-source: get-orig-source:
dh_testdir dh_testdir
bzr export ../${PACKAGE}_${VER}.orig.tar.gz bzr export ../${PKG}_${VER}.orig.tar.gz
install-po: update-pot install-po: update-pot
for po in po/*.po ; do \ for po in po/*.po ; do \
lang=$${po#po/}; lang=$${lang%.po}; \ lang=$${po#po/}; lang=$${lang%.po}; \
mkdir -p po/locale/$${lang}/LC_MESSAGES/; \ 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 done
update-pot: update-pot:
rm -f po/${PACKAGE}.pot rm -f po/${PKG}.pot
grep -v "^#" po/POTFILES.sh | while read po ; do \ 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 done
grep -v "^#" po/POTFILES.python | while read po ; do \ 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 done
for po in po/*.po ; do \ for po in po/*.po ; do \
msgmerge $${po} po/${PACKAGE}.pot -o $${po} ; \ msgmerge $${po} po/${PKG}.pot -o $${po} ; \
done done
prebuild: prebuild:
@ -41,7 +41,7 @@ clean:
./profiles/generate --clean ./profiles/generate --clean
for po in po/*.po ; do \ for po in po/*.po ; do \
lang=$${po#po/}; lang=$${lang%.po}; \ 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 done
install: build install-po install: build install-po

28
screen
View file

@ -17,16 +17,18 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Create the screen-profiles directory, if it doesn't already exist PKG="screen-profiles"
[ -d "$HOME/.screen-profiles" ] || mkdir -p "$HOME/.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 # Use $SCREENRC if non-empty, and readable; otherwise, use the one in $HOME
[ -n "$SCREENRC" -a -r "$SCREENRC" ] || SCREENRC="$HOME/.screenrc" [ -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, # this shows that the user has an existing custom screen configuration,
# and thus we will not force screen-profiles on them. # and thus we will not force $PKG on them.
if [ -r "$SCREENRC" -a ! -e "$HOME/.screen-profiles/profile" -a ! -h "$HOME/.screen-profiles/profile" ]; then if [ -r "$SCREENRC" -a ! -e "$HOME/.$PKG/profile" -a ! -h "$HOME/.$PKG/profile" ]; then
exec /usr/bin/screen.real -c "$SCREENRC" "$@" exec /usr/bin/screen.real -c "$SCREENRC" "$@"
exit $? exit $?
fi fi
@ -34,7 +36,7 @@ fi
DEFAULT_PROFILE="light" DEFAULT_PROFILE="light"
# Ensure that the user has selected a screen profile # 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" [ -h "$profile" ] || /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE"
# Previously, profiles were prepended with ubuntu-. # 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" /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE"
fi fi
elif stat "$profile" | head -n1 | grep -qs ".*->.*plain'$"; then 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 else
/usr/bin/select-screen-profile -s "$DEFAULT_PROFILE" /usr/bin/select-screen-profile -s "$DEFAULT_PROFILE"
fi fi
@ -63,16 +65,16 @@ if [ ! -r "$profile" ]; then
echo " $ select-screen-profile" echo " $ select-screen-profile"
echo echo
echo "Or install the extras package:" echo "Or install the extras package:"
echo " $ sudo apt-get install screen-profiles-extras" echo " $ sudo apt-get install $PKG-extras"
echo echo
exit 1 exit 1
fi fi
# Ensure that their keybindings are seeded # 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 # 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 # Ensure that the user's $SCREENRC at least exists
[ -r "$SCREENRC" ] || touch "$SCREENRC" [ -r "$SCREENRC" ] || touch "$SCREENRC"
@ -81,10 +83,10 @@ fi
if [ "$#" = "0" ]; then if [ "$#" = "0" ]; then
# Create a temporary config file *with* the default windows # Create a temporary config file *with* the default windows
# but if we refresh, we'll just source the profile, without # but if we refresh, we'll just source the profile, without
temp=$(mktemp -t screen-profiles-XXXXXXXX) temp=$(mktemp -t $PKG-XXXXXXXX)
cat "$HOME/.screen-profiles/profile" "$HOME/.screen-profiles/windows" > "$temp" cat "$HOME/.$PKG/profile" "$HOME/.$PKG/windows" > "$temp"
[ -n "$SHELL" -a -x "$SHELL" ] || SHELL="/bin/sh" [ -n "$SHELL" -a -x "$SHELL" ] || SHELL="/bin/sh"
exec /usr/bin/screen.real -c "$temp" $SHELL /usr/bin/motd+shell "$temp" exec /usr/bin/screen.real -c "$temp" $SHELL /usr/bin/motd+shell "$temp"
else else
exec /usr/bin/screen.real -c "$HOME/.screen-profiles/profile" "$@" exec /usr/bin/screen.real -c "$HOME/.$PKG/profile" "$@"
fi fi

View file

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PKG="screen-profiles"
install_screen_launcher() { install_screen_launcher() {
dest=$1 dest=$1
@ -28,7 +29,7 @@ install_screen_launcher() {
} }
# Sanitize the environment # Sanitize the environment
/usr/share/screen-profiles/screen-launcher-uninstall || true /usr/share/$PKG/screen-launcher-uninstall || true
# Install in $HOME/.profile unconditionally # Install in $HOME/.profile unconditionally
install_screen_launcher "$HOME/.profile" install_screen_launcher "$HOME/.profile"

View file

@ -27,13 +27,14 @@ from ConfigParser import SafeConfigParser
from snack import * from snack import *
HOME=os.getenv("HOME") HOME=os.getenv("HOME")
SHARE='/usr/share/screen-profiles' PKG="screen-profiles"
DOC='/usr/share/doc/screen-profiles' SHARE='/usr/share/'+PKG
DOC='/usr/share/doc/'+PKG
DEF_ESC="A" DEF_ESC="A"
RELOAD = "If you are using the default set of keybindings, press\n<F5> to activate these changes.\n\nOtherwise, exit this screen session and start a new one." RELOAD = "If you are using the default set of keybindings, press\n<F5> to activate these changes.\n\nOtherwise, exit this screen session and start a new one."
gettext.bindtextdomain('screen-profiles', SHARE+'/po') gettext.bindtextdomain(PKG, SHARE+'/po')
gettext.textdomain('screen-profiles') gettext.textdomain(PKG)
_ = gettext.gettext _ = gettext.gettext
# Command presets for windows creation # Command presets for windows creation
@ -155,7 +156,7 @@ def keybindings(screen, size):
return 100 return 100
def switch_keybindings(set): 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): def newwindow(screen, size):
title=Entry(8, text="bash", returnExit=1) title=Entry(8, text="bash", returnExit=1)
@ -208,7 +209,7 @@ def newwindow(screen, size):
return 100 return 100
def appendwindow(win): def appendwindow(win):
f=open(HOME+'/.screen-profiles/windows', 'a') f=open(HOME+'/.'+PKG+'/windows', 'a')
try: try:
f.write(win+"\n") f.write(win+"\n")
@ -219,7 +220,7 @@ def appendwindow(win):
f.close() f.close()
def readwindows(): def readwindows():
f=open(HOME+'/.screen-profiles/windows', 'r') f=open(HOME+'/.'+PKG+'/windows', 'r')
try: try:
li=[] li=[]
for line in f.readlines(): for line in f.readlines():
@ -267,8 +268,8 @@ def readstatus():
status["uptime"]=1 status["uptime"]=1
status["whoami"]=0 status["whoami"]=0
status["wifi-quality"]=0 status["wifi-quality"]=0
if os.path.exists(HOME+'/.screen-profiles/status'): if os.path.exists(HOME+'/.'+PKG+'/status'):
f=open(HOME+'/.screen-profiles/status', 'r') f=open(HOME+'/.'+PKG+'/status', 'r')
for line in f.readlines(): for line in f.readlines():
try: try:
line = line.rstrip() line = line.rstrip()
@ -287,7 +288,7 @@ def readstatus():
return li return li
def writestatus(items): def writestatus(items):
f=open(HOME+'/.screen-profiles/status', 'w') f=open(HOME+'/.'+PKG+'/status', 'w')
try: try:
for i in items: for i in items:
if i[0] == 1: if i[0] == 1:
@ -325,7 +326,7 @@ def togglestatus(screen, size):
return 100 return 100
def writewindows(winlist): def writewindows(winlist):
f=open(HOME+'/.screen-profiles/windows', 'w') f=open(HOME+'/.'+PKG+'/windows', 'w')
try: try:
for win in winlist: for win in winlist:
if win[0] == -1: if win[0] == -1:
@ -370,7 +371,7 @@ def defaultwindows(screen, size):
def install(screen, size, isInstalled): def install(screen, size, isInstalled):
if not 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 == "": if out == "":
out = _("Screen will be launched automatically next time you login.") out = _("Screen will be launched automatically next time you login.")
@ -378,7 +379,7 @@ def install(screen, size, isInstalled):
buttons=((_("Menu"), ))) buttons=((_("Menu"), )))
return 100 return 100
else: else:
out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-uninstall") out = commands.getoutput("bash /usr/share/"+PKG+"/screen-launcher-uninstall")
if out == "": if out == "":
out = _("Screen will not be used next time you login.") out = _("Screen will not be used next time you login.")
@ -398,7 +399,7 @@ def appendtofile(p, s):
def getesckey(): def getesckey():
path=HOME+'/.screen-profiles/keybindings' path=HOME+'/.'+PKG+'/keybindings'
if not os.path.exists(path): if not os.path.exists(path):
return DEF_ESC return DEF_ESC
line = commands.getoutput("grep ^escape "+path) line = commands.getoutput("grep ^escape "+path)
@ -407,7 +408,7 @@ def getesckey():
return line[line.find('^')+1] return line[line.find('^')+1]
def setesckey(key): def setesckey(key):
path = HOME+'/.screen-profiles/keybindings' path = HOME+'/.'+PKG+'/keybindings'
if key != "": if key != "":
u = key[0].upper() u = key[0].upper()
l = key[0].lower() l = key[0].lower()
@ -457,7 +458,7 @@ def chgesc(screen, size):
return 100 return 100
def main(): def main():
"""This is the main loop of our screen-profiles utility """This is the main loop of our utility
""" """
size = terminal_size() size = terminal_size()

View file

@ -17,9 +17,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
PROG="screen-profiles" PKG="screen-profiles"
SHARE="/usr/share/$PROG" SHARE="/usr/share/$PKG"
DIR=`mktemp -t -d screen-profiles.XXXXXXXX` || error "Could not create a temporary directory" DIR=`mktemp -t -d $PKG.XXXXXXXX` || error "Could not create a temporary directory"
# Grab list of available colors # Grab list of available colors
colors=`find $SHARE/profiles/ -type f | sed "s/^.*\///" | sed "s/^.*-//" | sort -u | egrep -v "common|plain|NONE"` colors=`find $SHARE/profiles/ -type f | sed "s/^.*\///" | sed "s/^.*-//" | sort -u | egrep -v "common|plain|NONE"`
@ -85,9 +85,9 @@ choose() {
status_config() { status_config() {
# Generate the status configuration # 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 # 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 case "$i" in
cpu-count|cpu-freq|date|hostname|load-average|logo|mem-available|mem-used|reboot-required|release|time|updates-available|whoami) cpu-count|cpu-freq|date|hostname|load-average|logo|mem-available|mem-used|reboot-required|release|time|updates-available|whoami)
echo "$i=1" echo "$i=1"
@ -105,12 +105,12 @@ hr() {
header() { header() {
hr hr
echo "# This GNU Screen profile was generated by the screen-profile-export" echo "# This GNU Screen profile was generated by the $PKG-export"
echo "# program, which is part of the screen-profiles package, and contains a" echo "# program, which is part of the $PKG package, and contains a"
echo "# subset of the functionality available from the full package." echo "# subset of the functionality available from the full package."
echo "#" echo "#"
echo "# For more information, source code, questions, and bugs, see:" echo "# For more information, source code, questions, and bugs, see:"
echo "# * https://launchpad.net/screen-profiles" echo "# * https://launchpad.net/$PKG"
echo "#" echo "#"
echo "# Copyright (C) 2008 Canonical Ltd." echo "# Copyright (C) 2008 Canonical Ltd."
echo "#" echo "#"
@ -133,7 +133,7 @@ header() {
sources() { sources() {
# insert the common profile, replace the status exe path # insert the common profile, replace the status exe path
echo 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 hr
echo echo
cat $SHARE/keybindings/common cat $SHARE/keybindings/common
@ -169,7 +169,7 @@ done
if [ -z "$file" ]; then if [ -z "$file" ]; then
# Generate a temp archive filename # Generate a temp archive filename
while true; do 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 if [ ! -e "$file.tar.gz" ]; then
mv -i "$file" "$file.tar.gz" mv -i "$file" "$file.tar.gz"
file="$file.tar.gz" file="$file.tar.gz"
@ -217,12 +217,12 @@ done
# Create workspace # Create workspace
PROFILE="$DIR/.screenrc" PROFILE="$DIR/.screenrc"
STATUS="$DIR/.$PROG/status" STATUS="$DIR/.$PKG/status"
mkdir -p "$DIR/.$PROG/bin" mkdir -p "$DIR/.$PKG/bin"
# Copy status scripts # Copy status scripts
cp -a /usr/lib/$PROG/* "$DIR/.$PROG/bin" cp -a /usr/lib/$PKG/* "$DIR/.$PKG/bin"
cp -a /usr/bin/$PROG-status "$DIR/.$PROG" cp -a /usr/bin/$PKG-status "$DIR/.$PKG"
# Generate the monolithic profile # Generate the monolithic profile
header > "$PROFILE" header > "$PROFILE"
@ -233,7 +233,7 @@ status_config > "$STATUS"
# Drop additional "source" calls # Drop additional "source" calls
sed -i "s:^source .*::" "$PROFILE" sed -i "s:^source .*::" "$PROFILE"
# Use .screenrc instead # Use .screenrc instead
sed -i "s:.$PROG/profile\":\.screenrc\":" "$PROFILE" sed -i "s:.$PKG/profile\":\.screenrc\":" "$PROFILE"
# Drop the F9->Menu key # Drop the F9->Menu key
sed -i "s:^bindkey -k k9 screen -t help:#bindkey -k k9 screen -t help:" "$PROFILE" sed -i "s:^bindkey -k k9 screen -t help:#bindkey -k k9 screen -t help:" "$PROFILE"

View file

@ -26,10 +26,12 @@
# but not at screen startup. # but not at screen startup.
########################################################### ###########################################################
if [ -d "$HOME/.screen-profiles/bin" ]; then PKG="screen-profiles"
DIR="$HOME/.screen-profiles/bin"
elif [ -d "/usr/lib/screen-profiles" ]; then if [ -d "$HOME/.$PKG/bin" ]; then
DIR="/usr/lib/screen-profiles" DIR="$HOME/.$PKG/bin"
elif [ -d "/usr/lib/$PKG" ]; then
DIR="/usr/lib/$PKG"
else else
exit 1 exit 1
fi fi
@ -43,15 +45,15 @@ HR="
case "$P" in case "$P" in
# default = on, user must override to turn off # 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) 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 # default = off, user must override to turn on
arch|battery|ec2-cost|hostname|ip-address|network-down|network-up|processes|users|whoami|wifi-quality) 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) --detail)
printf "\033[1m" 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" printf "$X\n"
for i in `ls "$DIR"`; do for i in `ls "$DIR"`; do
[ "$i" = "menu" ] && continue [ "$i" = "menu" ] && continue

View file

@ -22,8 +22,9 @@
# If you change any strings, please generate localization information with: # If you change any strings, please generate localization information with:
# ./debian/rules get-po # ./debian/rules get-po
PKG="screen-profiles"
TEXTDOMAIN="screen-profiles" TEXTDOMAIN="$PKG"
usage () { usage () {
cat <<EOT cat <<EOT
@ -37,7 +38,7 @@ EOT
} }
# Initialize variables # Initialize variables
BASE_DIR="/usr/share/screen-profiles" BASE_DIR="/usr/share/$PKG"
PROFILE_DIR="$BASE_DIR/profiles" PROFILE_DIR="$BASE_DIR/profiles"
profile="" profile=""
selected=-1 selected=-1
@ -51,9 +52,9 @@ assert_symlink() {
fi fi
} }
mkdir -p "$HOME/.screen-profiles" mkdir -p "$HOME/.$PKG"
# If these files exist, they must be a symlink # If these files exist, they must be a symlink
assert_symlink "$HOME/.screen-profiles/profile" assert_symlink "$HOME/.$PKG/profile"
listprofiles() { listprofiles() {
# Display list of profiles, one per line # Display list of profiles, one per line
@ -123,8 +124,8 @@ setprofile() {
for x in $profiles; do for x in $profiles; do
i=`expr $i + 1` i=`expr $i + 1`
if [ "$i" = "$selected" -o "$x" = "$selected" ]; then if [ "$i" = "$selected" -o "$x" = "$selected" ]; then
rm -f "$HOME/.screen-profiles/profile" rm -f "$HOME/.$PKG/profile"
ln -s "$PROFILE_DIR/$x" "$HOME/.screen-profiles/profile" ln -s "$PROFILE_DIR/$x" "$HOME/.$PKG/profile"
found=1 found=1
echo echo
if [ "$TERM" = "screen" ]; then if [ "$TERM" = "screen" ]; then