1
0
mirror of synced 2026-02-27 00:39:51 +00:00

Make some x-c-i commandline options negatable

Update documentation and tests accordingly.

Also add pygrub = 1 as example to xen-tools.conf, now that the effect
can be reversed via commandline options.
This commit is contained in:
Axel Beckert
2013-04-11 15:08:30 +02:00
parent 6fc51d20be
commit 5a48067d9e
4 changed files with 49 additions and 32 deletions

View File

@@ -11,26 +11,28 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Help Options:
--help Show the help information for this script.
--help Show the help information for this script.
--manual Read the manual, and examples, for this script.
--manual Read the manual, and examples, for this script.
--verbose Show useful debugging information.
--(no)verbose (Don't) show more of what xen-create-image is
currently doing.
--dumpconfig Show current configuration.
--dumpconfig Show current configuration.
--version Show the version number and exit.
--version Show the version number and exit.
Size / General options:
--accounts Copy all non-system accounts to the guest image
--(no)accounts
(Don't) copy all non-system accounts to the guest image
--admins Specify that some administrators should be created for
this image, using xen-shell.
--boot Boot the new instance after creating it.
--(no)boot (Don't) boot the new instance after creating it.
--cache=bool Cache .deb files on the host when installing the new
guest with the debootstrap tool. Accepted values:
@@ -46,7 +48,9 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Read the specified file in addition to the global
configuration file.
--copyhosts Copy entries from the dom0's /etc/hosts file to the guest
--(no)copyhosts
(Don't) copy entries from the dom0's /etc/hosts file
to the guest
--copy-cmd NOP: Ignored.
@@ -63,9 +67,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
Specify the suffix to give the Xen configuration
file. (Default value: ".cfg")
--force Force overwriting existing images. This will remove
existing images or LVM volumes which match those which
are liable to be used by the new invocation.
--(no)force (Don't) force overwriting existing images. This will
remove existing images or LVM volumes which match
those which are liable to be used by the new
invocation.
--fs=fs Specify the filesystem type to use for the new guest.
Valid choices are 'ext2', 'ext3', 'ext4', 'reiserfs',
@@ -99,7 +104,7 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--install=1 Specify whether to install the guest system or not.
--keep Don't delete our images if installation fails. It maybe
--(no)keep (Don't) keep our images if installation fails. It maybe
unmounted, though.
--kernel=/path/to/kernel
@@ -139,10 +144,10 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--password=passphrase
Set the root password for the new guest.
--passwd Ask for a root password interactively during setup.
NOTE: This overrides --genpass --password
--(no)passwd (Don't) ask for a root password interactively during
setup. NOTE: This overrides --genpass --password.
--pygrub DomU should be booted using pygrub.
--(no)pygrub DomU should (not) be booted using pygrub.
--role=role Run the specified role script(s) post-install.
Role scripts are discussed later in this manpage.
@@ -241,8 +246,8 @@ xen-create-image - Easily create new Xen instances with networking and OpenSSH.
--broadcast=123.456.789.ABC
Setup the broadcast address for the new instance.
--dhcp The guest will be configured to fetch its networking
details via DHCP.
--(no)dhcp The guest will (not) be configured to fetch its
networking details via DHCP.
--gateway=gw Setup the network gateway for the new instance.
@@ -1614,14 +1619,14 @@ sub parseCommandLineArguments
"disk_device=s", \&checkOption,
# Hosts options
"nohosts", \$CONFIG{ 'nohosts' },
"copyhosts", \$CONFIG{ 'copyhosts' },
"nohosts", \$CONFIG{ 'nohosts' },
"copyhosts!", \$CONFIG{ 'copyhosts' },
# Deprecated legacy options for backwards compatibility
"no-hosts", \$CONFIG{ 'nohosts' },
"copy-hosts", \$CONFIG{ 'copyhosts' },
"no-hosts", \$CONFIG{ 'nohosts' },
"copy-hosts!", \$CONFIG{ 'copyhosts' },
# Networking options
"dhcp", \$CONFIG{ 'dhcp' },
"dhcp!", \$CONFIG{ 'dhcp' },
"bridge=s", \&checkOption,
"gateway=s", \&checkOption,
"hostname=s", \&checkOption,
@@ -1642,11 +1647,11 @@ sub parseCommandLineArguments
"debootstrap-cmd=s", \$CONFIG{ 'debootstrap-cmd' },
# Misc. options
"accounts", \$CONFIG{ 'accounts' },
"accounts!", \$CONFIG{ 'accounts' },
"admins=s", \&checkOption,
"arch=s", \&checkOption,
"fs=s", \&checkOption,
"boot", \$CONFIG{ 'boot' },
"boot!", \$CONFIG{ 'boot' },
"cache=s", \&checkOption,
"cachedir=s", \&checkOption,
"config=s", \&checkOption,
@@ -1654,8 +1659,8 @@ sub parseCommandLineArguments
"scsi", \$CONFIG{ 'scsi' },
"install=i", \&checkOption,
"hooks=i", \&checkOption,
"pygrub", \$CONFIG{ 'pygrub' },
"passwd", \$CONFIG{ 'passwd' },
"pygrub!", \$CONFIG{ 'pygrub' },
"passwd!", \$CONFIG{ 'passwd' },
"genpass=i", \&checkOption,
"genpass-len=i", \&checkOption,
"genpass_len=i", \&checkOption,
@@ -1666,20 +1671,20 @@ sub parseCommandLineArguments
"role-args=s", \&checkOption,
"finalrole=s", \&checkOption,
"roledir=s", \&checkOption,
"force", \$CONFIG{ 'force' },
"force!", \$CONFIG{ 'force' },
"no-xen-ok", \$CONFIG{ 'no_xen_ok' },
"keep", \$CONFIG{ 'keep' },
"keep!", \$CONFIG{ 'keep' },
"template=s", \&checkOption,
"output=s", \&checkOption,
"extension:s", \&checkOption,
"dontformat", \&checkOption,
# Help options
"debug", \$CONFIG{ 'debug' },
"debug!", \$CONFIG{ 'debug' },
"help", \$HELP,
"manual", \$MANUAL,
"dumpconfig", \$DUMPCONFIG,
"verbose", \$CONFIG{ 'verbose' },
"verbose!", \$CONFIG{ 'verbose' },
"version", \$VERSION
) )
{

View File

@@ -236,6 +236,13 @@ image = sparse # Specify sparse vs. full disk images (file based images only)
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
#
# Uncomment the following line if you wish to use pygrub by default
# for all distributions.
#
# pygrub = 1
#
#
# The architecture to use when using debootstrap, rinse, or rpmstrap.
#

View File

@@ -39,7 +39,7 @@ foreach my $key ( sort keys %OPTIONS )
foreach my $line ( @lines )
{
if ( $line =~ /--$key/ )
if ( $line =~ /--(\(no\))?$key/ )
{
$found = 1;
}

View File

@@ -51,7 +51,7 @@ sub testFile
foreach my $line ( split( /\n/, $output ) )
{
if ( $line =~ /[ \t]*--([a-z-_]+)/ )
if ( $line =~ /[ \t]*--(?:\(no\))?([a-z-_]+)/ )
{
push @documented, $1 unless( $line =~ /NOP/i );
}
@@ -120,6 +120,11 @@ sub testFile
{
$o = $1;
}
#print " - remove negation : $o ";
#
# Discard any "!" at the end
#
$o =~ s/!//;
#print " - remove = : $o ";
#
# Now avoid blank lines.