source: branches/2.05/mindi/install.sh @ 241

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