diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/solaris/pkginfo.in | 12 | ||||
-rwxr-xr-x | pkg/solaris/solpkg | 80 |
2 files changed, 92 insertions, 0 deletions
diff --git a/pkg/solaris/pkginfo.in b/pkg/solaris/pkginfo.in new file mode 100644 index 00000000..be4b97fa --- /dev/null +++ b/pkg/solaris/pkginfo.in | |||
@@ -0,0 +1,12 @@ | |||
1 | PKG="NPDTplugins" | ||
2 | NAME="nagiosplugins" | ||
3 | DESC="Nagios network monitoring plugins" | ||
4 | ARCH="@PKG_ARCH@" | ||
5 | VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@" | ||
6 | CATEGORY="application" | ||
7 | VENDOR="Nagios Plugin Development Team" | ||
8 | EMAIL="nagiosplug-devel@lists.sourceforge.net" | ||
9 | PSTAMP="sfw@REV_TIMESTAMP@" | ||
10 | BASEDIR="/usr/local" | ||
11 | CLASSES="none" | ||
12 | |||
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg new file mode 100755 index 00000000..0b82bce0 --- /dev/null +++ b/pkg/solaris/solpkg | |||
@@ -0,0 +1,80 @@ | |||
1 | #!/usr/bin/perl | ||
2 | |||
3 | $pkgdevice = $ARGV[0] || die "Unable to determine device ($!)\n"; | ||
4 | |||
5 | $find = "/usr/bin/find"; | ||
6 | $pkgproto = "/usr/bin/pkgproto"; | ||
7 | $pkgmk = "/usr/bin/pkgmk"; | ||
8 | $pkgtrans = "/usr/bin/pkgtrans"; | ||
9 | $prototype = "prototype"; | ||
10 | $pkginfo = "pkginfo"; | ||
11 | |||
12 | # Sanity check | ||
13 | |||
14 | $pwd = `pwd`; | ||
15 | if ($pwd =~ '\/usr\/local') { | ||
16 | $pwd = $`; | ||
17 | } | ||
18 | die "Wrong location, please cd to <PKGBASE>/usr/local/ and run again.\n" | ||
19 | if ($pwd eq ""); | ||
20 | |||
21 | open (PREPROTO,"$find . -print |$pkgproto |") || | ||
22 | die "Unable to read prototype information ($!)\n"; | ||
23 | open (PROTO,">$prototype") || | ||
24 | die "Unable to write file prototype ($!)\n"; | ||
25 | print PROTO "i pkginfo=./$pkginfo\n"; | ||
26 | while (<PREPROTO>) { | ||
27 | # Read in the prototype information | ||
28 | chomp; | ||
29 | $thisline = $_; | ||
30 | if ($thisline =~ " prototype " | ||
31 | or $thisline =~ " pkginfo ") { | ||
32 | # Don't do anything as they aren't important | ||
33 | } elsif ($thisline =~ "^[fd] ") { | ||
34 | # Change the ownership of files and directories | ||
35 | ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; | ||
36 | print PROTO "$dir $none $file $mode bin bin\n"; | ||
37 | } else { | ||
38 | # Symlinks and other stuff should be printed also | ||
39 | print PROTO "$thisline\n"; | ||
40 | } | ||
41 | } | ||
42 | close PROTO; | ||
43 | close PREPROTO; | ||
44 | |||
45 | # Now we can start building the package | ||
46 | |||
47 | $os = `uname -r`; | ||
48 | $os =~ '\.'; | ||
49 | $os = "sol$'"; | ||
50 | chomp $os; | ||
51 | |||
52 | open (PKGINFO,"<$pkginfo") || | ||
53 | die "Unable to read package information ($!)\n"; | ||
54 | while (<PKGINFO>) { | ||
55 | # Read in the package information | ||
56 | chomp; | ||
57 | $thisline = $_; | ||
58 | ($var,$value) = split /=/,$thisline; | ||
59 | if ("$var" eq "NAME" | ||
60 | or "$var" eq "VERSION" | ||
61 | or "$var" eq "ARCH") { | ||
62 | $tmp = lc($var); | ||
63 | $value =~ s/\"//g; | ||
64 | if ("$tmp" eq "version" | ||
65 | and $value =~ ",REV") { | ||
66 | ($value,$var) = split /\,/,$value; | ||
67 | $$tmp = $value; | ||
68 | } else { | ||
69 | $$tmp = $value; | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | close PKGINFO; | ||
74 | |||
75 | $packagename = "$name-$version-$os-$arch-local"; | ||
76 | |||
77 | print "Building package\n"; | ||
78 | system ("$pkgmk -o -r `pwd` -d $pkgdevice"); | ||
79 | system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)"); | ||
80 | print "Done. ($packagename)\n"; | ||