[181] | 1 | #!/bin/bash
|
---|
[932] | 2 | #
|
---|
| 3 | # $Id: install.sh 1106 2007-02-07 22:55:11Z 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
|
---|
[939] | 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
|
---|
[181] | 21 | else
|
---|
| 22 | local=/usr/local
|
---|
[939] | 23 | sublocal=$local
|
---|
[181] | 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
|
---|
[939] | 28 | subconf=$conf
|
---|
[186] | 29 | echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
|
---|
[181] | 30 | fi
|
---|
| 31 |
|
---|
[1] | 32 | if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
|
---|
| 33 | local=/ramdisk/usr
|
---|
[939] | 34 | sublocal=$local
|
---|
| 35 | conf=/ramdisk/etc
|
---|
| 36 | subconf=$conf
|
---|
[1] | 37 | export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
|
---|
| 38 | fi
|
---|
| 39 |
|
---|
[238] | 40 | MINDIVER=`cat VERSION`
|
---|
[244] | 41 | MINDIREV=`cat REVISION`
|
---|
| 42 | echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
|
---|
[181] | 43 |
|
---|
[939] | 44 | if [ _"$MANDIR" == _"" ]; then
|
---|
| 45 | MANDIR=$local/share/man/man8
|
---|
| 46 | else
|
---|
| 47 | MANDIR=${HEAD}$MANDIR/man8
|
---|
| 48 | fi
|
---|
| 49 | if [ _"$DOCDIR" == _"" ]; then
|
---|
| 50 | DOCDIR=$local/share/doc/mindi-$MINDIVER
|
---|
| 51 | else
|
---|
| 52 | DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
|
---|
| 53 | fi
|
---|
| 54 | if [ _"$LIBDIR" == _"" ]; then
|
---|
| 55 | ARCH=`/bin/arch`
|
---|
| 56 | echo $ARCH | grep -E '^i[0-9]86$' &> /dev/null && ARCH=i386 && locallib=$local/lib
|
---|
| 57 | echo $ARCH | grep -E '^x86_64$' &> /dev/null && locallib=$local/lib64
|
---|
| 58 | echo $ARCH | grep -E '^ia64$' &> /dev/null && locallib=$local/lib
|
---|
| 59 | sublocallib="$locallib/mindi"
|
---|
| 60 | else
|
---|
| 61 | locallib=${HEAD}$LIBDIR
|
---|
| 62 | sublocallib="$LIBDIR/mindi"
|
---|
| 63 | fi
|
---|
[244] | 64 |
|
---|
[181] | 65 | echo "Creating target directories ..."
|
---|
[461] | 66 | install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $DOCDIR
|
---|
[1] | 67 |
|
---|
[181] | 68 | echo "Copying files ..."
|
---|
[309] | 69 | install -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
|
---|
[461] | 70 | install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
|
---|
[929] | 71 | install -m 444 distributions/conf/mindi.conf.dist $conf
|
---|
[1079] | 72 | #
|
---|
| 73 | # Compute mindi.conf.dist (cecked by mindi) to avoid changes here
|
---|
| 74 | # Modify the checksum file so that path is correct at execution time
|
---|
| 75 | #
|
---|
| 76 | md5sum $conf/mindi.conf.dist > $conf/mindi.conf.dist.md5
|
---|
| 77 | perl -pi -e "s~$conf~$subconf~" $conf/mindi.conf.dist.md5
|
---|
| 78 | #
|
---|
| 79 | # Example of mindi.conf
|
---|
| 80 | #
|
---|
[929] | 81 | cat > $conf/mindi.conf << EOF
|
---|
| 82 | #
|
---|
| 83 | # Configuration file for mindi
|
---|
| 84 | #
|
---|
| 85 | # By default values are taken from $conf/mindi.conf.dist
|
---|
| 86 | # You can override them here
|
---|
| 87 | #
|
---|
| 88 | # e.g.
|
---|
| 89 | #
|
---|
| 90 | #mindi_tmp_dir="/var/tmp"
|
---|
| 91 | #
|
---|
| 92 | EOF
|
---|
| 93 | chmod 644 $conf/mindi.conf
|
---|
[1079] | 94 | install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
|
---|
| 95 | install -m 444 distributions/conf/mindi.conf.dist $conf
|
---|
| 96 | cat > $conf/mindi.conf << EOF
|
---|
| 97 | #
|
---|
| 98 | # Configuration file for mindi
|
---|
| 99 | #
|
---|
| 100 | # By default values are taken from $conf/mindi.conf.dist
|
---|
| 101 | # You can override them here
|
---|
| 102 | #
|
---|
| 103 | # e.g.
|
---|
| 104 | #
|
---|
| 105 | #mindi_tmp_dir="/var/tmp"
|
---|
| 106 | #
|
---|
| 107 | EOF
|
---|
| 108 | chmod 644 $conf/mindi.conf
|
---|
[236] | 109 |
|
---|
[1079] | 110 | #
|
---|
| 111 | # Example of deplist.txt
|
---|
| 112 | #
|
---|
| 113 | cat > $conf/deplist.txt << EOF
|
---|
| 114 | # mindi additional dependency list
|
---|
| 115 | #
|
---|
| 116 | # NB:
|
---|
| 117 | # You have to give an absolute path
|
---|
| 118 | # If you want to add something, just add it on its own line. K.I.S.S.
|
---|
| 119 |
|
---|
| 120 | EOF
|
---|
| 121 | chmod 644 $conf/deplist.txt
|
---|
| 122 |
|
---|
[317] | 123 | cp -af rootfs aux-tools $locallib/mindi
|
---|
[1079] | 124 | if [ -e FindDistroFailsafe ]; then
|
---|
| 125 | cp -af FindDistroFailsafe $locallib/mindi
|
---|
| 126 | fi
|
---|
[309] | 127 | chmod 755 $locallib/mindi/rootfs/sbin/*
|
---|
| 128 | chmod 755 $locallib/mindi/aux-tools/sbin/*
|
---|
[1] | 129 |
|
---|
[904] | 130 | # Substirute variables for init
|
---|
| 131 | perl -pi -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~ ; s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" $locallib/mindi/rootfs/sbin/init
|
---|
| 132 |
|
---|
[939] | 133 | # Substitute variables for mindi
|
---|
| 134 | sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$sublocal~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$subconf~" -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~" -e "s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" -e "s~^MINDI_LIB=LLL~MINDI_LIB=$sublocallib~" mindi > $local/sbin/mindi
|
---|
[181] | 135 | chmod 755 $local/sbin/mindi
|
---|
[489] | 136 | install -m 755 parted2fdisk.pl $local/sbin
|
---|
| 137 | install -m 755 analyze-my-lvm $locallib/mindi
|
---|
[181] | 138 |
|
---|
[250] | 139 | install -m 644 mindi.8 $MANDIR
|
---|
[317] | 140 | install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
|
---|
[181] | 141 |
|
---|
[1106] | 142 | if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
|
---|
[181] | 143 | echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
|
---|
| 144 | fi
|
---|
| 145 |
|
---|
[236] | 146 | # Managing parted2fdisk
|
---|
[1] | 147 | if [ "$ARCH" = "ia64" ] ; then
|
---|
[236] | 148 | (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
|
---|
[309] | 149 | make -f Makefile.parted2fdisk DEST=$locallib/mindi install
|
---|
| 150 | if [ -f $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
|
---|
[181] | 151 | echo "Installing parted2fdisk ..."
|
---|
[309] | 152 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
| 153 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
|
---|
[181] | 154 | else
|
---|
| 155 | echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
|
---|
| 156 | fi
|
---|
[1] | 157 | else
|
---|
[236] | 158 | # FHS requires fdisk under /sbin
|
---|
| 159 | (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
|
---|
[181] | 160 | echo "Symlinking fdisk to parted2fdisk"
|
---|
[309] | 161 | ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
|
---|
[1] | 162 | fi
|
---|
[236] | 163 | # Remove left parted2fdisk
|
---|
[309] | 164 | rm -f $locallib/mindi/rootfs/sbin/parted2fdisk-*
|
---|
[181] | 165 |
|
---|
[238] | 166 | if [ "$RPMBUILDMINDI" != "true" ]; then
|
---|
[309] | 167 | chown -R root:root $locallib/mindi $conf $DOCDIR
|
---|
[489] | 168 | chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
|
---|
[238] | 169 | if [ "$ARCH" = "ia64" ] ; then
|
---|
| 170 | chown root:root $local/sbin/parted2fdisk
|
---|
| 171 | fi
|
---|
| 172 | fi
|
---|
| 173 |
|
---|
[489] | 174 | # Special case for SuSE family where doc is put elsewhere in the RPM
|
---|
[649] | 175 | if [ -e /etc/SuSE-release ]; then
|
---|
[461] | 176 | rm -rf $DOCDIR
|
---|
| 177 | fi
|
---|
| 178 |
|
---|
[588] | 179 | # Special case for Debian family where doc is put elsewhere in the DEB
|
---|
[649] | 180 | if [ -e /etc/debian_version ]; then
|
---|
[588] | 181 | rm -rf $DOCDIR
|
---|
| 182 | fi
|
---|
| 183 |
|
---|
[1] | 184 | exit 0
|
---|