[179] | 1 | #!/bin/bash
|
---|
[916] | 2 | #
|
---|
| 3 | # $Id: install.sh 1280 2007-03-28 14:21:54Z 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 |
|
---|
[237] | 40 | MINDIVER=`cat VERSION`
|
---|
[243] | 41 | MINDIREV=`cat REVISION`
|
---|
| 42 | echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
|
---|
[179] | 43 |
|
---|
[933] | 44 | if [ _"$MANDIR" == _"" ]; then
|
---|
| 45 | MANDIR=$local/share/man/man8
|
---|
| 46 | else
|
---|
[936] | 47 | MANDIR=${HEAD}$MANDIR/man8
|
---|
[933] | 48 | fi
|
---|
| 49 | if [ _"$DOCDIR" == _"" ]; then
|
---|
| 50 | DOCDIR=$local/share/doc/mindi-$MINDIVER
|
---|
| 51 | else
|
---|
[936] | 52 | DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
|
---|
[933] | 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
|
---|
[937] | 59 | sublocallib="$locallib/mindi"
|
---|
[936] | 60 | else
|
---|
| 61 | locallib=${HEAD}$LIBDIR
|
---|
[937] | 62 | sublocallib="$LIBDIR/mindi"
|
---|
[933] | 63 | fi
|
---|
[241] | 64 |
|
---|
[179] | 65 | echo "Creating target directories ..."
|
---|
[1047] | 66 | install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $DOCDIR
|
---|
[1] | 67 |
|
---|
[179] | 68 | echo "Copying files ..."
|
---|
[306] | 69 | install -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
|
---|
[1047] | 70 | install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
|
---|
| 71 | install -m 444 distributions/conf/mindi.conf.dist $conf
|
---|
[1075] | 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 | #
|
---|
[1060] | 76 | md5sum $conf/mindi.conf.dist > $conf/mindi.conf.dist.md5
|
---|
[1075] | 77 | perl -pi -e "s~$conf~$subconf~" $conf/mindi.conf.dist.md5
|
---|
| 78 | #
|
---|
| 79 | # Example of mindi.conf
|
---|
| 80 | #
|
---|
[1276] | 81 | if [ ! -e $conf/mindi.conf ]; then
|
---|
| 82 | cat > $conf/mindi.conf << EOF
|
---|
[1047] | 83 | #
|
---|
| 84 | # Configuration file for mindi
|
---|
| 85 | #
|
---|
| 86 | # By default values are taken from $conf/mindi.conf.dist
|
---|
| 87 | # You can override them here
|
---|
| 88 | #
|
---|
| 89 | # e.g.
|
---|
| 90 | #
|
---|
| 91 | #mindi_tmp_dir="/var/tmp"
|
---|
| 92 | #
|
---|
| 93 | EOF
|
---|
[1276] | 94 | chmod 644 $conf/mindi.conf
|
---|
| 95 | fi
|
---|
[235] | 96 |
|
---|
[1075] | 97 | #
|
---|
| 98 | # Example of deplist.txt
|
---|
| 99 | #
|
---|
[1276] | 100 | if [ ! -e $conf/deplist.txt ]; then
|
---|
| 101 | cat > $conf/deplist.txt << EOF
|
---|
[1060] | 102 | # mindi additional dependency list
|
---|
| 103 | #
|
---|
| 104 | # NB:
|
---|
| 105 | # You have to give an absolute path
|
---|
| 106 | # If you want to add something, just add it on its own line. K.I.S.S.
|
---|
| 107 |
|
---|
| 108 | EOF
|
---|
[1276] | 109 | chmod 644 $conf/deplist.txt
|
---|
| 110 | fi
|
---|
[1060] | 111 |
|
---|
[311] | 112 | cp -af rootfs aux-tools $locallib/mindi
|
---|
[1063] | 113 | if [ -e FindDistroFailsafe ]; then
|
---|
| 114 | cp -af FindDistroFailsafe $locallib/mindi
|
---|
| 115 | fi
|
---|
[306] | 116 | chmod 755 $locallib/mindi/rootfs/sbin/*
|
---|
| 117 | chmod 755 $locallib/mindi/aux-tools/sbin/*
|
---|
[1] | 118 |
|
---|
[898] | 119 | # Substirute variables for init
|
---|
| 120 | perl -pi -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~ ; s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" $locallib/mindi/rootfs/sbin/init
|
---|
| 121 |
|
---|
[934] | 122 | # Substitute variables for mindi
|
---|
[936] | 123 | 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
|
---|
[1280] | 124 | sed -e "s~^my \$mindiconf=YYY~my \$mindiconf=$subconf;~" mindi-bkphw > $local/sbin/mindi-bkphw
|
---|
| 125 | chmod 755 $local/sbin/mindi $local/sbin/mindi-bkphw
|
---|
[543] | 126 | install -m 755 parted2fdisk.pl $local/sbin
|
---|
| 127 | install -m 755 analyze-my-lvm $locallib/mindi
|
---|
[179] | 128 |
|
---|
[248] | 129 | install -m 644 mindi.8 $MANDIR
|
---|
[315] | 130 | install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
|
---|
[179] | 131 |
|
---|
[1089] | 132 | if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
|
---|
[179] | 133 | echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
|
---|
| 134 | fi
|
---|
| 135 |
|
---|
[235] | 136 | # Managing parted2fdisk
|
---|
[1] | 137 | if [ "$ARCH" = "ia64" ] ; then
|
---|
[235] | 138 | (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
|
---|
[306] | 139 | make -f Makefile.parted2fdisk DEST=$locallib/mindi install
|
---|
| 140 | if [ -f $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
|
---|
[179] | 141 | echo "Installing parted2fdisk ..."
|
---|
[306] | 142 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $locallib/mindi/rootfs/sbin/parted2fdisk
|
---|
| 143 | install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
|
---|
[179] | 144 | else
|
---|
| 145 | echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
|
---|
| 146 | fi
|
---|
[1] | 147 | else
|
---|
[235] | 148 | # FHS requires fdisk under /sbin
|
---|
| 149 | (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
|
---|
[179] | 150 | echo "Symlinking fdisk to parted2fdisk"
|
---|
[306] | 151 | ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
|
---|
[1] | 152 | fi
|
---|
[235] | 153 | # Remove left parted2fdisk
|
---|
[306] | 154 | rm -f $locallib/mindi/rootfs/sbin/parted2fdisk-*
|
---|
[179] | 155 |
|
---|
[237] | 156 | if [ "$RPMBUILDMINDI" != "true" ]; then
|
---|
[306] | 157 | chown -R root:root $locallib/mindi $conf $DOCDIR
|
---|
[543] | 158 | chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
|
---|
[237] | 159 | if [ "$ARCH" = "ia64" ] ; then
|
---|
| 160 | chown root:root $local/sbin/parted2fdisk
|
---|
| 161 | fi
|
---|
| 162 | fi
|
---|
| 163 |
|
---|
[542] | 164 | # Special case for SuSE family where doc is put elsewhere in the RPM
|
---|
[626] | 165 | if [ -e /etc/SuSE-release ]; then
|
---|
[542] | 166 | rm -rf $DOCDIR
|
---|
| 167 | fi
|
---|
| 168 |
|
---|
[581] | 169 | # Special case for Debian family where doc is put elsewhere in the DEB
|
---|
[626] | 170 | if [ -e /etc/debian_version ]; then
|
---|
[581] | 171 | rm -rf $DOCDIR
|
---|
| 172 | fi
|
---|
| 173 |
|
---|
[1] | 174 | exit 0
|
---|