Allow local modification of .screenrc (LP: #308216)

This commit is contained in:
Nick Barcet 2008-12-15 18:20:43 +01:00
commit a7a529c273
4 changed files with 25 additions and 6 deletions

5
base-screenrc Normal file
View file

@ -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

5
debian/changelog vendored
View file

@ -1,5 +1,8 @@
screen-profiles (1.0) jaunty; urgency=low screen-profiles (1.0) jaunty; urgency=low
[ Dustin Kirklan ]
* Initial upload * Initial upload
[ Nicolas Barcet ]
* Allow local modification of .screenrc (LP: #308216)
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 14 Dec 2008 13:12:12 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 14 Dec 2008 13:12:12 -0600

1
debian/install vendored
View file

@ -5,3 +5,4 @@ bin/updates-available usr/share/screen-profiles/bin
profiles/debian.screenrc usr/share/screen-profiles/profiles profiles/debian.screenrc usr/share/screen-profiles/profiles
profiles/ubuntu.screenrc usr/share/screen-profiles/profiles profiles/ubuntu.screenrc usr/share/screen-profiles/profiles
select-screen-profile usr/bin select-screen-profile usr/bin
base-screenrc usr/share/screen-profiles

View file

@ -1,10 +1,11 @@
#!/bin/sh #!/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 [ -e "$HOME/.screenrc-profile" ]; then
if [ ! -L "$HOME/.screenrc" ]; then if [ ! -L "$HOME/.screenrc-profile" ]; then
echo `gettext 'Error:'` $HOME/.screenrc `gettext 'exists, but is not a symlink'` echo `gettext 'Error:'` $HOME/.screenrc-profile `gettext 'exists, but is not a symlink'`
exit 1 exit 1
fi fi
fi fi
@ -40,7 +41,16 @@ i=0
for x in $profiles; do for x in $profiles; do
i=`expr $i + 1` i=`expr $i + 1`
if [ $i -eq $selected ]; then 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 fi
done done