Use sudo for terminal DNS changes and drop needless command checks
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
fedf12c43c
commit
f12abbdebb
+4
-11
@@ -37,12 +37,11 @@ require_root() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if omarchy-cmd-missing pkexec; then
|
if [[ -t 0 ]]; then
|
||||||
echo "Error: pkexec is required to change DNS settings." >&2
|
exec sudo "$(self_path)" "$@"
|
||||||
exit 1
|
else
|
||||||
|
exec pkexec "$(self_path)" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec pkexec "$(self_path)" "$@"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
networkmanager_global_dns() {
|
networkmanager_global_dns() {
|
||||||
@@ -150,8 +149,6 @@ set_connection_dns() {
|
|||||||
local ipv4_dns="${1:-}"
|
local ipv4_dns="${1:-}"
|
||||||
local ipv6_dns="${2:-}"
|
local ipv6_dns="${2:-}"
|
||||||
|
|
||||||
omarchy-cmd-present nmcli || return 0
|
|
||||||
|
|
||||||
while IFS=: read -r uuid type; do
|
while IFS=: read -r uuid type; do
|
||||||
[[ -n $uuid ]] || continue
|
[[ -n $uuid ]] || continue
|
||||||
networkmanager_dns_connection "$type" || continue
|
networkmanager_dns_connection "$type" || continue
|
||||||
@@ -168,8 +165,6 @@ set_connection_dns() {
|
|||||||
clear_connection_dns() {
|
clear_connection_dns() {
|
||||||
local uuid type
|
local uuid type
|
||||||
|
|
||||||
omarchy-cmd-present nmcli || return 0
|
|
||||||
|
|
||||||
while IFS=: read -r uuid type; do
|
while IFS=: read -r uuid type; do
|
||||||
[[ -n $uuid ]] || continue
|
[[ -n $uuid ]] || continue
|
||||||
networkmanager_dns_connection "$type" || continue
|
networkmanager_dns_connection "$type" || continue
|
||||||
@@ -186,8 +181,6 @@ clear_connection_dns() {
|
|||||||
reapply_active_dns_connections() {
|
reapply_active_dns_connections() {
|
||||||
local device type state
|
local device type state
|
||||||
|
|
||||||
omarchy-cmd-present nmcli || return 0
|
|
||||||
|
|
||||||
while IFS=: read -r device type state; do
|
while IFS=: read -r device type state; do
|
||||||
[[ -n $device && $state == connected ]] || continue
|
[[ -n $device && $state == connected ]] || continue
|
||||||
case "$type" in
|
case "$type" in
|
||||||
|
|||||||
Reference in New Issue
Block a user