File: diskless-newimage

package info (click to toggle)
diskless 0.3.17
  • links: PTS
  • area: main
  • in suites: woody
  • size: 728 kB
  • ctags: 119
  • sloc: perl: 2,628; xml: 740; sh: 403; makefile: 104
file content (58 lines) | stat: -rwxr-xr-x 957 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl -w
use lib "/usr/lib/diskless";
use strict;
use diskless;
use imagedir;

my $m=0;

if ($#ARGV >= 0) 
{ 
	if ($ARGV[0] eq "--help")
	{
		print<<EOT;

No help currently available

EOT
		exit 0;
	}
}

my $imagedir="";
if ($m <= $#ARGV)
{
	$imagedir=$ARGV[$m]; $m++;
}

if ( $imagedir eq "" )
{
	$imagedir = "diskless"->input("Image directory","/var/lib/diskless/default/root");
}

my $error = undef;
my $theimagedir = "imagedir"->get($imagedir,\$error);
if (defined($error) && $error->id == "error"->notfound)
{
	print "Creating a NEW image directory\n";
	$error=undef;
	$theimagedir = "imagedir"->create($imagedir,\$error);
	die($error->msg."\n") if (defined($error));
}
elsif (defined($error))
{
	die($error->msg."\n");
}
else
{
	print "Re-configuring existing image directory\n";
	print "WARNING: this image directory must already be installed\n";
	$theimagedir->config(\$error);
}

if (defined($error))
{
	die($error->msg."\n");
}

exit 0;