File: install.sh.in

package info (click to toggle)
arpalert 2.0.12-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,508 kB
  • sloc: ansic: 4,452; sh: 517; makefile: 116; perl: 35
file content (80 lines) | stat: -rwxr-xr-x 2,045 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
#
# Copyright (c) 2005-2010 Thierry FOURNIER
# $Id: Makefile.in 374 2006-10-25 17:32:21Z thierry $
# 

prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
sbindir="@sbindir@"
libexecdir="@libexecdir@"
datadir="@datadir@"
sysconfdir="@sysconfdir@"
sharedstatedir="@sharedstatedir@"
localstatedir="@localstatedir@"
libdir="@libdir@"
infodir="@infodir@"
mandir="@mandir@"
includedir="@includedir@"
config_dir="@sysconfdir@/arpalert"
leases_dir="@localstatedir@/lib/arpalert"
lock_dir="@localstatedir@/run"
log_dir="@localstatedir@/log"
includedir="@includedir@/"

# make all directories
mkdir -p ${DESTDIR}${sbindir}
mkdir -p ${DESTDIR}${leases_dir}
mkdir -p ${DESTDIR}${lock_dir}
mkdir -p ${DESTDIR}${log_dir}
mkdir -p ${DESTDIR}${config_dir} 
mkdir -p ${DESTDIR}${includedir} 
mkdir -p ${DESTDIR}${mandir}/man8

# install man
cp -f doc/arpalert.8 ${DESTDIR}${mandir}/man8

# copy oui list
cp -f etc/oui.txt ${DESTDIR}${config_dir}

# copy API
cp -f api/arpalert.h ${DESTDIR}${includedir}

# insall binary
cp -f arpalert ${DESTDIR}${sbindir}

# if doesn't exist conf
if [ ! -f ${DESTDIR}${config_dir}/arpalert.conf ]; then
	
	# create maclist.allow
	if [ ! -f ${DESTDIR}${config_dir}/maclist.allow ]; then
		> ${DESTDIR}${config_dir}/maclist.allow || /bin/true
	fi

	# create maclist.deny
	if [ ! -f ${DESTDIR}${config_dir}/maclist.deny ]; then
		> ${DESTDIR}${config_dir}/maclist.deny  || /bin/true
	fi

	# dest file
	CONF="${DESTDIR}${config_dir}/arpalert.conf"

else

	# default dest file
	CONF="${DESTDIR}${config_dir}/arpalert.conf.default.`cat VERSION`"
fi

# gen conf file
config_dir=`echo "${config_dir}" | tr '/' '@' | sed -e 's/@/\\\\\\//g'`
leases_dir=`echo "${leases_dir}" | tr '/' '@' | sed -e 's/@/\\\\\\//g'`
lock_dir=`echo "${lock_dir}" | tr '/' '@' | sed -e 's/@/\\\\\\//g'`
log_dir=`echo "${log_dir}" | tr '/' '@' | sed -e 's/@/\\\\\\//g'`
sed -e "
	s/@config_dir@/${config_dir}/g;
	s/@leases_dir@/${leases_dir}/g;
	s/@lock_dir@/${lock_dir}/g;
	s/@log_dir@/${log_dir}/g;
" < etc/arpalert.conf.in > ${CONF}