source: trunk/mindi/install.sh @ 236

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

merge -r229:235 $SVN_M/branches/2.05

  • Property svn:keywords set to Id
File size: 3.9 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
29echo "mindi will be installed under $local"
30
31echo "Creating target directories ..."
32install -g root -o root -m 755 -d $conf $local/lib/mindi $local/share/man/man8 $local/sbin $local/doc/mindi
33
34echo "Copying files ..."
35install -g root -o root -m 644 isolinux.cfg msg-txt sys-disk.raw.gz isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $local/lib/mindi
36install -g root -o root -m 644 deplist.txt $conf
37
38cp -af rootfs aux-tools Mindi $local/lib/mindi
39chmod 755 $local/lib/mindi/rootfs/bin/*
40chmod 755 $local/lib/mindi/rootfs/sbin/*
41chmod 755 $local/lib/mindi/aux-tools/sbin/*
42chown -R root:root $local/lib/mindi
43
44if [ "$RPMBUILDMINDI" = "true" ]; then
45    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=/usr~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=/etc/mindi~" mindi > $local/sbin/mindi
46else
47    sed -e "s~^MINDI_PREFIX=XXX~MINDI_PREFIX=$local~" -e "s~^MINDI_CONF=YYY~MINDI_CONF=$conf~" mindi > $local/sbin/mindi
48fi
49chmod 755 $local/sbin/mindi
50chown root:root $local/sbin/mindi
51install -g root -o root -m 755 analyze-my-lvm parted2fdisk.pl $local/sbin
52
53install -g root -o root -m 644 mindi.8 $local/share/man/man8
54install -g root -o root -m 644 CHANGES COPYING README README.busybox README.ia64 README.pxe TODO INSTALL $local/doc/mindi
55
56ARCH=`/bin/arch`
57echo $ARCH | grep -x "i[0-9]86" &> /dev/null && ARCH=i386
58# For the moment, we don't build specific x86_64 busybox binaries
59echo $ARCH | grep -x "x86_64" &> /dev/null && ARCH=i386
60export ARCH
61
62# Managing busybox
63if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH ]; then
64        echo "Installing busybox ..."
65        install -s -g root -o root -m 755 $local/lib/mindi/rootfs/bin/busybox-$ARCH $local/lib/mindi/rootfs/bin/busybox
66else
67        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
68fi
69if [ "$ARCH" = "i386" ] ; then
70    if [ -f $local/lib/mindi/rootfs/bin/busybox-$ARCH.net ]; then
71        echo "Installing busybox.net ..."
72        install -s -g root -o root -m 755 $local/lib/mindi/rootfs/bin/busybox-$ARCH.net $local/lib/mindi/rootfs/bin/busybox.net
73    else
74        echo "WARNING: no busybox.net found, mindi will not work on this arch ($ARCH) with network"
75    fi
76fi
77# Remove left busybox
78rm -f $local/lib/mindi/rootfs/bin/busybox-*
79
80# Managing parted2fdisk
81if [ "$ARCH" = "ia64" ] ; then
82    (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
83    make -f Makefile.parted2fdisk DEST=$local/lib/mindi install
84    if [ -f $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
85        echo "Installing parted2fdisk ..."
86        install -s -g root -o root -m 755 $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/lib/mindi/rootfs/sbin/parted2fdisk
87        install -s -g root -o root -m 755 $local/lib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
88    else
89        echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
90    fi
91else
92    # FHS requires fdisk under /sbin
93    (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
94    echo "Symlinking fdisk to parted2fdisk"
95    ( cd $local/lib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
96fi
97# Remove left parted2fdisk
98rm -f $local/lib/mindi/rootfs/sbin/parted2fdisk-*
99
100exit 0
Note: See TracBrowser for help on using the repository browser.