]> git.uio.no Git - check_openmanage.git/blob - install.sh
* version 3.7.0-beta7
[check_openmanage.git] / install.sh
1 #!/bin/sh
2
3 # Find correct lib dir
4 if [ "`uname -m`" = "x86_64" ]; then
5     libdir=/usr/lib64
6 else
7     libdir=/usr/lib
8 fi
9
10 # Default install locations
11 def_plugindir=${libdir}/nagios/plugins
12 def_mandir=/usr/share/man/man8
13
14 # Find install locations
15 if [ "$1" = "-q" ]; then
16     plugindir=$def_plugindir
17     mandir=$def_mandir
18 else
19     echo -n "Plugin dir [$def_plugindir]: "
20     read plugindir
21     if [ "$plugindir" = "" ]; then
22         plugindir=$def_plugindir
23     fi
24     echo -n "Man page dir [$def_mandir]: "
25     read mandir
26     if [ "$mandir" = "" ]; then
27         mandir=$def_mandir
28     fi
29 fi
30
31 # Error if plugin dir doesn't exist
32 if [ -d $plugindir ]; then
33     :
34 else
35     echo "ERROR: Plugin directory $plugindir doesn't exist,"
36     echo "ERROR: or is not a directory"
37     exit 1
38 fi
39
40 # Error if man dir doesn't exist
41 if [ -d $mandir ]; then
42     :
43 else
44     echo "ERROR: Man page directory $mandir doesn't exist,"
45     echo "ERROR: or is not a directory"
46     exit 1
47 fi
48
49 # Install
50 install -p -m 0755 check_openmanage $plugindir
51 install -m 0644 check_openmanage.8 $mandir
52
53 # Done
54 echo "done."
55 exit 0