File: QuickInst

package info (click to toggle)
lilo 1%3A23.2-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,368 kB
  • sloc: ansic: 13,187; asm: 10,441; perl: 1,095; sh: 989; makefile: 582
file content (72 lines) | stat: -rwxr-xr-x 1,346 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
#
#  QuickInst - script for quick installation of lilo
#
#  Copyright 2010 Joachim Wiedorn
#  All rights reserved.
#
#  Licensed under the terms contained in the file 'COPYING'
#  in the source directory.
#

set -e

if [ ! -f "./src/lilo.c" ]; then
  echo "You are not in the main source directory of LILO - Abort!"
  exit 1
fi

if [ -z "$1" ]; then

  if [ "$UID" != "0" ]; then
    echo "For installing LILO you must be ROOT - Abort!"
    exit 1
  fi

else
  ADIR=`pwd`

  # absolute path to directory ?
  if [ `echo "$1" | sed 's#^\/##g'` = "$1" ]; then
    # path is relative
    BDIR=`echo "${ADIR}/${1}" | sed 's#\/\/#\/#g'`
  else
    BDIR=`echo "/${1}" | sed 's#\/\/#\/#g'`
  fi  

  # existing directory ?
  if [ -e "${BDIR}" ]; then
    DDIR="${BDIR}"
  else
    # try to create directory
    mkdir -p ${BDIR} 2>/dev/null || true
    if [ -e "$BDIR" ]; then
      DDIR=$BDIR
    else
      echo "Cannot create directory ${1} - Abort!"
      exit 1
    fi
  fi

  # writeable directory ?
  if [ ! -w "$DDIR" ]; then
    echo "Cannot write to directory $DDIR - Abort!"
    exit 1
  fi

fi

echo "~~~~~~~~~~~~ make all ~~~~~~~~~~~~"
make all

echo "~~~~~~~~~~ make install ~~~~~~~~~~"
if [ -n "$DDIR" ]; then
  make install DESTDIR="$DDIR"
  DDTEXT=" to ${DDIR}"
else
  make install
fi

echo
echo "LILO installed${DDTEXT}."
echo