From f67cdc8afa0f898986ddd628dccbf0255f0b9a85 Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Tue, 17 Sep 2013 21:35:00 +0200
Subject: [PATCH] cleanup, remove unused/useless post_install parameter

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 .../conf/type/__install_stage/gencode-remote  | 24 ++------------
 cdist/conf/type/__install_stage/man.text      |  7 ----
 cdist/conf/type/__install_stage/manifest      | 33 -------------------
 .../__install_stage/parameter/default/target  |  1 +
 .../type/__install_stage/parameter/optional   |  1 -
 5 files changed, 4 insertions(+), 62 deletions(-)
 delete mode 100755 cdist/conf/type/__install_stage/manifest
 create mode 100644 cdist/conf/type/__install_stage/parameter/default/target

diff --git a/cdist/conf/type/__install_stage/gencode-remote b/cdist/conf/type/__install_stage/gencode-remote
index 17eeda0d..12b9f1ed 100755
--- a/cdist/conf/type/__install_stage/gencode-remote
+++ b/cdist/conf/type/__install_stage/gencode-remote
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# 2011 Steven Armstrong (steven-cdist at armstrong.cc)
+# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc)
 #
 # This file is part of cdist.
 #
@@ -29,33 +29,15 @@ if [ "\$__debug" != "yes" ]; then
 fi
 DONE
 
-uri="$(cat "$__object/parameter/uri")"
+uri="$(cat "$__object/parameter/uri" 2>/dev/null \
+   || echo "$__object_id")"
 target="$(cat "$__object/parameter/target")"
-post_install="$(cat "$__object/parameter/post_install" 2>/dev/null || true)"
 
 
 [ "$__debug" = "yes" ] && curl="curl" || curl="curl -s"
 [ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp"
 
 echo "$curl '$uri' | $tar -C '$target'"
-if [ -n "$post_install" ]; then
-   post_install_script="$(cat "$__object/parameter/post_install_script")"
-   cat << DONE
-[ -d "${target}/proc" ] || mkdir "${target}/proc"
-mount -t proc none "${target}/proc"
-[ -d "${target}/sys" ] || mkdir "${target}/sys"
-mount -t sysfs none "${target}/sys"
-[ -d "${target}/dev" ] || mkdir "${target}/dev"
-mount --rbind /dev "${target}/dev"
-[ -d "${target}/tmp" ] || mkdir -m 1777 "${target}/tmp"
-mount -t tmpfs none "${target}/tmp"
-cp "$post_install_script" "${target}/tmp/post_install"
-chmod +x "${target}/tmp/post_install"
-cp /etc/resolv.conf "${target}/etc/"
-chroot "$target" /tmp/post_install
-umount -l "${target}/tmp" "${target}/dev" "${target}/sys" "${target}/proc"
-DONE
-fi
 
 cat << DONE
 if [ "\$__debug" != "yes" ]; then
diff --git a/cdist/conf/type/__install_stage/man.text b/cdist/conf/type/__install_stage/man.text
index 0e657fdc..7abc77e8 100644
--- a/cdist/conf/type/__install_stage/man.text
+++ b/cdist/conf/type/__install_stage/man.text
@@ -29,10 +29,6 @@ OPTIONAL PARAMETERS
 target::
    where to unpack the tarball to. Defaults to /target.
 
-post_install::
-   path to an optional local script. The script is uploaded to the target and 
-   executed inside (chroot) the target after the stage has been unpacked.
-
 
 EXAMPLES
 --------
@@ -41,9 +37,6 @@ EXAMPLES
 __install_stage --uri tftp:///path/to/stage.tgz
 __install_stage --uri http://path/to/stage.tgz --target /mnt/foobar
 __install_stage --uri file:///path/to/stage.tgz --target /target
-__install_stage --uri file:///path/to/stage.tgz \
-   --target /target \
-   --post_install /path/to/file/on/server
 --------------------------------------------------------------------------------
 
 
diff --git a/cdist/conf/type/__install_stage/manifest b/cdist/conf/type/__install_stage/manifest
deleted file mode 100755
index ab5f4d79..00000000
--- a/cdist/conf/type/__install_stage/manifest
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-#
-# 2011 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 <http://www.gnu.org/licenses/>.
-#
-
-# set defaults
-uri="$(cat "$__object/parameter/uri" 2>/dev/null \
-   || echo "$__object_id" | tee "$__object/parameter/uri")"
-target="$(cat "$__object/parameter/target" 2>/dev/null \
-   || echo "/target" | tee "$__object/parameter/target")"
-
-if [ -f "$__object/parameter/post_install" ]; then
-   post_install="$(cat "$__object/parameter/post_install")"
-   post_install_script="/tmp/post_install"
-   __install_file $post_install_script --source $post_install
-   echo "$post_install_script" > "$__object/parameter/post_install_script"
-fi
-
diff --git a/cdist/conf/type/__install_stage/parameter/default/target b/cdist/conf/type/__install_stage/parameter/default/target
new file mode 100644
index 00000000..ea8c4bf7
--- /dev/null
+++ b/cdist/conf/type/__install_stage/parameter/default/target
@@ -0,0 +1 @@
+/target
diff --git a/cdist/conf/type/__install_stage/parameter/optional b/cdist/conf/type/__install_stage/parameter/optional
index 8e1a11b5..eb5a316c 100644
--- a/cdist/conf/type/__install_stage/parameter/optional
+++ b/cdist/conf/type/__install_stage/parameter/optional
@@ -1,2 +1 @@
 target
-post_install