File: INSTALL

package info (click to toggle)
collectl 3.7.4-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,624 kB
  • ctags: 119
  • sloc: perl: 14,928; sh: 429; makefile: 11
file content (115 lines) | stat: -rwxr-xr-x 3,167 bytes parent folder | download
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/sh

DESTDIR=${DESTDIR:="/"}

BINDIR=$DESTDIR/usr/bin
DOCDIR=$DESTDIR/usr/share/doc/collectl
SHRDIR=$DESTDIR/usr/share/collectl
MANDIR=$DESTDIR/usr/share/man/man1
ETCDIR=$DESTDIR/etc
INITDIR=$ETCDIR/init.d

mkdir -p $BINDIR
mkdir -p $DOCDIR
mkdir -p $SHRDIR
mkdir -p $ETCDIR
mkdir -p $MANDIR
mkdir -p $INITDIR
mkdir -p $SHRDIR/util
mkdir -p $DESTDIR/var/log/collectl

cp collectl.pl           $BINDIR/collectl
cp collectl.conf         $ETCDIR
cp man1/*                $MANDIR
cp initd/*               $INITDIR

cp docs/*                $DOCDIR
cp GPL ARTISTIC COPYING  $DOCDIR
cp RELEASE-collectl      $DOCDIR

cp UNINSTALL             $SHRDIR
cp formatit.ph           $SHRDIR
cp lexpr.ph              $SHRDIR
cp gexpr.ph misc.ph      $SHRDIR
cp hello.ph graphite.ph  $SHRDIR
cp envrules.std          $SHRDIR
cp vmstat.ph             $SHRDIR
cp client.pl             $SHRDIR/util
cp col2tlviz.pl          $SHRDIR/util

# Force in case redoing the install and files already zipped
gzip -f $MANDIR/collectl*

chmod 755 $INITDIR/collectl*
chmod 444 $ETCDIR/collectl.conf
chmod 755 $BINDIR/collectl
chmod 444 $DOCDIR/ARTISTIC $DOCDIR/COPYING $DOCDIR/GPL
chmod 755 $SHRDIR/util/*
chmod 444 $SHRDIR/formatit.ph $SHRDIR/*expr.ph $SHRDIR/vmstat.ph

# remove any stale versions in case the names/numbers used have changed.
# on new ROCKS installion 'rm' isn't there yet!  [thanks roy]
if [ -x /bin/rm ] ; then
  /bin/rm -f $INITDIR/rc*.d/*collectl
  /bin/rm -f $ETCDIR/rc.d/rc*.d/*collectl
fi

# Try and decide which distro this is based on distro specific files.
distro=1
if [ -f /sbin/yast ]; then
    distro=2
    mv -f $INITDIR/collectl-suse $INITDIR/collectl
    rm -f $INITDIR/collectl-debian
    rm -f $INITDIR/collectl-generic
fi

# debian
if [ -f /usr/sbin/update-rc.d ]; then
    distro=3
    mv -f $INITDIR/collectl-debian $INITDIR/collectl
    rm -f $INITDIR/collectl-suse
    rm -f $INITDIR/collectl-generic

    # only if we're installing under /
    [ "$DESTDIR" = "/" ] && update-rc.d collectl defaults
fi

# redhat
if [ -f /etc/redhat-release ]; then
    distro=4
    rm -f $INITDIR/collectl-suse
    rm -f $INITDIR/collectl-debian
    rm -f $INITDIR/collectl-generic
    [ "$DESTDIR" = "/" ] && chkconfig --add collectl
fi

# gentoo
if [ -f $ETCDIR/gentoo-release ]; then
    distro=5
    mv -f $INITDIR/collectl-generic $INITDIR/collectl
    rm -f $INITDIR/collectl-suse
    rm -f $INITDIR/collectl-debian
    [ "$DESTDIR" = "/" ] && rc-update -a collectl default
fi

# Generic Distros
# If /etc/init.d doesn't exist and/or there's no way to use chkconfig or 
# rc-update you're going to have to add some custom code below...
if [ ${distro} = 1 ]; then

    mv -f $INITDIR/collectl-generic $INITDIR/collectl
    rm -f $INITDIR/collectl-suse
    rm -f $INITDIR/collectl-debian

    # If in not installing under / there's nothing extra do
    [ $DESTDIR != "/" ] && exit 0

    # figure out how to handle reboots
    if [ -f /sbin/chkconfig ]; then
        chkconfig --add collectl
    elif [ -f /sbin/rc-update ]; then
        rc-update -a collectl default
    else
        echo "could not figure out how to enable restarting across reboots"
    fi
fi