cleanup, remove unused/useless post_install parameter

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2013-09-17 21:35:00 +02:00
parent a035b52a0d
commit f67cdc8afa
5 changed files with 4 additions and 62 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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. # This file is part of cdist.
# #
@ -29,33 +29,15 @@ if [ "\$__debug" != "yes" ]; then
fi fi
DONE DONE
uri="$(cat "$__object/parameter/uri")" uri="$(cat "$__object/parameter/uri" 2>/dev/null \
|| echo "$__object_id")"
target="$(cat "$__object/parameter/target")" 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" ] && curl="curl" || curl="curl -s"
[ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp" [ "$__debug" = "yes" ] && tar="tar -xvzp" || tar="tar -xzp"
echo "$curl '$uri' | $tar -C '$target'" 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 cat << DONE
if [ "\$__debug" != "yes" ]; then if [ "\$__debug" != "yes" ]; then

View file

@ -29,10 +29,6 @@ OPTIONAL PARAMETERS
target:: target::
where to unpack the tarball to. Defaults to /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 EXAMPLES
-------- --------
@ -41,9 +37,6 @@ EXAMPLES
__install_stage --uri tftp:///path/to/stage.tgz __install_stage --uri tftp:///path/to/stage.tgz
__install_stage --uri http://path/to/stage.tgz --target /mnt/foobar __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
__install_stage --uri file:///path/to/stage.tgz \
--target /target \
--post_install /path/to/file/on/server
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View file

@ -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

View file

@ -0,0 +1 @@
/target

View file

@ -1,2 +1 @@
target target
post_install