]> git.uio.no Git - check_openmanage.git/blob - install.sh
3.7.2
[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
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 man5dir=$mandir/man5
32 man8dir=$mandir/man8
33
34 # Error if plugin dir doesn't exist
35 if [ -d $plugindir ]; then
36     :
37 else
38     echo "ERROR: Plugin directory $plugindir doesn't exist,"
39     echo "ERROR: or is not a directory"
40     exit 1
41 fi
42
43 # Error if man dir doesn't exist
44 if [ -d $mandir ]; then
45     :
46 else
47     echo "ERROR: Man page directory $mandir doesn't exist,"
48     echo "ERROR: or is not a directory"
49     exit 1
50 fi
51
52 # Install
53 install -p -m 0755 check_openmanage $plugindir
54 install -m 0644 check_openmanage.8 $man8dir
55 install -m 0644 check_openmanage.conf.5 $man5dir
56
57 # Done
58 echo "done."
59 exit 0