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