summaryrefslogtreecommitdiffstats
path: root/pkg/solaris
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/solaris')
-rw-r--r--pkg/solaris/pkginfo.in12
-rwxr-xr-xpkg/solaris/solpkg80
2 files changed, 92 insertions, 0 deletions
diff --git a/pkg/solaris/pkginfo.in b/pkg/solaris/pkginfo.in
new file mode 100644
index 0000000..be4b97f
--- /dev/null
+++ b/pkg/solaris/pkginfo.in
@@ -0,0 +1,12 @@
1PKG="NPDTplugins"
2NAME="nagiosplugins"
3DESC="Nagios network monitoring plugins"
4ARCH="@PKG_ARCH@"
5VERSION="@PACKAGE_VERSION@,REV=@REV_DATESTAMP@"
6CATEGORY="application"
7VENDOR="Nagios Plugin Development Team"
8EMAIL="nagiosplug-devel@lists.sourceforge.net"
9PSTAMP="sfw@REV_TIMESTAMP@"
10BASEDIR="/usr/local"
11CLASSES="none"
12
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg
new file mode 100755
index 0000000..0b82bce
--- /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`;
15if ($pwd =~ '\/usr\/local') {
16 $pwd = $`;
17}
18die "Wrong location, please cd to <PKGBASE>/usr/local/ and run again.\n"
19 if ($pwd eq "");
20
21open (PREPROTO,"$find . -print |$pkgproto |") ||
22 die "Unable to read prototype information ($!)\n";
23open (PROTO,">$prototype") ||
24 die "Unable to write file prototype ($!)\n";
25print PROTO "i pkginfo=./$pkginfo\n";
26while (<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}
42close PROTO;
43close PREPROTO;
44
45# Now we can start building the package
46
47$os = `uname -r`;
48$os =~ '\.';
49$os = "sol$'";
50chomp $os;
51
52open (PKGINFO,"<$pkginfo") ||
53 die "Unable to read package information ($!)\n";
54while (<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}
73close PKGINFO;
74
75$packagename = "$name-$version-$os-$arch-local";
76
77print "Building package\n";
78system ("$pkgmk -o -r `pwd` -d $pkgdevice");
79system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)");
80print "Done. ($packagename)\n";