| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
use strict; |
| 4 |
use warnings; |
| 5 |
|
| 6 |
# path to modules |
| 7 |
use lib '/home/service/bin/umltools'; |
| 8 |
|
| 9 |
# path to config-file |
| 10 |
use lib '/home/service/etc'; |
| 11 |
|
| 12 |
BEGIN { |
| 13 |
} |
| 14 |
|
| 15 |
END { |
| 16 |
print "\n"; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
use Getopt::Long; |
| 21 |
use UML::Config; |
| 22 |
use UML::Validate; |
| 23 |
use UML::Utils; |
| 24 |
use UML::Package; |
| 25 |
|
| 26 |
sub usage { |
| 27 |
print "\n"; |
| 28 |
print " Usage: uml_package.pl [OPTIONS] which may be ...", "\n"; |
| 29 |
print " --vhost=<vhost-name> ", "supply a distinguished name for a virtual host", "\n"; |
| 30 |
print " --skel=<skel-name> ", "supply a distinguished name for a skel (e.g. \"default\"", "\n"; |
| 31 |
print " --rootfs ", "only package rootfs", "\n"; |
| 32 |
print " --patches ", "only bundle patches", "\n"; |
| 33 |
exit; |
| 34 |
} |
| 35 |
|
| 36 |
my $vhost_name; |
| 37 |
my $skel_name; |
| 38 |
my $glbl_ni; |
| 39 |
my $cmd_rootfs; |
| 40 |
my $cmd_patches; |
| 41 |
my $args_parsed = GetOptions ( |
| 42 |
"vhost=s" => \$vhost_name, |
| 43 |
"skel=s" => \$skel_name, |
| 44 |
"ni" => \$glbl_ni, |
| 45 |
"rootfs" => \$cmd_rootfs, |
| 46 |
"patches" => \$cmd_patches, |
| 47 |
); |
| 48 |
|
| 49 |
if (!$vhost_name || !$skel_name) { |
| 50 |
usage(); |
| 51 |
} |
| 52 |
|
| 53 |
if ($cmd_rootfs && $cmd_patches) { |
| 54 |
print "--rootfs and --patches are exclusive"; |
| 55 |
usage(); |
| 56 |
} |
| 57 |
my $bool_restrict = $cmd_rootfs || $cmd_patches; |
| 58 |
if (!$bool_restrict) { |
| 59 |
$cmd_rootfs = 1; |
| 60 |
$cmd_patches = 1; |
| 61 |
} |
| 62 |
|
| 63 |
if ($glbl_ni) { our $DEBUG_STEP; $DEBUG_STEP = 0; } |
| 64 |
|
| 65 |
if ($cmd_rootfs) { |
| 66 |
UML::Package::pack_rootfs($vhost_name, $skel_name); |
| 67 |
} |
| 68 |
if ($cmd_patches) { |
| 69 |
UML::Package::bundle_patches($skel_name); |
| 70 |
UML::Package::patches2pkg($skel_name); |
| 71 |
} |
| 72 |
|
| 73 |
logAction("packaging of \"$vhost_name\" to \"$skel_name\" finished."); |