[179] | 1 | #!/bin/bash
|
---|
[916] | 2 | #
|
---|
| 3 | # $Id: post-install.sh 2149 2009-02-16 16:50:07Z bruno $
|
---|
| 4 | #
|
---|
[1] | 5 |
|
---|
| 6 | if [ ! -f "mindi" ] ; then
|
---|
| 7 | echo "Please 'cd' to the directory you have just untarred." >> /dev/stderr
|
---|
| 8 | exit 1
|
---|
| 9 | fi
|
---|
[179] | 10 |
|
---|
[184] | 11 | if [ "_$PREFIX" != "_" ]; then
|
---|
[936] | 12 | local=${HEAD}$PREFIX
|
---|
| 13 | sublocal=$PREFIX
|
---|
| 14 | if [ "_$CONFDIR" != "_" ]; then
|
---|
[2149] | 15 | conf=${HEAD}$CONFDIR/PBPROJ
|
---|
| 16 | subconf=$CONFDIR/PBPROJ
|
---|
[936] | 17 | else
|
---|
| 18 | echo "CONFDIR should be defined if PREFIX is defined"
|
---|
| 19 | exit -1
|
---|
| 20 | fi
|
---|
[179] | 21 | else
|
---|
| 22 | local=/usr/local
|
---|
[936] | 23 | sublocal=$local
|
---|
[2149] | 24 | if [ -f /usr/bin/mindi ]; then
|
---|
| 25 | echo "WARNING: /usr/bin/mindi exists. You should probably remove the mindi package !"
|
---|
[179] | 26 | fi
|
---|
[2149] | 27 | conf=$local/etc/PBPROJ
|
---|
[936] | 28 | subconf=$conf
|
---|
[179] | 29 | fi
|
---|
| 30 |
|
---|
[2149] | 31 | if [ _"$CACHEDIR" = _"" ]; then
|
---|
| 32 | CACHEDIR=$local/var/cache/mindi
|
---|
| 33 | else
|
---|
| 34 | CACHEDIR=${HEAD}$CACHEDIR
|
---|
| 35 | fi
|
---|
| 36 | locallib=$local/share/lib
|
---|
| 37 | sublocallib="$locallib/PBPROJ"
|
---|
| 38 |
|
---|
| 39 |
|
---|
[1] | 40 | if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
|
---|
| 41 | local=/ramdisk/usr
|
---|
[936] | 42 | sublocal=$local
|
---|
| 43 | conf=/ramdisk/etc
|
---|
| 44 | subconf=$conf
|
---|
[1] | 45 | export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
[1620] | 48 | MINDIVER=PBVER
|
---|
| 49 | MINDIREV=PBREV
|
---|
[1565] | 50 | ARCH=`/bin/uname -m`
|
---|
[243] | 51 | echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
|
---|
[179] | 52 |
|
---|
| 53 | echo "Creating target directories ..."
|
---|
[2149] | 54 | install -m 755 -d $conf $sublocallib $CACHEDIR
|
---|
[1] | 55 |
|
---|
[179] | 56 | echo "Copying files ..."
|
---|
[2149] | 57 | cp -af rootfs $sublocallib/mindi
|
---|
| 58 | chmod 755 $sublocallib/mindi/rootfs/sbin/*
|
---|
| 59 | install -m 644 msg-txt dev.tgz $sublocallib/mindi
|
---|
[1761] | 60 | install -m 644 deplist.txt udev.files proliant.files $conf
|
---|
[1] | 61 |
|
---|
[934] | 62 | # Substitute variables for mindi
|
---|
[2149] | 63 | sed -i -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$sublocal~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$subconf~" -e "s~^MINDI_LIB=LLL~MINDI_LIB=$sublocallib~" $local/bin/mindi
|
---|
| 64 | sed -i -e "s~= "YYY"~= "$subconf"~" $local/bin/mindi-bkphw
|
---|
[543] | 65 | install -m 755 parted2fdisk.pl $local/sbin
|
---|
[179] | 66 |
|
---|
[235] | 67 | # Managing parted2fdisk
|
---|
[1] | 68 | if [ "$ARCH" = "ia64" ] ; then
|
---|
[235] | 69 | (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
|
---|
[1801] | 70 | install -s -m 755 $local/sbin/parted2fdisk.pl $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
[1802] | 71 | # Try to avoid the need ot additional perl modules at the moment
|
---|
| 72 | perl -pi -e 's/use strict;//' $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
[1] | 73 | else
|
---|
[235] | 74 | # FHS requires fdisk under /sbin
|
---|
| 75 | (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
|
---|
[179] | 76 | echo "Symlinking fdisk to parted2fdisk"
|
---|
[306] | 77 | ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
|
---|
[1] | 78 | fi
|
---|
[179] | 79 |
|
---|
[1510] | 80 | if [ "$PKGBUILDMINDI" != "true" ]; then
|
---|
[2149] | 81 | chown -R root:root $sublocallib/mindi $conf
|
---|
| 82 | chown root:root $local/sbin/parted2fdisk.pl
|
---|
[237] | 83 | if [ "$ARCH" = "ia64" ] ; then
|
---|
| 84 | chown root:root $local/sbin/parted2fdisk
|
---|
| 85 | fi
|
---|
| 86 | fi
|
---|
| 87 |
|
---|
[1] | 88 | exit 0
|
---|