From 10abe514b8fb7e6d3ce3587a55773a21e78ce9e6 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Thu, 11 Jun 2020 21:27:53 +0200 Subject: [PATCH] [type/__hostname] Add support for OpenWrt --- cdist/conf/type/__hostname/gencode-remote | 3 +++ cdist/conf/type/__hostname/manifest | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/cdist/conf/type/__hostname/gencode-remote b/cdist/conf/type/__hostname/gencode-remote index ae224611..02afcbfb 100755 --- a/cdist/conf/type/__hostname/gencode-remote +++ b/cdist/conf/type/__hostname/gencode-remote @@ -69,6 +69,9 @@ in centos|fedora|redhat|scientific|freebsd|netbsd|openbsd|gentoo|void) echo "hostname '$name_should'" ;; + openwrt) + echo "echo '$name_should' >/proc/sys/kernel/hostname" + ;; macosx) echo "scutil --set HostName '$name_should'" ;; diff --git a/cdist/conf/type/__hostname/manifest b/cdist/conf/type/__hostname/manifest index e1e356a0..bf8a331c 100755 --- a/cdist/conf/type/__hostname/manifest +++ b/cdist/conf/type/__hostname/manifest @@ -149,6 +149,10 @@ in openbsd) echo "$name_should" | __file /etc/myname --source - ;; + openwrt) + __uci system.@system[0].hostname --value "$name_should" + # --transaction hostname + ;; slackware) # We write the FQDN into /etc/HOSTNAME. But /etc/rc.d/rc.M will only # read the first component from this file and set it as the running