source: trunk/mindi/install.sh @ 649

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

merge -r617:641 $SVN_M/branches/stable

  • Property svn:keywords set to Id
File size: 4.7 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
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=$CONFDIR/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."
22fi
23
24if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
25    local=/ramdisk/usr
26    export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
27fi
28
29MINDIVER=`cat VERSION`
30MINDIREV=`cat REVISION`
31echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
32
33DOCDIR=$local/share/doc/mindi-$MINDIVER
34MANDIR=$local/share/man/man8
35
36ARCH=`/bin/arch`
37echo $ARCH | grep -x "i[0-9]86" &> /dev/null && ARCH=i386 && locallib=$local/lib
38# For the moment, we don't build specific x86_64 busybox binaries
39echo $ARCH | grep -x "x86_64" &> /dev/null && ARCH=i386 && locallib=$local/lib64
40echo $ARCH | grep -x "ia64" &> /dev/null && locallib=$local/lib
41export ARCH
42
43echo "Creating target directories ..."
44install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $DOCDIR
45
46echo "Copying files ..."
47install -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
48install -m 644 deplist.txt $conf
49install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
50install -m 755 distributions/conf/mindi.conf $conf
51
52cp -af rootfs aux-tools $locallib/mindi
53chmod 755 $locallib/mindi/rootfs/bin/*
54chmod 755 $locallib/mindi/rootfs/sbin/*
55chmod 755 $locallib/mindi/aux-tools/sbin/*
56chmod 755 $conf/mindi.conf
57
58if [ "$RPMBUILDMINDI" = "true" ]; then
59    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
60else
61    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
62fi
63chmod 755 $local/sbin/mindi
64install -m 755 parted2fdisk.pl $local/sbin
65install -m 755 analyze-my-lvm $locallib/mindi
66
67install -m 644 mindi.8 $MANDIR
68install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
69
70# Managing busybox
71if [ -f $locallib/mindi/rootfs/bin/busybox-$ARCH ]; then
72        echo "Installing busybox ..."
73        install -s -m 755 $locallib/mindi/rootfs/bin/busybox-$ARCH $locallib/mindi/rootfs/bin/busybox
74else
75        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
76fi
77if [ "$ARCH" = "i386" ] ; then
78    if [ -f $locallib/mindi/rootfs/bin/busybox-$ARCH.net ]; then
79        echo "Installing busybox.net ..."
80        install -s -m 755 $locallib/mindi/rootfs/bin/busybox-$ARCH.net $locallib/mindi/rootfs/bin/busybox.net
81    else
82        echo "WARNING: no busybox.net found, mindi will not work on this arch ($ARCH) with network"
83    fi
84fi
85# Remove left busybox
86rm -f $locallib/mindi/rootfs/bin/busybox-*
87
88# Managing parted2fdisk
89if [ "$ARCH" = "ia64" ] ; then
90    (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
91    make -f Makefile.parted2fdisk DEST=$locallib/mindi install
92    if [ -f $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
93        echo "Installing parted2fdisk ..."
94        install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $locallib/mindi/rootfs/sbin/parted2fdisk
95        install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
96    else
97        echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
98    fi
99else
100    # FHS requires fdisk under /sbin
101    (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
102    echo "Symlinking fdisk to parted2fdisk"
103    ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
104fi
105# Remove left parted2fdisk
106rm -f $locallib/mindi/rootfs/sbin/parted2fdisk-*
107
108if [ "$RPMBUILDMINDI" != "true" ]; then
109    chown -R root:root $locallib/mindi $conf $DOCDIR
110    chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
111    if [ "$ARCH" = "ia64" ] ; then
112        chown root:root $local/sbin/parted2fdisk
113    fi
114fi
115
116# Special case for SuSE family where doc is put elsewhere in the RPM
117if [ -e /etc/SuSE-release ]; then
118    rm -rf $DOCDIR
119fi
120
121# Special case for Debian family where doc is put elsewhere in the DEB
122if [ -e /etc/debian_version ]; then
123    rm -rf $DOCDIR
124fi
125
126exit 0
Note: See TracBrowser for help on using the repository browser.