Hi all,

Here's a patch that allows installation of /etc/hosts as a link to
/run/hosts

This is useful when the root filesystem is mounted read only.
A similar option already exists for /etc/resolv.conf


--- orig/rules/rootfs.in 2013-09-09 15:59:23.000000000 +0200
+++ rules/rootfs.in 2014-05-06 19:20:28.795239261 +0200
@@ -342,13 +342,32 @@ config ROOTFS_ETC_HOSTNAME
  prompt "hostname"
  depends on ROOTFS_HOSTNAME

-config ROOTFS_HOSTS
- bool
+choice
  prompt "install /etc/hosts"
- help
-  If enabled, it installs the "./projectroot/etc/hosts" file if
-  present, else a generic one from the ptxdist directory.
+ default ROOTFS_HOSTS_FILE
+
+ config ROOTFS_HOSTS_FILE
+ bool
+ prompt "from file"
+ help
+  If enabled, it installs the "./projectroot/etc/hosts" file if
+  present, else a generic one from the ptxdist directory.

+ config ROOTFS_HOSTS_RUN
+ bool
+ prompt "link to /run/hosts"
+ help
+  If enabled, it installs /etc/hosts as a link to
+  /run/hosts. This is useful if the root filesystem is mounted
+  read-only.
+
+ config ROOTFS_HOSTS_NONE
+ bool
+ prompt "none"
+ help
+  If enabled, no /etc/hosts will be installed.
+endchoice
+
 config ROOTFS_ISSUE
  bool
  prompt "install /etc/issue"
@@ -419,7 +438,7 @@ choice
  bool
  prompt "none"
  help
-  If enabled, no /etc/resolv.conf will be install.
+  If enabled, no /etc/resolv.conf will be installed.
 endchoice



--- orig/rules/rootfs.make 2013-09-09 15:59:23.000000000 +0200
+++ rules/rootfs.make 2014-05-06 19:06:32.645238375 +0200
@@ -199,9 +199,12 @@ ifdef PTXCONF_ROOTFS_ISSUE
  `sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< $(PTXCONF_ROOTFS_ETC_HOSTNAME)`)
 endif

-ifdef PTXCONF_ROOTFS_HOSTS
+ifdef PTXCONF_ROOTFS_HOSTS_FILE
  @$(call install_alternative, rootfs, 0, 0, 0644, /etc/hosts)
 endif
+ifdef PTXCONF_ROOTFS_HOSTS_RUN
+ @$(call install_link, rootfs, /run/hosts, /etc/hosts)
+endif
 ifdef PTXCONF_ROOTFS_MODPROBE_CONF
  @$(call install_alternative, rootfs, 0, 0, 0644, /etc/modprobe.conf)
 endif



-- 
Guillermo Rodriguez Garcia
[email protected]

-- 
ptxdist mailing list
[email protected]

Reply via email to