Add externs to avoid multiple definitions, and then add missing definitions.
[rrq/maintain_lilo.git] / QuickInst
1 #!/bin/sh
2 #
3 #  QuickInst - script for quick installation of lilo
4 #
5 #  Copyright 2010 Joachim Wiedorn
6 #  All rights reserved.
7 #
8 #  Licensed under the terms contained in the file 'COPYING'
9 #  in the source directory.
10 #
11
12 set -e
13
14 if [ ! -f "./src/lilo.c" ]; then
15   echo "You are not in the main source directory of LILO - Abort!"
16   exit 1
17 fi
18
19 if [ -z "$1" ]; then
20
21   if [ "$UID" != "0" ]; then
22     echo "For installing LILO you must be ROOT - Abort!"
23     exit 1
24   fi
25
26 else
27   ADIR=`pwd`
28
29   # absolute path to directory ?
30   if [ `echo "$1" | sed 's#^\/##g'` = "$1" ]; then
31     # path is relative
32     BDIR=`echo "${ADIR}/${1}" | sed 's#\/\/#\/#g'`
33   else
34     BDIR=`echo "/${1}" | sed 's#\/\/#\/#g'`
35   fi  
36
37   # existing directory ?
38   if [ -e "${BDIR}" ]; then
39     DDIR="${BDIR}"
40   else
41     # try to create directory
42     mkdir -p ${BDIR} 2>/dev/null || true
43     if [ -e "$BDIR" ]; then
44       DDIR=$BDIR
45     else
46       echo "Cannot create directory ${1} - Abort!"
47       exit 1
48     fi
49   fi
50
51   # writeable directory ?
52   if [ ! -w "$DDIR" ]; then
53     echo "Cannot write to directory $DDIR - Abort!"
54     exit 1
55   fi
56
57 fi
58
59 echo "~~~~~~~~~~~~ make all ~~~~~~~~~~~~"
60 make all
61
62 echo "~~~~~~~~~~ make install ~~~~~~~~~~"
63 if [ -n "$DDIR" ]; then
64   make install DESTDIR="$DDIR"
65   DDTEXT=" to ${DDIR}"
66 else
67   make install
68 fi
69
70 echo
71 echo "LILO installed${DDTEXT}."
72 echo