mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
* 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:
parent
1664bbea69
commit
a47990987f
19 changed files with 122 additions and 87 deletions
|
@ -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
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
|
|
@ -17,13 +17,15 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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)
|
||||
|
|
10
bin/logo
10
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# 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/^.* //"`
|
||||
unit="kB/s"
|
||||
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# 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/^.* //"`
|
||||
unit="kB/s"
|
||||
|
|
|
@ -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`
|
||||
|
|
9
debian/changelog
vendored
9
debian/changelog
vendored
|
@ -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 <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
|
||||
|
||||
|
|
4
debian/postrm
vendored
4
debian/postrm
vendored
|
@ -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#
|
||||
|
|
4
debian/preinst
vendored
4
debian/preinst
vendored
|
@ -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#
|
||||
|
|
8
debian/release.sh
vendored
8
debian/release.sh
vendored
|
@ -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
|
||||
|
|
16
debian/rules
vendored
16
debian/rules
vendored
|
@ -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
|
||||
|
|
28
screen
28
screen
|
@ -17,16 +17,18 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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"
|
||||
|
|
|
@ -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<F5> 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()
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <<EOT
|
||||
|
@ -37,7 +38,7 @@ EOT
|
|||
}
|
||||
|
||||
# Initialize variables
|
||||
BASE_DIR="/usr/share/screen-profiles"
|
||||
BASE_DIR="/usr/share/$PKG"
|
||||
PROFILE_DIR="$BASE_DIR/profiles"
|
||||
profile=""
|
||||
selected=-1
|
||||
|
@ -51,9 +52,9 @@ assert_symlink() {
|
|||
fi
|
||||
}
|
||||
|
||||
mkdir -p "$HOME/.screen-profiles"
|
||||
mkdir -p "$HOME/.$PKG"
|
||||
# If these files exist, they must be a symlink
|
||||
assert_symlink "$HOME/.screen-profiles/profile"
|
||||
assert_symlink "$HOME/.$PKG/profile"
|
||||
|
||||
listprofiles() {
|
||||
# Display list of profiles, one per line
|
||||
|
@ -123,8 +124,8 @@ setprofile() {
|
|||
for x in $profiles; do
|
||||
i=`expr $i + 1`
|
||||
if [ "$i" = "$selected" -o "$x" = "$selected" ]; then
|
||||
rm -f "$HOME/.screen-profiles/profile"
|
||||
ln -s "$PROFILE_DIR/$x" "$HOME/.screen-profiles/profile"
|
||||
rm -f "$HOME/.$PKG/profile"
|
||||
ln -s "$PROFILE_DIR/$x" "$HOME/.$PKG/profile"
|
||||
found=1
|
||||
echo
|
||||
if [ "$TERM" = "screen" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue