From a7a529c27394ae0e7450d7b77bfda8eec08c3681 Mon Sep 17 00:00:00 2001 From: Nick Barcet Date: Mon, 15 Dec 2008 18:20:43 +0100 Subject: [PATCH] Allow local modification of .screenrc (LP: #308216) --- base-screenrc | 5 +++++ debian/changelog | 5 ++++- debian/install | 1 + select-screen-profile | 20 +++++++++++++++----- 4 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 base-screenrc diff --git a/base-screenrc b/base-screenrc new file mode 100644 index 00000000..45439a82 --- /dev/null +++ b/base-screenrc @@ -0,0 +1,5 @@ +# This is a base .screenrc file created by the screen-profiles package +# The following line sources the currently selected profile +source ~/.screenrc-profile + +# Add your personalisation of screen below this line diff --git a/debian/changelog b/debian/changelog index 398c1deb..ae80fcf9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,8 @@ screen-profiles (1.0) jaunty; urgency=low - + [ Dustin Kirklan ] * Initial upload + [ Nicolas Barcet ] + * Allow local modification of .screenrc (LP: #308216) + -- Dustin Kirkland Sun, 14 Dec 2008 13:12:12 -0600 diff --git a/debian/install b/debian/install index e66b48d6..60c64051 100644 --- a/debian/install +++ b/debian/install @@ -5,3 +5,4 @@ bin/updates-available usr/share/screen-profiles/bin profiles/debian.screenrc usr/share/screen-profiles/profiles profiles/ubuntu.screenrc usr/share/screen-profiles/profiles select-screen-profile usr/bin +base-screenrc usr/share/screen-profiles diff --git a/select-screen-profile b/select-screen-profile index 28676b5b..4bc0a7aa 100755 --- a/select-screen-profile +++ b/select-screen-profile @@ -1,10 +1,11 @@ #!/bin/sh -PROFILE_DIR="/usr/share/screen-profiles/profiles" +BASE_DIR="/usr/share/screen-profiles" +PROFILE_DIR="$BASE_DIR/profiles" -if [ -e "$HOME/.screenrc" ]; then - if [ ! -L "$HOME/.screenrc" ]; then - echo `gettext 'Error:'` $HOME/.screenrc `gettext 'exists, but is not a symlink'` +if [ -e "$HOME/.screenrc-profile" ]; then + if [ ! -L "$HOME/.screenrc-profile" ]; then + echo `gettext 'Error:'` $HOME/.screenrc-profile `gettext 'exists, but is not a symlink'` exit 1 fi fi @@ -40,7 +41,16 @@ i=0 for x in $profiles; do i=`expr $i + 1` if [ $i -eq $selected ]; then - rm -f "$HOME/.screenrc" && ln -s "$PROFILE_DIR/$x" "$HOME/.screenrc" + # avoid overriding a user's existing .screenrc + if [ ! -e "$HOME/.screenrc" ]; then + cp "$BASE_DIR/base-screenrc" "$HOME/.screenrc" && \ + chown "$USER" "$HOME/.screenrc" + else + echo "You already have a ~/.screenrc file. Make sure that it contains" + echo "a line with 'source ~/.screenrc-profile' to make use of you new" + echo "profile." + fi + rm -f "$HOME/.screenrc-profile" && ln -s "$PROFILE_DIR/$x" "$HOME/.screenrc-profile" fi done