diff --git a/cdist/conf/type/__chroot_mount/gencode-local b/cdist/conf/type/__chroot_mount/gencode-local
new file mode 100755
index 00000000..a2e1f423
--- /dev/null
+++ b/cdist/conf/type/__chroot_mount/gencode-local
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# 2016 Steven Armstrong (steven-cdist at armstrong.cc)
+#
+# This file is part of cdist.
+#
+# cdist 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 3 of the License, or
+# (at your option) any later version.
+#
+# cdist 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 cdist. If not, see .
+#
+
+chroot="/$__object_id"
+
+if [ -f "$__object/parameter/manage-resolv-conf" ]; then
+ resolv_conf="${chroot}/etc/resolv.conf"
+ original_resolv_conf="${resolv_conf}${__cdist_object_marker}"
+ cat << DONE
+$__remote_exec $__target_host << EOSSH
+if [ -f "${resolv_conf}" ]; then
+ mv "${resolv_conf}" "${original_resolv_conf}"
+fi
+# copy hosts resolv.conf into chroot
+cp /etc/resolv.conf "${resolv_conf}"
+EOSSH
+DONE
+fi
diff --git a/cdist/conf/type/__chroot_mount/man.rst b/cdist/conf/type/__chroot_mount/man.rst
index 0d7cdce3..a44b70ba 100644
--- a/cdist/conf/type/__chroot_mount/man.rst
+++ b/cdist/conf/type/__chroot_mount/man.rst
@@ -1,5 +1,5 @@
cdist-type__chroot_mount(7)
-===================================
+===========================
NAME
----
@@ -21,6 +21,12 @@ OPTIONAL PARAMETERS
None
+BOOLEAN PARAMETERS
+------------------
+manage-resolv-conf
+ manage /etc/resolv.conf inside the chroot
+
+
EXAMPLES
--------
@@ -36,7 +42,7 @@ Steven Armstrong
COPYING
-------
-Copyright \(C) 2012 Steven Armstrong. You can redistribute it
+Copyright \(C) 2012-2017 Steven Armstrong. 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 3 of the
License, or (at your option) any later version.
diff --git a/cdist/conf/type/__chroot_mount/parameter/boolean b/cdist/conf/type/__chroot_mount/parameter/boolean
new file mode 100644
index 00000000..27928f2c
--- /dev/null
+++ b/cdist/conf/type/__chroot_mount/parameter/boolean
@@ -0,0 +1 @@
+manage-resolv-conf
diff --git a/cdist/conf/type/__chroot_umount/gencode-local b/cdist/conf/type/__chroot_umount/gencode-local
new file mode 100755
index 00000000..97f126a5
--- /dev/null
+++ b/cdist/conf/type/__chroot_umount/gencode-local
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# 2016 Steven Armstrong (steven-cdist at armstrong.cc)
+#
+# This file is part of cdist.
+#
+# cdist 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 3 of the License, or
+# (at your option) any later version.
+#
+# cdist 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 cdist. If not, see .
+#
+
+chroot="/$__object_id"
+
+if [ -f "$__object/parameter/manage-resolv-conf" ]; then
+ resolv_conf="${chroot}/etc/resolv.conf"
+ original_resolv_conf="${resolv_conf}${__cdist_object_marker}"
+cat << DONE
+$__remote_exec $__target_host << EOSSH
+if [ -f "${original_resolv_conf}" ]; then
+ # restore original /etc/resolv.conf that we moved out of the way
+ # in __chroot_mount/gencode-local
+ mv -f "${original_resolv_conf}" "${resolv_conf}"
+fi
+EOSSH
+DONE
+fi
diff --git a/cdist/conf/type/__chroot_umount/man.rst b/cdist/conf/type/__chroot_umount/man.rst
index ff116da5..349cc2e0 100644
--- a/cdist/conf/type/__chroot_umount/man.rst
+++ b/cdist/conf/type/__chroot_umount/man.rst
@@ -21,6 +21,12 @@ OPTIONAL PARAMETERS
None
+BOOLEAN PARAMETERS
+------------------
+manage-resolv-conf
+ manage /etc/resolv.conf inside the chroot
+
+
EXAMPLES
--------
@@ -41,7 +47,7 @@ Steven Armstrong
COPYING
-------
-Copyright \(C) 2012 Steven Armstrong. You can redistribute it
+Copyright \(C) 2012-2017 Steven Armstrong. 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 3 of the
License, or (at your option) any later version.
diff --git a/cdist/conf/type/__chroot_umount/parameter/boolean b/cdist/conf/type/__chroot_umount/parameter/boolean
new file mode 100644
index 00000000..27928f2c
--- /dev/null
+++ b/cdist/conf/type/__chroot_umount/parameter/boolean
@@ -0,0 +1 @@
+manage-resolv-conf
diff --git a/cdist/conf/type/__install_chroot_mount/parameter b/cdist/conf/type/__install_chroot_mount/parameter
new file mode 120000
index 00000000..5b5c9e20
--- /dev/null
+++ b/cdist/conf/type/__install_chroot_mount/parameter
@@ -0,0 +1 @@
+../__chroot_mount/parameter
\ No newline at end of file
diff --git a/cdist/conf/type/__install_chroot_umount/parameter b/cdist/conf/type/__install_chroot_umount/parameter
new file mode 120000
index 00000000..4148bcd0
--- /dev/null
+++ b/cdist/conf/type/__install_chroot_umount/parameter
@@ -0,0 +1 @@
+../__chroot_umount/parameter
\ No newline at end of file
diff --git a/cdist/conf/type/__install_config/gencode-local b/cdist/conf/type/__install_config/gencode-local
index 980eb996..30434d1b 100755
--- a/cdist/conf/type/__install_config/gencode-local
+++ b/cdist/conf/type/__install_config/gencode-local
@@ -25,17 +25,6 @@ remote_copy="$__type/files/remote/copy"
cdist_args="-v"
[ "$__debug" = "yes" ] && cdist_args="$cdist_args -d"
-
-cat << DONE
-
-$__remote_exec $__target_host << EOSSH
-if [ ! -f "${chroot}/etc/resolv.conf" ]; then
- touch "${chroot}/etc/resolv.conf"
-fi
-mount --bind -o ro /etc/resolv.conf "${chroot}/etc/resolv.conf"
-EOSSH
-DONE
-
cat << DONE
cdist $cdist_args \
config \
@@ -44,15 +33,3 @@ cdist $cdist_args \
$__target_host
DONE
-cat << DONE
-$__remote_exec $__target_host << EOSSH
-if mountpoint -q "${chroot}/etc/resolv.conf"; then
- umount "${chroot}/etc/resolv.conf"
-fi
-if [ -f "${chroot}/etc/resolv.conf" -a ! -s "${chroot}/etc/resolv.conf" ]; then
- # file exists but is empty which means we created it or it's useless anyway
- rm "${chroot}/etc/resolv.conf"
-fi
-
-EOSSH
-DONE
diff --git a/cdist/conf/type/__install_partition_msdos/man.rst b/cdist/conf/type/__install_partition_msdos/man.rst
index 5ebb9218..aa194110 100644
--- a/cdist/conf/type/__install_partition_msdos/man.rst
+++ b/cdist/conf/type/__install_partition_msdos/man.rst
@@ -49,6 +49,8 @@ EXAMPLES
__install_partition_msdos /dev/sda6 --type 83 --size 50%
# rest of the extended partition, linux
__install_partition_msdos /dev/sda7 --type 83 --size +
+ # nvm device partition 2
+ __install_partition_msdos /dev/nvme0n1p2 --device /dev/nvme0n1 --minor 2 --type 83 --size 128M --bootable true
AUTHORS
@@ -58,7 +60,7 @@ Steven Armstrong
COPYING
-------
-Copyright \(C) 2011 Steven Armstrong. You can redistribute it
+Copyright \(C) 2011-2017 Steven Armstrong. 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 3 of the
License, or (at your option) any later version.
diff --git a/cdist/conf/type/__install_partition_msdos/manifest b/cdist/conf/type/__install_partition_msdos/manifest
index e55d3f24..636fbd6a 100755
--- a/cdist/conf/type/__install_partition_msdos/manifest
+++ b/cdist/conf/type/__install_partition_msdos/manifest
@@ -25,10 +25,15 @@ else
partition="/$__object_id"
echo "$partition" > "$__object/parameter/partition"
fi
-device="$(echo "$partition" | sed 's/[0-9]//g')"
-echo "$device" > "$__object/parameter/device"
-minor="$(echo "$partition" | sed 's/[^0-9]//g')"
-echo "$minor" > "$__object/parameter/minor"
+
+if [ ! -f "$__object/parameter/device" ]; then
+ device="$(echo "$partition" | sed 's/[0-9]//g')"
+ echo "$device" > "$__object/parameter/device"
+fi
+if [ ! -f "$__object/parameter/minor" ]; then
+ minor="$(echo "$partition" | sed 's/[^0-9]//g')"
+ echo "$minor" > "$__object/parameter/minor"
+fi
if [ ! -f "$__object/parameter/bootable" ]; then
echo "false" > "$__object/parameter/bootable"
diff --git a/cdist/conf/type/__install_partition_msdos/parameter/optional b/cdist/conf/type/__install_partition_msdos/parameter/optional
index b2b0a4c2..3b3f2083 100644
--- a/cdist/conf/type/__install_partition_msdos/parameter/optional
+++ b/cdist/conf/type/__install_partition_msdos/parameter/optional
@@ -1,3 +1,5 @@
+device
+minor
partition
bootable
size
diff --git a/cdist/conf/type/__install_partition_msdos_apply/gencode-remote b/cdist/conf/type/__install_partition_msdos_apply/gencode-remote
index e9ec588b..60f2fd1e 100755
--- a/cdist/conf/type/__install_partition_msdos_apply/gencode-remote
+++ b/cdist/conf/type/__install_partition_msdos_apply/gencode-remote
@@ -18,6 +18,8 @@
# along with cdist. If not, see .
#
+#set -x
+
die() {
echo "[__install_partition_msdos_apply] $@" >&2
exit 1