]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commitdiff
Print error when profile does not exist and fixing use of IS_VIRTUAL_PROFILE.
authorTimo Bingmann <tbgit@panthema.net>
Sun, 20 Jul 2014 11:14:05 +0000 (13:14 +0200)
committerTimo Bingmann <tbgit@panthema.net>
Sun, 20 Jul 2014 11:18:44 +0000 (13:18 +0200)
autorandr

index e507515af0e5cf8658f46c38cf7e2b11bada3aef..22e61ed0aa2b887b471d455838826280a8e14a51 100755 (executable)
--- a/autorandr
+++ b/autorandr
@@ -307,7 +307,12 @@ load() {
        local PROFILE="$1"
        local CONF="$PROFILES/$PROFILE/config"
        local IS_VIRTUAL_PROFILE=`echo "$RESERVED_PROFILE_NAMES" | grep -c "^ $PROFILE "`
-       [ -f "$CONF" -o -n $IS_VIRTUAL_PROFILE ] || return 1
+
+       if [ ! -f "$CONF" -a $IS_VIRTUAL_PROFILE == 0 ]; then
+               echo " -> Error: Profile '$PROFILE' does not exist." >&2
+               return
+       fi
+
        if [ -x "$PROFILES/preswitch" ]; then
                "$PROFILES/preswitch" "$PROFILE"
        fi
@@ -317,7 +322,7 @@ load() {
 
        if [ -f "$CONF" ]; then
                echo " -> loading profile $PROFILE"
-               if [ -n $IS_VIRTUAL_PROFILE ]; then
+               if [ $IS_VIRTUAL_PROFILE != 0 ]; then
                        echo " -> Warning: Existing profile overrides virtual profile with same name" >&2
                fi
                $LOAD_METHOD "$CONF"