source: branches/2.2.9/mindi/install.sh @ 2183

Last change on this file since 2183 was 2183, checked in by bruno, 10 years ago

Tries to solve issue on ia64 where perl modules used by mindi were missing by adding a dedicated script handling them based on what is used on mandriva to make rpm deps

  • Property svn:keywords set to Id
File size: 3.6 KB
RevLine 
[179]1#!/bin/bash
[916]2#
3# $Id: install.sh 2183 2009-04-30 15:52:54Z bruno $
4#
[1]5
6if [ ! -f "mindi" ] ; then
7    echo "Please 'cd' to the directory you have just untarred." >> /dev/stderr
8    exit 1
9fi
[179]10
[184]11if [ "_$PREFIX" != "_" ]; then
[936]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
[179]21else
22    local=/usr/local
[936]23    sublocal=$local
[179]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
[936]28    subconf=$conf
[185]29    echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
[179]30fi
31
[1]32if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
33    local=/ramdisk/usr
[936]34    sublocal=$local
35    conf=/ramdisk/etc
36    subconf=$conf
[1]37    export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
38fi
39
[1620]40MINDIVER=PBVER
41MINDIREV=PBREV
[1565]42ARCH=`/bin/uname -m`
[243]43echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
[179]44
[1510]45if [ _"$CACHEDIR" = _"" ]; then
46    CACHEDIR=$local/var/cache/mindi
47else
48    CACHEDIR=${HEAD}$CACHEDIR
49fi
[1490]50if [ _"$MANDIR" = _"" ]; then
[933]51    MANDIR=$local/share/man/man8
52else
[936]53    MANDIR=${HEAD}$MANDIR/man8
[933]54fi
[1490]55if [ _"$DOCDIR" = _"" ]; then
[933]56    DOCDIR=$local/share/doc/mindi-$MINDIVER
57else
[936]58    DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
[933]59fi
[1490]60if [ _"$LIBDIR" = _"" ]; then
[933]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
[937]64    sublocallib="$locallib/mindi"
[936]65else
66    locallib=${HEAD}$LIBDIR
[937]67    sublocallib="$LIBDIR/mindi"
[933]68fi
[241]69
[179]70echo "Creating target directories ..."
[1989]71install -m 755 -d $conf $locallib/mindi $MANDIR $local/sbin $CACHEDIR
[1]72
[179]73echo "Copying files ..."
[1983]74cp -af rootfs $locallib/mindi
[306]75chmod 755 $locallib/mindi/rootfs/sbin/*
[1712]76install -m 755 analyze-my-lvm $locallib/mindi
[1983]77install -m 644 msg-txt dev.tgz $locallib/mindi
[1761]78install -m 644 deplist.txt udev.files proliant.files $conf
[2183]79install -m 755 mindi-bkphw > $local/sbin
80install -m 755 mindi-get-perl-modules $local/sbin
81install -m 755 parted2fdisk.pl $local/sbin
[1]82
[934]83# Substitute variables for mindi
[1698]84sed -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
[1774]85chmod 755 $local/sbin/mindi $local/sbin/mindi-bkphw
[179]86
[248]87install -m 644 mindi.8 $MANDIR
[1682]88#install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
[179]89
[1236]90if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
[179]91        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
92fi
93
[235]94# Managing parted2fdisk
[1]95if [ "$ARCH" = "ia64" ] ; then
[235]96    (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
[1801]97    install -s -m 755 $local/sbin/parted2fdisk.pl $locallib/mindi/rootfs/sbin/parted2fdisk
[1]98else
[235]99    # FHS requires fdisk under /sbin
100    (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
[179]101    echo "Symlinking fdisk to parted2fdisk"
[306]102    ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
[1]103fi
[179]104
[1510]105if [ "$PKGBUILDMINDI" != "true" ]; then
[1682]106    chown -R root:root $locallib/mindi $conf # $DOCDIR
[543]107    chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
[237]108    if [ "$ARCH" = "ia64" ] ; then
109        chown root:root $local/sbin/parted2fdisk
110    fi
111fi
112
[2183]113# Generate the list of perl modules needed at restore time for mindi
114cat > $conf/perl-scripts << EOF
115$local/sbin/mindi-get-perl-modules
116$local/sbin/mindi-bkphw
117$local/sbin/parted2fdisk.pl
118EOF
119
[1]120exit 0
Note: See TracBrowser for help on using the repository browser.