diff options
author | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 20:49:24 (GMT) |
---|---|---|
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | 2012-04-10 20:49:24 (GMT) |
commit | 4c30935850997f513b3eee21d169f6d523d43c5d (patch) | |
tree | 09a14dfecd959e1b566b9df7b7fdb99f6bb4c5d8 /pkg/solaris | |
parent | 9978b3ca744b076d8ea24441819826938211dd17 (diff) | |
parent | 8c7e2b636c601dd05a6881c84cc95136ecf9323e (diff) | |
download | monitoring-plugins-4c30935850997f513b3eee21d169f6d523d43c5d.tar.gz |
Merge branch 'master' of ssh://nagiosplug.git.sourceforge.net/gitroot/nagiosplug/nagiosplug
Diffstat (limited to 'pkg/solaris')
-rw-r--r-- | pkg/solaris/pkginfo.in | 2 | ||||
-rwxr-xr-x | pkg/solaris/preinstall | 35 | ||||
-rwxr-xr-x | pkg/solaris/solpkg | 15 |
3 files changed, 48 insertions, 4 deletions
diff --git a/pkg/solaris/pkginfo.in b/pkg/solaris/pkginfo.in index c9dcced..3bed346 100644 --- a/pkg/solaris/pkginfo.in +++ b/pkg/solaris/pkginfo.in | |||
@@ -1,4 +1,4 @@ | |||
1 | PKG="NAGplugin" | 1 | PKG="NGOSplugin" |
2 | NAME="nagios-plugins" | 2 | NAME="nagios-plugins" |
3 | DESC="Nagios network monitoring plugins" | 3 | DESC="Nagios network monitoring plugins" |
4 | ARCH="@PKG_ARCH@" | 4 | ARCH="@PKG_ARCH@" |
diff --git a/pkg/solaris/preinstall b/pkg/solaris/preinstall new file mode 100755 index 0000000..c4cc269 --- /dev/null +++ b/pkg/solaris/preinstall | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/usr/bin/sh | ||
2 | |||
3 | user="nagios" | ||
4 | uid=-1 | ||
5 | group="nagios" | ||
6 | gid=-1 | ||
7 | |||
8 | /usr/bin/getent group $group > /dev/null 2> /dev/null | ||
9 | result=$? | ||
10 | if [ $result -eq 2 ] ; then | ||
11 | echo "Group $group does not exist. Creating..." | ||
12 | if [ $gid -ne -1 ] ; then | ||
13 | /usr/sbin/groupadd -g $gid $group | ||
14 | else | ||
15 | /usr/sbin/groupadd $group | ||
16 | fi | ||
17 | elif [ $result -ne 0 ] ; then | ||
18 | echo "An error occurred determining the existence of the groug $group. Terminating." | ||
19 | exit 1; | ||
20 | fi | ||
21 | |||
22 | /usr/bin/getent passwd $user > /dev/null 2> /dev/null | ||
23 | result=$? | ||
24 | if [ $result -eq 2 ] ; then | ||
25 | echo "User $user does not exist. Creating..." | ||
26 | if [ $uid -ne -1 ] ; then | ||
27 | /usr/sbin/useradd -u $uid -g $group $user | ||
28 | else | ||
29 | /usr/sbin/useradd -g $group $user | ||
30 | fi | ||
31 | elif [ $result -ne 0 ] ; then | ||
32 | echo "An error occurred determining the existence of the user $user. Terminating." | ||
33 | exit 1; | ||
34 | fi | ||
35 | |||
diff --git a/pkg/solaris/solpkg b/pkg/solaris/solpkg index 41d8e17..a21176e 100755 --- a/pkg/solaris/solpkg +++ b/pkg/solaris/solpkg | |||
@@ -8,6 +8,7 @@ $pkgmk = "/usr/bin/pkgmk"; | |||
8 | $pkgtrans = "/usr/bin/pkgtrans"; | 8 | $pkgtrans = "/usr/bin/pkgtrans"; |
9 | $prototype = "prototype"; | 9 | $prototype = "prototype"; |
10 | $pkginfo = "pkginfo"; | 10 | $pkginfo = "pkginfo"; |
11 | $preinstall = "preinstall"; | ||
11 | $egrep = "/usr/bin/egrep"; | 12 | $egrep = "/usr/bin/egrep"; |
12 | 13 | ||
13 | # Sanity check | 14 | # Sanity check |
@@ -24,17 +25,24 @@ open (PREPROTO,"$find . -print |$egrep -v \"^\.(/usr(/local)?|/opt)?\$\" | $pkgp | |||
24 | open (PROTO,">$prototype") || | 25 | open (PROTO,">$prototype") || |
25 | die "Unable to write file prototype ($!)\n"; | 26 | die "Unable to write file prototype ($!)\n"; |
26 | print PROTO "i pkginfo=./$pkginfo\n"; | 27 | print PROTO "i pkginfo=./$pkginfo\n"; |
28 | print PROTO "i preinstall=./$preinstall\n"; | ||
27 | while (<PREPROTO>) { | 29 | while (<PREPROTO>) { |
28 | # Read in the prototype information | 30 | # Read in the prototype information |
29 | chomp; | 31 | chomp; |
30 | $thisline = $_; | 32 | $thisline = $_; |
31 | if ($thisline =~ " prototype " | 33 | if ($thisline =~ " prototype " |
32 | or $thisline =~ " pkginfo ") { | 34 | or $thisline =~ " pkginfo " |
35 | or $thisline =~ " preinstall ") { | ||
33 | # Don't do anything as they aren't important | 36 | # Don't do anything as they aren't important |
37 | } elsif ($thisline =~ "pst3") { | ||
38 | # Needs to be installed SUID root | ||
39 | ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; | ||
40 | print PROTO "$dir $none $file 4755 root bin\n"; | ||
41 | |||
34 | } elsif ($thisline =~ "^[fd] ") { | 42 | } elsif ($thisline =~ "^[fd] ") { |
35 | # Change the ownership of files and directories | 43 | # Change the ownership of files and directories |
36 | ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; | 44 | ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; |
37 | print PROTO "$dir $none $file $mode bin bin\n"; | 45 | print PROTO "$dir $none $file $mode $user bin\n"; |
38 | } else { | 46 | } else { |
39 | # Symlinks and other stuff should be printed also | 47 | # Symlinks and other stuff should be printed also |
40 | print PROTO "$thisline\n"; | 48 | print PROTO "$thisline\n"; |
@@ -58,6 +66,7 @@ while (<PKGINFO>) { | |||
58 | $thisline = $_; | 66 | $thisline = $_; |
59 | ($var,$value) = split /=/,$thisline; | 67 | ($var,$value) = split /=/,$thisline; |
60 | if ("$var" eq "NAME" | 68 | if ("$var" eq "NAME" |
69 | or "$var" eq "PKG" | ||
61 | or "$var" eq "VERSION" | 70 | or "$var" eq "VERSION" |
62 | or "$var" eq "ARCH") { | 71 | or "$var" eq "ARCH") { |
63 | $tmp = lc($var); | 72 | $tmp = lc($var); |
@@ -77,5 +86,5 @@ $packagename = "$name-$version-$os-$arch-local"; | |||
77 | 86 | ||
78 | print "Building package\n"; | 87 | print "Building package\n"; |
79 | system ("$pkgmk -o -r `pwd` -d $pkgdevice"); | 88 | system ("$pkgmk -o -r `pwd` -d $pkgdevice"); |
80 | system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)"); | 89 | system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename $pkg)"); |
81 | print "Done. ($packagename)\n"; | 90 | print "Done. ($packagename)\n"; |