From e1eeda711c595ab97b4425792fccd0695d2b7e58 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Jul 2024 22:50:23 +0300 Subject: [PATCH] Added hyperv kvp guest services debian scripts --- Makefile | 6 ++++++ hv_get_dhcp_info.sh | 12 ++++++++++++ hv_get_dns_info.sh | 3 +++ 3 files changed, 21 insertions(+) create mode 100755 hv_get_dhcp_info.sh create mode 100755 hv_get_dns_info.sh diff --git a/Makefile b/Makefile index 01e4a10..e6ecafd 100644 --- a/Makefile +++ b/Makefile @@ -116,3 +116,9 @@ install-default-iptables-persistent-rules: cp -vf rules.v4 /etc/iptables/rules.v4 cp -vf rules.v6 /etc/iptables/rules.v6 +install-debain-hv-scripts: + mkdir -p /usr/libexec/hypervkvpd + cp -vf hv_get_dns_info.sh /usr/libexec/hypervkvpd/hv_get_dns_info + chmod +x /usr/libexec/hypervkvpd/hv_get_dns_info + cp -vf hv_get_dhcp_info.sh /usr/libexec/hypervkvpd/hv_get_dhcp_info + chmod +x /usr/libexec/hypervkvpd/hv_get_dhcp_info diff --git a/hv_get_dhcp_info.sh b/hv_get_dhcp_info.sh new file mode 100755 index 0000000..422602f --- /dev/null +++ b/hv_get_dhcp_info.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +INTERFACE_NAME="$1" + +dhcp=$(grep "iface ${INTERFACE_NAME} inet dhcp" /etc/network/interfaces 2>/dev/null) + +if [ "$dhcp" != "" ]; +then + echo "Enabled" +else + echo "Disabled" +fi diff --git a/hv_get_dns_info.sh b/hv_get_dns_info.sh new file mode 100755 index 0000000..4e2b7f7 --- /dev/null +++ b/hv_get_dns_info.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'