-#----------------------------------------------------------------------
-# Useful functions.
-
-# erase_line filename regex
-#
-# Erase line(s) in a file that match the given regex.
-erase_line ()
-{
- guestfish --remote -- download "$1" "$tmpdir/file"
- sed "/$2/d" < "$tmpdir/file" > "$tmpdir/file.1"
- guestfish --remote -- upload "$tmpdir/file.1" "$1"
-}
-
-# rm_files wildcard
-#
-# Remove files. Doesn't fail if no files exist. Note the wildcard
-# parameter cannot contain spaces or characters that need special
-# quoting.
-rm_files ()
-{
- files=$(guestfish --remote -- glob-expand "$1")
- for f in $files; do
- guestfish --remote -- rm "$f"
- done
-}
-
-# rm_file filename
-#
-# Remove a single file. No error if the file doesn't exist or is not
-# a file.
-rm_file ()
-{
- t=$(guestfish --remote -- is-file "$1")
- if [ "$t" = "true" ]; then
- guestfish --remote -- rm "$1"
- fi
-}
-
-#----------------------------------------------------------------------
-# The sysprep operations.
-