File: //snap/network-manager/current/bin/snap-prop.sh
#!/bin/sh -ex
# Copyright (C) 2016-2018 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Getters for snap properties. They write the current value to stdout.
# Generic one, that sets no defaults
# $1: property name
get_property() {
snapctl get "$1"
}
get_wifi_powersave() {
value=$(snapctl get wifi.powersave) || true
if [ -z "$value" ]; then
value=disabled
fi
echo "$value"
}
get_wifi_wake_on_wlan() {
value=$(snapctl get wifi.wake-on-wlan) || true
if [ -z "$value" ]; then
value=disabled
fi
echo "$value"
}
get_wifi_wake_on_password() {
snapctl get wifi.wake-on-wlan-password || true
}
get_debug_enable() {
value=$(snapctl get debug.enable) || true
if [ -z "$value" ]; then
value=false
fi
echo "$value"
}
get_defaultrenderer() {
value=$(snapctl get defaultrenderer) || true
if [ -z "$value" ]; then
value=true
fi
echo "$value"
}
get_plugins() {
value=$(snapctl get plugins) || true
if [ -z "$value" ] || [ "$value" = "netplan" ]; then
value="keyfile"
fi
echo "$value"
}