From: Timo Bingmann Date: Sun, 20 Jul 2014 11:14:05 +0000 (+0200) Subject: Print error when profile does not exist and fixing use of IS_VIRTUAL_PROFILE. X-Git-Tag: 1.0~131^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=899c841c1174a0bf522e8b8b1795381584e6010f;p=deb_pkgs%2Fautorandr.git Print error when profile does not exist and fixing use of IS_VIRTUAL_PROFILE. --- diff --git a/autorandr b/autorandr index e507515..22e61ed 100755 --- 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"