source: trunk/mindi/install.sh @ 219

Last change on this file since 219 was 219, checked in by bcornec, 14 years ago

merge -r176:218 $SVN_M/branches/2.05

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1#!/bin/bash
2
3if [ ! -f "mindi" ] ; then
4    echo "Please 'cd' to the directory you have just untarred." >> /dev/stderr
5    exit 1
6fi
7
8if [ "_$PREFIX" != "_" ]; then
9    local=$PREFIX/usr
10    if [ -f /usr/local/sbin/mindi ]; then
11        echo "WARNING: /usr/local/sbin/mindi exists. You should probably remove it !"
12    fi
13    conf=$PREFIX/etc/mindi
14    echo $PATH | grep /usr/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add /usr/sbin to your PATH."
15else
16    local=/usr/local
17    if [ -f /usr/sbin/mindi ]; then
18        echo "WARNING: /usr/sbin/mindi exists. You should probably remove the mindi package !"
19    fi
20    conf=$local/etc/mindi
21    echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
22
23fi
24
25if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
26    local=/ramdisk/usr
27    export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
28fi
29
30echo "mindi will be installed under $local"
31
32echo "Creating target directories ..."
33mkdir -p $local/lib/mindi
34mkdir -p $local/share/man/man8
35mkdir -p $local/sbin
36mkdir -p $conf
37
38echo "Copying files ..."
39cp deplist.txt $conf
40cp -af rootfs aux-tools isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg parted2fdisk.pl syslinux.cfg syslinux-H.cfg dev.tgz Mindi $local/lib/mindi
41chmod 755 $local/lib/mindi/rootfs/bin/*
42chmod 755 $local/lib/mindi/rootfs/sbin/*
43chmod 755 $local/lib/mindi/aux-tools/sbin/*
44
45cp -af analyze-my-lvm parted2fdisk.pl $local/sbin
46if [ "$RPMBUILDMINDI" = "true" ]; then
47    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=/usr~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=/etc/mindi~" mindi > $local/sbin/mindi
48else
49    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$local~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$conf~" mindi > $local/sbin/mindi
50fi
51chmod 755 $local/sbin/mindi
52chmod 755 $local/sbin/analyze-my-lvm
53chmod 755 $local/sbin/parted2fdisk.pl
54
55cp -a mindi.8 $local/share/man/man8
56cp -a CHANGES COPYING README README.busybox README.ia64 README.pxe TODO INSTALL $local/share/lib/mindi
57
58echo "Extracting symlinks ..."
59( cd $local/lib/mindi/rootfs && tar -xzf symlinks.tgz )
60
61ARCH=`/bin/arch`
62echo $ARCH | grep -x "i[0-9]86" &> /dev/null && ARCH=i386
63export ARCH
64
65if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH ]; then
66        echo "Installing busybox ..."
67        mv $local/lib/mindi/rootfs/bin/busybox-$ARCH $local/lib/mindi/rootfs/bin/busybox
68else
69        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
70fi
71
72if [ "$ARCH" = "i386" ] ; then
73    # FHS requires fdisk under /sbin
74    (cd $local/sbin && ln -s /sbin/fdisk parted2fdisk)
75    if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH.net ]; then
76        echo "Installing busybox.net ..."
77        mv $local/lib/mindi/rootfs/bin/busybox-$ARCH.net $local/lib/mindi/rootfs/bin/busybox.net
78    else
79        echo "WARNING: no busybox.net found, mindi will not work on this arch ($ARCH) with network"
80    fi
81fi
82
83if [ "$ARCH" = "ia64" ] ; then
84    (cd $local/sbin && ln -s parted2fdisk.pl parted2fdisk)
85    make -f Makefile.parted2fdisk DEST=$local/lib/mindi install
86    if [ -f $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
87        echo "Installing parted2fdisk ..."
88        mv $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/lib/mindi/rootfs/sbin/parted2fdisk
89    else
90        echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
91    fi
92else
93    echo "Symlinking fdisk to parted2fdisk"
94    ( cd $local/lib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
95fi
96
97exit 0
Note: See TracBrowser for help on using the repository browser.