# sed -i "s,^\([^[[:space:]#]\+\)\([[:space:]]\+\)/\([[:space:]]\+\),${lstr}\2/\3," /etc/fstab
# This file is part of cloud-init. See LICENSE file for license information.
# This script is meant to "kvmify" an image. Its not meant to be
# terribly robust, or a good idea to ever run in a "real image".
# its' only intended method of invocation is from the kernel as 'init'
# in which case it will then invoke /sbin/init after it is done
# init=/path/to/kvmify-init
MARK=/var/lib/cloud/sem/uncloud-init.once
if [ -n "$ROOT_RW" ]; then
log "invoking /sbin/init $*"
log() { echo "::${0##*/}:" "$@"; }
[ -z "${UMOUNT}" ] || { umount "${UMOUNT}" && unset UMOUNT; }
[ -z "${RMDIR}" ] || { rm -Rf "${RMDIR}" && unset RMDIR; }
[ -z "${ROOT_RW}" ] || { mount -o remount,ro / ; unset ROOT_RW; }
[ "${fmt}" = "tar" -o "${fmt}" = "mnt" ] ||
{ log FAIL "unknown format ${fmt}"; return 1; }
log INFO "updating from ${dev} format ${fmt}"
[ ! -e "${dev}" -a -e "/dev/${dev}" ] && dev="/dev/${dev}"
[ -e "${dev}" ] || { echo "no file $dev"; return 2; }
mp=$(mktemp -d "${TEMPDIR:-/tmp}/update.XXXXXX") &&