source: branches/stable/mindi/install.sh @ 1619

Last change on this file since 1619 was 1619, checked in by bruno, 12 years ago

mondo and mindi seems ok with pb up to local pkg

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1#!/bin/bash
2#
3# $Id: install.sh 1619 2007-09-07 00:55:58Z bruno $
4#
5
6if [ ! -f "mindi" ] ; then
7    echo "Please 'cd' to the directory you have just untarred." >> /dev/stderr
8    exit 1
9fi
10
11if [ "_$PREFIX" != "_" ]; then
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
21else
22    local=/usr/local
23    sublocal=$local
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
28    subconf=$conf
29    echo $PATH | grep $local/sbin > /dev/null || echo "Warning - your PATH environmental variable is BROKEN. Please add $local/sbin to your PATH."
30fi
31
32if uname -a | grep Knoppix > /dev/null || [ -e "/ramdisk/usr" ] ; then
33    local=/ramdisk/usr
34    sublocal=$local
35    conf=/ramdisk/etc
36    subconf=$conf
37    export PATH=/ramdisk/usr/sbin:/ramdisk/usr/bin:/$PATH
38fi
39
40MINDIVER=PBVER
41MINDIREV=PBREV
42ARCH=`/bin/uname -m`
43echo "mindi ${MINDIVER}-r${MINDIREV} will be installed under $local"
44
45if [ _"$CACHEDIR" = _"" ]; then
46    CACHEDIR=$local/var/cache/mindi
47else
48    CACHEDIR=${HEAD}$CACHEDIR
49fi
50if [ _"$MANDIR" = _"" ]; then
51    MANDIR=$local/share/man/man8
52else
53    MANDIR=${HEAD}$MANDIR/man8
54fi
55if [ _"$DOCDIR" = _"" ]; then
56    DOCDIR=$local/share/doc/mindi-$MINDIVER
57else
58    DOCDIR=${HEAD}$DOCDIR/mindi-$MINDIVER
59fi
60if [ _"$LIBDIR" = _"" ]; then
61    echo $ARCH | grep -E '^i[0-9]86$' &> /dev/null && ARCH=i386 && locallib=$local/lib
62    echo $ARCH | grep -E '^x86_64$' &> /dev/null && locallib=$local/lib64
63    echo $ARCH | grep -E '^ia64$' &> /dev/null && locallib=$local/lib
64    sublocallib="$locallib/mindi"
65else
66    locallib=${HEAD}$LIBDIR
67    sublocallib="$LIBDIR/mindi"
68fi
69
70echo "Creating target directories ..."
71install -m 755 -d $conf $conf/deplist.d $locallib/mindi $MANDIR $local/sbin $DOCDIR $CACHEDIR
72
73echo "Copying files ..."
74install -m 644 isolinux.cfg msg-txt isolinux-H.cfg syslinux.cfg syslinux-H.cfg dev.tgz $locallib/mindi
75install -m 644 distributions/conf/deplist.d/* $conf/deplist.d
76install -m 444 distributions/conf/mindi.conf.dist $conf
77#
78# Compute mindi.conf.dist (cecked by mindi) to avoid changes here
79# Modify the checksum file so that path is correct at execution time
80#
81md5sum $conf/mindi.conf.dist > $conf/mindi.conf.dist.md5
82perl -pi -e "s~$conf~$subconf~" $conf/mindi.conf.dist.md5
83#
84# Example of mindi.conf
85#
86if [ ! -e $conf/mindi.conf ]; then
87    cat > $conf/mindi.conf << EOF
88#
89# Configuration file for mindi
90#
91# By default values are taken from $conf/mindi.conf.dist
92# You can override them here
93#
94# e.g.
95#
96#mindi_tmp_dir="/var/tmp"
97#
98EOF
99    chmod 644 $conf/mindi.conf
100fi
101
102#
103# Example of deplist.txt
104#
105if [ ! -e $conf/deplist.txt ]; then
106    cat > $conf/deplist.txt << EOF
107# mindi additional dependency list
108#
109# NB:
110# You have to give an absolute path
111# If you want to add something, just add it on its own line. K.I.S.S.
112
113EOF
114    chmod 644 $conf/deplist.txt
115fi
116
117cp -af rootfs aux-tools $locallib/mindi
118if [ -e FindDistroFailsafe ]; then
119    cp -af FindDistroFailsafe $locallib/mindi
120fi
121chmod 755 $locallib/mindi/rootfs/sbin/*
122chmod 755 $locallib/mindi/aux-tools/sbin/*
123
124# Substitute variables for init
125perl -pi -e "s~^MINDI_VER=VVV~MINDI_VER=$MINDIVER~ ; s~^MINDI_REV=RRR~MINDI_REV=$MINDIREV~" $locallib/mindi/rootfs/sbin/init
126
127# Substitute variables for mindi
128sed -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
129sed -e "s~^my \$mindiconf=YYY~my \$mindiconf=\"$subconf\";~" mindi-bkphw > $local/sbin/mindi-bkphw
130chmod 755 $local/sbin/mindi $local/sbin/mindi-bkphw
131install -m 755 parted2fdisk.pl $local/sbin
132install -m 755 analyze-my-lvm $locallib/mindi
133
134install -m 644 mindi.8 $MANDIR
135install -m 644 ChangeLog COPYING README README.busybox README.ia64 README.pxe TODO INSTALL svn.log $DOCDIR
136
137if [ "_$PREFIX" = "_" ] && [ ! -f $locallib/mindi/rootfs/bin/busybox ]; then
138        echo "WARNING: no busybox found, mindi will not work on this arch ($ARCH)"
139fi
140
141# Managing parted2fdisk
142if [ "$ARCH" = "ia64" ] ; then
143    (cd $local/sbin && ln -sf parted2fdisk.pl parted2fdisk)
144    make -f Makefile.parted2fdisk DEST=$locallib/mindi install
145    if [ -f $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH ]; then
146        echo "Installing parted2fdisk ..."
147        install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $locallib/mindi/rootfs/sbin/parted2fdisk
148        install -s -m 755 $locallib/mindi/rootfs/sbin/parted2fdisk-$ARCH $local/sbin/parted2fdisk
149    else
150        echo "WARNING: no parted2fdisk found, mindi will not work on this arch ($ARCH)"
151    fi
152else
153    # FHS requires fdisk under /sbin
154    (cd $local/sbin && ln -sf /sbin/fdisk parted2fdisk)
155    echo "Symlinking fdisk to parted2fdisk"
156    ( cd $locallib/mindi/rootfs/sbin && ln -sf fdisk parted2fdisk)
157fi
158# Remove left parted2fdisk
159rm -f $locallib/mindi/rootfs/sbin/parted2fdisk-*
160
161if [ "$PKGBUILDMINDI" != "true" ]; then
162    chown -R root:root $locallib/mindi $conf $DOCDIR
163    chown root:root $local/sbin/mindi $MANDIR/mindi.8 $locallib/mindi/analyze-my-lvm $local/sbin/parted2fdisk.pl
164    if [ "$ARCH" = "ia64" ] ; then
165        chown root:root $local/sbin/parted2fdisk
166    fi
167fi
168
169# Special case for SuSE family where doc is put elsewhere in the RPM
170if [ -e /etc/SuSE-release ]; then
171    rm -rf $DOCDIR
172fi
173
174# Special case for Debian family where doc is put elsewhere in the DEB
175if [ -e /etc/debian_version ]; then
176    rm -rf $DOCDIR
177fi
178
179exit 0
Note: See TracBrowser for help on using the repository browser.