summaryrefslogtreecommitdiffstats
path: root/config.d/05diskimage_guestmount.defconf
diff options
context:
space:
mode:
Diffstat (limited to 'config.d/05diskimage_guestmount.defconf')
-rw-r--r--config.d/05diskimage_guestmount.defconf150
1 files changed, 0 insertions, 150 deletions
diff --git a/config.d/05diskimage_guestmount.defconf b/config.d/05diskimage_guestmount.defconf
deleted file mode 100644
index 4c17575..0000000
--- a/config.d/05diskimage_guestmount.defconf
+++ /dev/null
@@ -1,150 +0,0 @@
-# Hey Emacs, this is a -*- shell-script -*- !!!
-
-# This file provides functions to implement access/update of disk
-# images via guestmount.
-
-######################################################################
-
-diskimage_mount_guestmount ()
-{
- local disk="$1"
-
- echo "Using guestmount to update disk image ${disk}..."
-
- local mount_args=""
- local m d
- for m in $SYSTEM_DISK_MOUNTS ; do
- d="${m#*:}" # Device is after colon
- m="${m%:*}" # Mountpoint is before colon
- mount_args="${mount_args}${mount_args:+ } --mount ${d}:${m}"
- echo " mount ${m} from device ${d} configured"
- done
- [ -n "$mount_args" ] || mount_args="-i"
-
- mkdir -p mnt
- guestmount -a "$disk" $mount_args mnt || \
- die "Failed to mount $disk using guestmount"
-
-
- [ -d "mnt/root" ] || {
- echo "Mounted directory does not look like a root filesystem"
- ls -latr mnt
- exit 1
- }
-}
-
-# unmount a qemu image
-diskimage_unmount_guestmount ()
-{
- echo "Unmounting disk"
- sync; sync;
-
- fusermount -u mnt
-}
-
-# These are all the same as loopback. We could do something cleverer,
-# but this will suffice for now.
-
-diskimage_mkdir_p_guestmount ()
-{
- mkdir -p "mnt$1"
-}
-
-diskimage_substitute_vars_guestmount ()
-{
- substitute_vars "$1" "mnt$2"
-}
-
-diskimage_chmod_guestmount ()
-{
- local mode="$1" ; shift
- local i
- for i ; do
- # this should handle wildcards
- eval chmod "$mode" "mnt$i"
- done
-}
-
-diskimage_chmod_reference_guestmount ()
-{
- local ref="$1" ; shift
- local i
- for i ; do
- # this should handle wildcards
- eval chmod --reference="$ref" "mnt$i"
- done
-}
-
-diskimage_is_file_guestmount ()
-{
- [ -f "mnt$1" ]
-}
-
-diskimage_is_directory_guestmount ()
-{
- [ -d "mnt$1" ]
-}
-
-diskimage_append_text_file_guestmount ()
-{
- cat "$1" >> "mnt$2"
-}
-
-diskimage_append_text_guestmount ()
-{
- echo "$1" >> "mnt$2"
-}
-
-diskimage_sed_guestmount ()
-{
- local file="$1" ; shift
- sed -i.org "$@" "mnt$file"
-}
-
-diskimage_grep_guestmount ()
-{
- local file="$1" ; shift
- grep "$@" "mnt$file"
-}
-
-diskimage_put_guestmount ()
-{
- if [ "$1" = "-" ] ; then
- cat >"mnt$2"
- else
- cp "$1" "mnt$2"
- fi
-}
-
-diskimage_ln_s_guestmount ()
-{
- ln -s "$1" "mnt$2"
-}
-
-diskimage_command_guestmount ()
-{
- chroot mnt "$@"
-}
-
-diskimage_mv_guestmount ()
-{
- mv "mnt$1" "mnt$2"
-}
-
-diskimage_rm_rf_guestmount ()
-{
- rm -rf "mnt$1"
-}
-
-######################################################################
-
-diskimage_guestmount_sanity_check ()
-{
- if [ "$SYSTEM_DISK_FORMAT" = "qcow2" -a \
- "$SYSTEM_DISK_ACCESS_METHOD" = "guestmount" ] ; then
- check_command guestmount
- check_command fusermount
- fi
-}
-
-register_hook post_config_hooks diskimage_guestmount_sanity_check