[179] | 1 | #!/bin/bash
|
---|
[916] | 2 | #
|
---|
| 3 | # $Id: install.sh 1842 2007-12-15 01:24:34Z 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
|
---|
| 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] | 21 | else
|
---|
| 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] | 30 | fi
|
---|
| 31 |
|
---|
[1] | 32 | if 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
|
---|
| 38 | fi
|
---|
| 39 |
|
---|
[1619] | 40 | MINDIVER=PBVER
|
---|
| 41 | MINDIREV=PBREV
|
---|
[1570] | 42 | ARCH=`/bin/uname -m`
|
---|
[243] | 43 | echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
|
---|
[179] | 44 |
|
---|
[1513] | 45 | if [ _"$CACHEDIR" = _"" ]; then
|
---|
| 46 | CACHEDIR=$local/var/cache/mindi
|
---|
| 47 | else
|
---|
| 48 | CACHEDIR=${HEAD}$CACHEDIR
|
---|
| 49 | fi
|
---|
[1500] | 50 | if [ _"$MANDIR" = _"" ]; then
|
---|
[933] | 51 | MANDIR=$local/share/man/man8
|
---|
| 52 | else
|
---|
[936] | 53 | MANDIR=${HEAD}$MANDIR/man8
|
---|
[933] | 54 | fi
|
---|
[1500] | 55 | if [ _"$DOCDIR" = _"" ]; then
|
---|
[933] | 56 | DOCDIR=$local/share/doc/mindi-$MINDIVER
|
---|
| 57 | else
|
---|
[936] | 58 | DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
|
---|
[933] | 59 | fi
|
---|
[1500] | 60 | if [ _"$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] | 65 | else
|
---|
| 66 | locallib=${HEAD}$LIBDIR
|
---|
[937] | 67 | sublocallib="$LIBDIR/mindi"
|
---|
[933] | 68 | fi
|
---|
[241] | 69 |
|
---|
[179] | 70 | echo "Creating target directories ..."
|
---|
[1693] | 71 | install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $CACHEDIR # $DOCDIR
|
---|
[1] | 72 |
|
---|
[179] | 73 | echo "Copying files ..."
|
---|
[1603] | 74 | install -m 644 isolinux.cfg msg-txt isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
|
---|
[1047] | 75 | install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
|
---|
| 76 | install -m 444 distributions/conf/mindi.conf.dist $conf
|
---|
[1075] | 77 | #
|
---|
| 78 | # Compute mindi.conf.dist (cecked by mindi) to avoid changes here
|
---|
| 79 | # Modify the checksum file so that path is correct at execution time
|
---|
| 80 | #
|
---|
[1060] | 81 | md5sum $conf/mindi.conf.dist > $conf/mindi.conf.dist.md5
|
---|
[1075] | 82 | perl -pi -e "s~$conf~$subconf~" $conf/mindi.conf.dist.md5
|
---|
| 83 | #
|
---|
| 84 | # Example of mindi.conf
|
---|
| 85 | #
|
---|
[1276] | 86 | if [ ! -e $conf/mindi.conf ]; then
|
---|
| 87 | cat > $conf/mindi.conf << EOF
|
---|
[1047] | 88 | #
|
---|
| 89 | # Configuration file for mindi
|
---|
| 90 | #
|
---|
| 91 | # By default values are taken from $conf/mindi.conf.dist
|
---|
| 92 | # You can override them here
|
---|
| 93 | #
|
---|
| 94 | # e.g.
|
---|
| 95 | #
|
---|
| 96 | #mindi_tmp_dir="/var/tmp"
|
---|
| 97 | #
|
---|
| 98 | EOF
|
---|
[1276] | 99 | chmod 644 $conf/mindi.conf
|
---|
| 100 | fi
|
---|
[235] | 101 |
|
---|
[1075] | 102 | #
|
---|
| 103 | # Example of deplist.txt
|
---|
| 104 | #
|
---|
[1276] | 105 | if [ ! -e $conf/deplist.txt ]; then
|
---|
| 106 | cat > $conf/deplist.txt << EOF
|
---|
[1060] | 107 | # mindi additional dependency list
|
---|
| 108 | #
|
---|
| 109 | # NB:
|
---|
| 110 | # You have to give an absolute path
|
---|
| 111 | # If you want to add something, just add it on its own line. K.I.S.S.
|
---|
| 112 |
|
---|
| 113 | EOF
|
---|
[1276] | 114 | chmod 644 $conf/deplist.txt
|
---|
| 115 | fi
|
---|
[1060] | 116 |
|
---|
[311] | 117 | cp -af rootfs aux-tools $locallib/mindi
|
---|
[1063] | 118 | if [ -e FindDistroFailsafe ]; then
|
---|
| 119 | cp -af FindDistroFailsafe $locallib/mindi
|
---|
| 120 | fi
|
---|
[306] | 121 | chmod 755 $locallib/mindi/rootfs/sbin/*
|
---|
| 122 | chmod 755 $locallib/mindi/aux-tools/sbin/*
|
---|
[1770] | 123 | install -m 755 analyze-my-lvm $locallib/mindi
|
---|
| 124 | install -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
|
---|
| 125 | install -m 644 deplist.txt udev.files proliant.files $conf
|
---|
[1] | 126 |
|
---|
[934] | 127 | # Substitute variables for mindi
|
---|
[1770] | 128 | sed -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
|
---|
| 129 | sed -e "s~= "YYY"~= "$subconf"~" mindi-bkphw > $local/sbin/mindi-bkphw
|
---|
[543] | 130 | install -m 755 parted2fdisk.pl $local/sbin
|
---|
[179] | 131 |
|
---|
[248] | 132 | install -m 644 mindi.8 $MANDIR
|
---|
[1693] | 133 | #install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
|
---|
[179] | 134 |
|
---|
[1089] | 135 | if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
|
---|
[179] | 136 | echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
|
---|
| 137 | fi
|
---|
| 138 |
|
---|
[235] | 139 | # Managing parted2fdisk
|
---|
[1] | 140 | if [ "$ARCH" = "ia64" ] ; then
|
---|
[235] | 141 | (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
|
---|
[1842] | 142 | install -s -m 755 $local/sbin/parted2fdisk.pl $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
| 143 | # Try to avoid the need ot additional perl modules at the moment
|
---|
| 144 | perl -pi -e 's/use strict;//' $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
[1] | 145 | else
|
---|
[235] | 146 | # FHS requires fdisk under /sbin
|
---|
| 147 | (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
|
---|
[179] | 148 | echo "Symlinking fdisk to parted2fdisk"
|
---|
[306] | 149 | ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
|
---|
[1] | 150 | fi
|
---|
[179] | 151 |
|
---|
[1513] | 152 | if [ "$PKGBUILDMINDI" != "true" ]; then
|
---|
[1693] | 153 | chown -R root:root $locallib/mindi $conf # $DOCDIR
|
---|
[543] | 154 | chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
|
---|
[237] | 155 | if [ "$ARCH" = "ia64" ] ; then
|
---|
| 156 | chown root:root $local/sbin/parted2fdisk
|
---|
| 157 | fi
|
---|
| 158 | fi
|
---|
| 159 |
|
---|
[542] | 160 | # Special case for SuSE family where doc is put elsewhere in the RPM
|
---|
[1693] | 161 | # if [ -e /etc/SuSE-release ]; then
|
---|
| 162 | # rm -rf $DOCDIR
|
---|
| 163 | # fi
|
---|
[542] | 164 |
|
---|
[581] | 165 | # Special case for Debian family where doc is put elsewhere in the DEB
|
---|
[1693] | 166 | # if [ -e /etc/debian_version ]; then
|
---|
| 167 | # rm -rf $DOCDIR
|
---|
| 168 | # fi
|
---|
[581] | 169 |
|
---|
[1] | 170 | exit 0
|
---|