[181] | 1 | #!/bin/bash
|
---|
[932] | 2 | #
|
---|
| 3 | # $Id: install.sh 932 2006-11-15 11:40:15Z 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
|
---|
[181] | 10 |
|
---|
[186] | 11 | if [ "_$PREFIX" != "_" ]; then
|
---|
[236] | 12 | local=$PREFIX
|
---|
[181] | 13 | if [ -f /usr/local/sbin/mindi ]; then
|
---|
| 14 | echo "WARNING: /usr/local/sbin/mindi exists. You should probably remove it !"
|
---|
| 15 | fi
|
---|
[236] | 16 | conf=$CONFDIR/mindi
|
---|
[186] | 17 | echo $PATH | grep /usr/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add /usr/sbin to your PATH."
|
---|
[181] | 18 | else
|
---|
| 19 | local=/usr/local
|
---|
| 20 | if [ -f /usr/sbin/mindi ]; then
|
---|
| 21 | echo "WARNING: /usr/sbin/mindi exists. You should probably remove the mindi package !"
|
---|
| 22 | fi
|
---|
| 23 | conf=$local/etc/mindi
|
---|
[186] | 24 | echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
|
---|
[181] | 25 | fi
|
---|
| 26 |
|
---|
[1] | 27 | if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
|
---|
| 28 | local=/ramdisk/usr
|
---|
| 29 | export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
|
---|
| 30 | fi
|
---|
| 31 |
|
---|
[238] | 32 | MINDIVER=`cat VERSION`
|
---|
[244] | 33 | MINDIREV=`cat REVISION`
|
---|
| 34 | echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
|
---|
[181] | 35 |
|
---|
[250] | 36 | DOCDIR=$local/share/doc/mindi-$MINDIVER
|
---|
| 37 | MANDIR=$local/share/man/man8
|
---|
[244] | 38 |
|
---|
[309] | 39 | ARCH=`/bin/arch`
|
---|
[914] | 40 | echo $ARCH | grep -E '^i[0-9]86$' &> /dev/null && ARCH=i386 && locallib=$local/lib
|
---|
| 41 | echo $ARCH | grep -E '^x86_64$' &> /dev/null && locallib=$local/lib64
|
---|
| 42 | echo $ARCH | grep -E '^ia64$' &> /dev/null && locallib=$local/lib
|
---|
[309] | 43 | export ARCH
|
---|
| 44 |
|
---|
[181] | 45 | echo "Creating target directories ..."
|
---|
[461] | 46 | install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $DOCDIR
|
---|
[1] | 47 |
|
---|
[181] | 48 | echo "Copying files ..."
|
---|
[309] | 49 | install -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
|
---|
[238] | 50 | install -m 644 deplist.txt $conf
|
---|
[461] | 51 | install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
|
---|
[929] | 52 | install -m 444 distributions/conf/mindi.conf.dist $conf
|
---|
| 53 | cat > $conf/mindi.conf << EOF
|
---|
| 54 | #
|
---|
| 55 | # Configuration file for mindi
|
---|
| 56 | #
|
---|
| 57 | # By default values are taken from $conf/mindi.conf.dist
|
---|
| 58 | # You can override them here
|
---|
| 59 | #
|
---|
| 60 | # e.g.
|
---|
| 61 | #
|
---|
| 62 | #mindi_tmp_dir="/var/tmp"
|
---|
| 63 | #
|
---|
| 64 | EOF
|
---|
| 65 | chmod 644 $conf/mindi.conf
|
---|
[236] | 66 |
|
---|
[317] | 67 | cp -af rootfs aux-tools $locallib/mindi
|
---|
[309] | 68 | chmod 755 $locallib/mindi/rootfs/sbin/*
|
---|
| 69 | chmod 755 $locallib/mindi/aux-tools/sbin/*
|
---|
[1] | 70 |
|
---|
[904] | 71 | # Substirute variables for init
|
---|
| 72 | perl -pi -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~ ; s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" $locallib/mindi/rootfs/sbin/init
|
---|
| 73 |
|
---|
| 74 | # Substirute variables for mindi
|
---|
[181] | 75 | if [ "$RPMBUILDMINDI" = "true" ]; then
|
---|
[244] | 76 | sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=/usr~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=/etc/mindi~" -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~" -e "s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" mindi > $local/sbin/mindi
|
---|
[181] | 77 | else
|
---|
[244] | 78 | sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$local~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$conf~" -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~" -e "s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" mindi > $local/sbin/mindi
|
---|
[181] | 79 | fi
|
---|
| 80 | chmod 755 $local/sbin/mindi
|
---|
[489] | 81 | install -m 755 parted2fdisk.pl $local/sbin
|
---|
| 82 | install -m 755 analyze-my-lvm $locallib/mindi
|
---|
[181] | 83 |
|
---|
[250] | 84 | install -m 644 mindi.8 $MANDIR
|
---|
[317] | 85 | install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
|
---|
[181] | 86 |
|
---|
[839] | 87 | if [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
|
---|
[181] | 88 | echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
|
---|
| 89 | fi
|
---|
| 90 |
|
---|
[236] | 91 | # Managing parted2fdisk
|
---|
[1] | 92 | if [ "$ARCH" = "ia64" ] ; then
|
---|
[236] | 93 | (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
|
---|
[309] | 94 | make -f Makefile.parted2fdisk DEST=$locallib/mindi install
|
---|
| 95 | if [ -f $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
|
---|
[181] | 96 | echo "Installing parted2fdisk ..."
|
---|
[309] | 97 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
| 98 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
|
---|
[181] | 99 | else
|
---|
| 100 | echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
|
---|
| 101 | fi
|
---|
[1] | 102 | else
|
---|
[236] | 103 | # FHS requires fdisk under /sbin
|
---|
| 104 | (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
|
---|
[181] | 105 | echo "Symlinking fdisk to parted2fdisk"
|
---|
[309] | 106 | ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
|
---|
[1] | 107 | fi
|
---|
[236] | 108 | # Remove left parted2fdisk
|
---|
[309] | 109 | rm -f $locallib/mindi/rootfs/sbin/parted2fdisk-*
|
---|
[181] | 110 |
|
---|
[238] | 111 | if [ "$RPMBUILDMINDI" != "true" ]; then
|
---|
[309] | 112 | chown -R root:root $locallib/mindi $conf $DOCDIR
|
---|
[489] | 113 | chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
|
---|
[238] | 114 | if [ "$ARCH" = "ia64" ] ; then
|
---|
| 115 | chown root:root $local/sbin/parted2fdisk
|
---|
| 116 | fi
|
---|
| 117 | fi
|
---|
| 118 |
|
---|
[489] | 119 | # Special case for SuSE family where doc is put elsewhere in the RPM
|
---|
[649] | 120 | if [ -e /etc/SuSE-release ]; then
|
---|
[461] | 121 | rm -rf $DOCDIR
|
---|
| 122 | fi
|
---|
| 123 |
|
---|
[588] | 124 | # Special case for Debian family where doc is put elsewhere in the DEB
|
---|
[649] | 125 | if [ -e /etc/debian_version ]; then
|
---|
[588] | 126 | rm -rf $DOCDIR
|
---|
| 127 | fi
|
---|
| 128 |
|
---|
[1] | 129 | exit 0
|
---|