source: branches/2.2.10/mindi/install.sh @ 2460

Last change on this file since 2460 was 2460, checked in by Bruno Cornec, 11 years ago
  • Adds a conf file example for mindi and fix #360 + mode of file
  • Apply path from Matthew Cline (matt_at_nightrealms.com) in order to fix #359
  • Adds support for libcrc32c (needed by bnx2x)
  • afio is under /bin on Debian
  • Fix an error in the test for grub conf files (or used instead of and)
  • Fix a bug in handling of -E option with real devices (bad report in function mr_make_devlist_from_pathlist of the test between -E and -I)
  • CIFS mounts shouldn't be part of the mountlist analysis (should help solving #288)
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1#!/bin/bash
2#
3# $Id: install.sh 2460 2009-10-09 13:18:59Z bruno $
4#
5
6if [ ! -f "mindi" ] ; then
7    echo "Please 'cd' to the directory you have just untarred." >> /dev/stderr
8    exit 1
9fi
10
11if [ "_$PREFIX" != "_" ]; then
12    local=${HEAD}$PREFIX
13    sublocal=$PREFIX
14    if [ "_$CONFDIR" != "_" ]; then
15        conf=${HEAD}$CONFDIR/mindi
16        subconf=$CONFDIR/mindi
17    else
18        echo "CONFDIR should be defined if PREFIX is defined"
19        exit -1
20    fi
21else
22    local=/usr/local
23    sublocal=$local
24    if [ -f /usr/sbin/mindi ]; then
25        echo "WARNING: /usr/sbin/mindi exists. You should probably remove the mindi package !"
26    fi
27    conf=$local/etc/mindi
28    subconf=$conf
29    echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
30fi
31
32if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
33    local=/ramdisk/usr
34    sublocal=$local
35    conf=/ramdisk/etc
36    subconf=$conf
37    export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
38fi
39
40MINDIVER=PBVER
41MINDIREV=PBREV
42ARCH=`/bin/uname -m`
43echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
44
45if [ _"$CACHEDIR" = _"" ]; then
46    CACHEDIR=$local/var/cache/mindi
47else
48    CACHEDIR=${HEAD}$CACHEDIR
49fi
50if [ _"$MANDIR" = _"" ]; then
51    MANDIR=$local/share/man/man8
52else
53    MANDIR=${HEAD}$MANDIR/man8
54fi
55if [ _"$DOCDIR" = _"" ]; then
56    DOCDIR=$local/share/doc/mindi-$MINDIVER
57else
58    DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
59fi
60if [ _"$LIBDIR" = _"" ]; then
61    echo $ARCH | grep -E '^i[0-9]86$' &> /dev/null && ARCH=i386 && locallib=$local/lib
62    echo $ARCH | grep -E '^x86_64$' &> /dev/null && locallib=$local/lib64
63    echo $ARCH | grep -E '^ia64$' &> /dev/null && locallib=$local/lib
64    sublocallib="$locallib/mindi"
65else
66    locallib=${HEAD}$LIBDIR
67    sublocallib="$LIBDIR/mindi"
68fi
69
70echo "Creating target directories ..."
71install -m 755 -d $conf $locallib/mindi $MANDIR $local/sbin $CACHEDIR $conf/deplist.d
72
73echo "Copying files ..."
74cp -af rootfs $locallib/mindi
75chmod 755 $locallib/mindi/rootfs/sbin/*
76install -m 755 analyze-my-lvm $locallib/mindi
77install -m 644 msg-txt dev.tgz $locallib/mindi
78install -m 644 deplist.conf deplist-minimal.conf udev.files proliant.files mindi.conf $conf
79for f in deplist.d/*.conf; do
80    install -m 644 $f $conf/deplist.d
81done
82for f in mindi-bkphw mindi-get-perl-modules parted2fdisk.pl; do
83    install -m 755 $f $local/sbin
84done
85
86# Substitute variables for mindi
87sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$sublocal~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$subconf~" -e "s~^MINDI_LIB=LLL~MINDI_LIB=$sublocallib~" mindi > $local/sbin/mindi
88chmod 755 $local/sbin/mindi $local/sbin/mindi-bkphw
89
90install -m 644 mindi.8 $MANDIR
91#install -m 644 ChangeLog COPYING README README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
92
93# Managing parted2fdisk
94if [ "$ARCH" = "ia64" ] ; then
95    (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
96    install -s -m 755 $local/sbin/parted2fdisk.pl $locallib/mindi/rootfs/sbin/parted2fdisk
97else
98    # FHS requires fdisk under /sbin
99    (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
100    echo "Symlinking fdisk to parted2fdisk"
101    ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
102fi
103
104if [ "$PKGBUILDMINDI" != "true" ]; then
105    chown -R root:root $locallib/mindi $conf # $DOCDIR
106    chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
107    if [ "$ARCH" = "ia64" ] ; then
108        chown root:root $local/sbin/parted2fdisk
109    fi
110fi
111
112# Generate the list of perl modules needed at restore time for mindi
113cat > $conf/perl-scripts << EOF
114$sublocal/sbin/mindi-get-perl-modules
115$sublocal/sbin/mindi-bkphw
116$sublocal/sbin/parted2fdisk.pl
117EOF
118
119exit 0
Note: See TracBrowser for help on using the repository browser.