From 83aaa105e96b44239cad894d7dd1d4eee482b0c2 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Tue, 21 Apr 2009 14:43:46 -0500 Subject: [PATCH] Drop the distro name in generated profiles * debian/install: fix installation of profiles * debian/rules: don't create the ubuntu profile symlink * debian/screen-profiles-extras.install: no longer need to install the distro-specific profiles * profiles/generate: generate profiles which do not have ubuntu- prepended * select-screen-profile: remove the ubuntu specific profile handling * screen: fix broken symlinks to ubuntu-* profiles -- Dustin Kirkland Tue, 21 Apr 2009 14:40:16 -0500 --- debian/changelog | 12 ++++++-- debian/install | 6 ++-- debian/rules | 1 - debian/screen-profiles-extras.install | 4 +-- profiles/generate | 42 ++++++++++++--------------- screen | 22 ++++++++++++-- select-screen-profile | 15 ++++------ 7 files changed, 58 insertions(+), 44 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ed13bcd..dcceba6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,16 @@ screen-profiles (1.48) unreleased; urgency=low - * UNRELEASED + Drop the distro name in generated profiles + * debian/install: fix installation of profiles + * debian/rules: don't create the ubuntu profile symlink + * debian/screen-profiles-extras.install: no longer need to install + the distro-specific profiles + * profiles/generate: generate profiles which do not have ubuntu- + prepended + * select-screen-profile: remove the ubuntu specific profile handling + * screen: fix broken symlinks to ubuntu-* profiles - -- Dustin Kirkland Sat, 18 Apr 2009 16:13:00 -0500 + -- Dustin Kirkland Tue, 21 Apr 2009 14:40:16 -0500 screen-profiles (1.47-0ubuntu1) jaunty; urgency=low diff --git a/debian/install b/debian/install index 4f797837..b32c2fd6 100644 --- a/debian/install +++ b/debian/install @@ -2,9 +2,9 @@ bin/* var/lib/screen-profiles po/locale/* usr/share/locale profiles/common usr/share/screen-profiles/profiles profiles/plain usr/share/screen-profiles/profiles -profiles/ubuntu-black usr/share/screen-profiles/profiles -profiles/ubuntu-dark usr/share/screen-profiles/profiles -profiles/ubuntu-light usr/share/screen-profiles/profiles +profiles/black usr/share/screen-profiles/profiles +profiles/dark usr/share/screen-profiles/profiles +profiles/light usr/share/screen-profiles/profiles keybindings/common usr/share/screen-profiles/keybindings keybindings/none usr/share/screen-profiles/keybindings windows/common usr/share/screen-profiles/windows diff --git a/debian/rules b/debian/rules index 8c903773..68f10ee9 100755 --- a/debian/rules +++ b/debian/rules @@ -62,7 +62,6 @@ binary-indep: build install dh_installdebconf -i dh_compress -i dh_fixperms -i - dh_link -i /usr/share/${PACKAGE}/profiles/ubuntu-light usr/share/${PACKAGE}/profiles/ubuntu dh_installdeb -i dh_gencontrol -i dh_md5sums -i diff --git a/debian/screen-profiles-extras.install b/debian/screen-profiles-extras.install index 5a68cef5..d64031f9 100644 --- a/debian/screen-profiles-extras.install +++ b/debian/screen-profiles-extras.install @@ -1,3 +1 @@ -profiles/ubuntu-*_* usr/share/screen-profiles/profiles -profiles/*-* usr/share/screen-profiles/profiles/misc - +profiles/*_* usr/share/screen-profiles/profiles diff --git a/profiles/generate b/profiles/generate index 71919af8..93ba307a 100755 --- a/profiles/generate +++ b/profiles/generate @@ -19,28 +19,24 @@ # This script should be run during in the './debian/rules get-orig-source' # step. -DISTROS="ubuntu" - -for i in $DISTROS; do - rm -f profiles/$i* - if [ "$1" = "--clean" ]; then - echo "Removing profiles for: $i" - continue +rm -f profiles/light profiles/dark profiles/black profiles/*_* +if [ "$1" = "--clean" ]; then + echo "Removing generated profiles" + exit 0 +fi +echo "Generating profiles" +cat profiles/profile.skel > profiles/light +cp profiles/light profiles/dark +sed -i "s/ Wk/ Kw/g" profiles/dark +sed -i "s/kW/wK/g" profiles/dark +for j in "B-light_blue" "b-dark_blue" "C-light_cyan" "c-dark_cyan" "G-light_green" "g-dark_green" "M-light_purple" "m-dark_purple" "R-light_red" "r-dark_red" "Y-light_yellow" "y-dark_yellow" "k-black"; do + x=$(echo "$j" | awk -F"-" '{print $1}') + desc=$(echo "$j" | awk -F"-" '{print $2}') + y="w" + if echo "$desc" | grep -qs "light"; then + y="k" fi - echo "Generating profiles for: $i" - cat profiles/profile.skel > profiles/$i-light - cp profiles/$i-light profiles/$i-dark - sed -i "s/ Wk/ Kw/g" profiles/$i-dark - sed -i "s/kW/wK/g" profiles/$i-dark - for j in "B-light_blue" "b-dark_blue" "C-light_cyan" "c-dark_cyan" "G-light_green" "g-dark_green" "M-light_purple" "m-dark_purple" "R-light_red" "r-dark_red" "Y-light_yellow" "y-dark_yellow" "k-black"; do - x=$(echo "$j" | awk -F"-" '{print $1}') - desc=$(echo "$j" | awk -F"-" '{print $2}') - y="w" - if echo "$desc" | grep -qs "light"; then - y="k" - fi - cp profiles/$i-light profiles/$i-$desc - sed -i "s/ Wk/ $x$y/g" profiles/$i-$desc - sed -i "s/kW/$y$x/g" profiles/$i-$desc - done + cp profiles/light profiles/$desc + sed -i "s/ Wk/ $x$y/g" profiles/$desc + sed -i "s/kW/$y$x/g" profiles/$desc done diff --git a/screen b/screen index 277b5b78..61acb8e3 100755 --- a/screen +++ b/screen @@ -29,8 +29,26 @@ if [ -r "$HOME/.screenrc" -a ! -e "$HOME/.screen-profiles/profile" -a ! -h "$HOM fi # Ensure that the user has selected a screen profile -[ -h "$HOME/.screen-profiles/profile" ] || /usr/bin/select-screen-profile -if [ ! -r "$HOME/.screen-profiles/profile" ]; then +profile="$HOME/.screen-profiles/profile" +[ -h "$profile" ] || /usr/bin/select-screen-profile + +# Previously, profiles were prepended with ubuntu-. +# This is no longer the case, for cross-distro compatibility. +# Try to fix broken symlinks for upgrading users, or prompt to reselect. +if [ -h "$profile" -a ! -r "$profile" ]; then + if stat "$profile" | head -n1 | grep -qs ".*->.*ubuntu\-.*"; then + newsrc=$(stat "$profile" | head -n1 | sed "s/.*\`//" | sed "s/'.*//" | sed "s/ubuntu-//") + if [ -r "$newsrc" ]; then + ln -sf "$newsrc" "$profile" + else + /usr/bin/select-screen-profile + fi + else + /usr/bin/select-screen-profile + fi +fi + +if [ ! -r "$profile" ]; then echo echo "Your selected profile is not accessible." echo diff --git a/select-screen-profile b/select-screen-profile index db805e8f..d97c1120 100755 --- a/select-screen-profile +++ b/select-screen-profile @@ -58,19 +58,16 @@ listprofiles() { # Display list of profiles, one per line # Start with basic profiles basename $(ls $PROFILE_DIR/plain 2>/dev/null) 2>/dev/null - basename $(ls $PROFILE_DIR/*-light 2>/dev/null) 2>/dev/null - basename $(ls $PROFILE_DIR/*-dark 2>/dev/null) 2>/dev/null - basename $(ls $PROFILE_DIR/*-black 2>/dev/null) 2>/dev/null + basename $(ls $PROFILE_DIR/light 2>/dev/null) 2>/dev/null + basename $(ls $PROFILE_DIR/dark 2>/dev/null) 2>/dev/null + basename $(ls $PROFILE_DIR/black 2>/dev/null) 2>/dev/null # Now, list advanced profiles - for x in $(ls $PROFILE_DIR/*-*_* 2>/dev/null); do + for x in $(ls $PROFILE_DIR/*_* 2>/dev/null); do x=$(basename "$x") if [ $x = "common" -o $x = "misc" ]; then # Skip the common profile, no value there continue fi - if [ $x = "ubuntu" -a -r "$PROFILE_DIR/ubuntu-light" ]; then - continue - fi echo "$x" done } @@ -84,9 +81,7 @@ prompt() { for x in $profiles; do i=$(expr $i + 1) desc=" " - if [ "$x" = "ubuntu" ]; then - desc="-light\t" - elif [ "$x" = "plain" ]; then + if [ "$x" = "plain" ]; then simple=$i fi [ $i -lt 10 ] && i=" $i"