mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
p2v: Add --install option to virt-p2v-make-disk, virt-p2v-make-kickstart.
This allows you to install extra packages in the disk/ISO. The implementation of this option in virt-p2v-make-disk was particularly simple and followed naturally from the previous commit.
This commit is contained in:
@@ -76,6 +76,10 @@ dracut-live
|
||||
# The dependencies of virt-p2v.
|
||||
__DEPENDENCIES__
|
||||
|
||||
# Extra packages requested by the user via the virt-p2v-make-kickstart
|
||||
# --install option (if any).
|
||||
__EXTRA_PACKAGES__
|
||||
|
||||
%end
|
||||
|
||||
# Post-install configuration.
|
||||
|
||||
@@ -38,7 +38,7 @@ fi
|
||||
# Parse the command line arguments.
|
||||
TEMP=`getopt \
|
||||
-o o:vV \
|
||||
--long arch:,help,inject-ssh-identity:,no-warn-if-partition,output:,verbose,version \
|
||||
--long arch:,help,inject-ssh-identity:,install:,no-warn-if-partition,output:,verbose,version \
|
||||
-n $program -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo "$program: problem parsing the command line arguments"
|
||||
@@ -77,6 +77,11 @@ while true; do
|
||||
shift;;
|
||||
|
||||
# virt-builder parameters that are passed through.
|
||||
--install)
|
||||
passthru[${#passthru[*]}]="$1"
|
||||
passthru[${#passthru[*]}]="$2"
|
||||
shift 2;;
|
||||
|
||||
--no-warn-if-partition)
|
||||
passthru[${#passthru[*]}]="$1"
|
||||
shift;;
|
||||
|
||||
@@ -52,6 +52,15 @@ Write a virt-p2v bootable virtual disk image, and boot it under qemu:
|
||||
where F</var/tmp/guest.img> would be the disk image of some guest that
|
||||
you want to convert (for testing only).
|
||||
|
||||
=head1 ADDING EXTRA PACKAGES
|
||||
|
||||
You can install extra packages using the I<--install> option. This
|
||||
can be useful for making a more fully-featured virt-p2v disk with
|
||||
extra tools for debugging and troubleshooting. Give a list of
|
||||
packages, separated by commas. For example:
|
||||
|
||||
virt-p2v-make-disk -o /var/tmp/p2v.img --install tcpdump,traceroute
|
||||
|
||||
=head1 ADDING AN SSH IDENTITY
|
||||
|
||||
You can inject an SSH identity (private key) file to the image using
|
||||
@@ -122,6 +131,11 @@ architecture as the host that is running virt-p2v-make-disk.
|
||||
Add an SSH identity (private key) file into the image.
|
||||
See L</ADDING AN SSH IDENTITY> above.
|
||||
|
||||
=item B<--install> pkg,pkg,...
|
||||
|
||||
Add extra packages to the image.
|
||||
See L</ADDING EXTRA PACKAGES> above.
|
||||
|
||||
=item B<--no-warn-if-partition>
|
||||
|
||||
Normally you should not write to a partition on a USB drive (ie. don't
|
||||
|
||||
@@ -24,7 +24,7 @@ version="@PACKAGE_VERSION@"
|
||||
|
||||
TEMP=`getopt \
|
||||
-o o:vV \
|
||||
--long help,inject-ssh-identity:,output:,proxy:,verbose,version \
|
||||
--long help,inject-ssh-identity:,install:,output:,proxy:,verbose,version \
|
||||
-n $program -- "$@"`
|
||||
if [ $? != 0 ]; then
|
||||
echo "$program: problem parsing the command line arguments"
|
||||
@@ -41,6 +41,7 @@ usage ()
|
||||
exit $1
|
||||
}
|
||||
|
||||
extra_packages=
|
||||
output=p2v.ks
|
||||
proxy=
|
||||
ssh_identity=
|
||||
@@ -51,6 +52,9 @@ while true; do
|
||||
--inject-ssh-identity)
|
||||
ssh_identity="$2"
|
||||
shift 2;;
|
||||
--install)
|
||||
extra_packages="${extra_packages:+${extra_packages},}$2"
|
||||
shift 2;;
|
||||
-o|--output)
|
||||
output="$2"
|
||||
shift 2;;
|
||||
@@ -186,6 +190,7 @@ done < $depsfile
|
||||
-v "base64_ssh_identity=$base64_ssh_identity" \
|
||||
-v "base64_virt_p2v=$base64_virt_p2v" \
|
||||
-v "dependencies=$dependencies" \
|
||||
-v "extra_packages=$extra_packages" \
|
||||
-v "md5sum_virt_p2v=$md5sum_virt_p2v" \
|
||||
-v "repos=$repos" \
|
||||
-v "libexecdir=$libexecdir" \
|
||||
@@ -199,6 +204,7 @@ done < $depsfile
|
||||
gsub (/__BASE64_SSH_IDENTITY__/, base64_ssh_identity);
|
||||
gsub (/__BASE64_VIRT_P2V__/, base64_virt_p2v);
|
||||
gsub (/__DEPENDENCIES__/, dependencies);
|
||||
gsub (/__EXTRA_PACKAGES__/, gensub (/,/, "\n", "g", extra_packages));
|
||||
gsub (/__MD5SUM_VIRT_P2V__/, md5sum_virt_p2v);
|
||||
gsub (/__REPOS__/, repos);
|
||||
gsub (/__LIBEXECDIR__/, libexecdir);
|
||||
|
||||
@@ -191,6 +191,15 @@ pxelinux starts up.
|
||||
|
||||
=back
|
||||
|
||||
=head1 ADDING EXTRA PACKAGES
|
||||
|
||||
You can install extra packages using the I<--install> option. This
|
||||
can be useful for making a more fully-featured virt-p2v disk with
|
||||
extra tools for debugging and troubleshooting. Give a list of
|
||||
packages, separated by commas. For example:
|
||||
|
||||
virt-p2v-make-kickstart [...] --install tcpdump,traceroute
|
||||
|
||||
=head1 ADDING AN SSH IDENTITY
|
||||
|
||||
You can inject an SSH identity (private key) file to the kickstart and
|
||||
@@ -243,6 +252,11 @@ Display help.
|
||||
Add an SSH identity (private key) file into the kickstart.
|
||||
See L</ADDING AN SSH IDENTITY> above.
|
||||
|
||||
=item B<--install> pkg,pkg,...
|
||||
|
||||
Add extra packages to the kickstart C<%packages> section.
|
||||
See L</ADDING EXTRA PACKAGES> above.
|
||||
|
||||
=item B<-o> OUTPUT
|
||||
|
||||
=item B<--output> OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user