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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
#!/bin/sh
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
# text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2010 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version. Please see the file LICENSE-GPL for details.
#
# Web Page: http://mielke.cc/brltty/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################
# Installation script for binary BRLTTY distributions.
# Usage: brltty-install dest-prefix [source-prefix]
programName="${0}"
programMessage()
{
echo "${programName}: ${1}"
}
syntaxError()
{
programMessage "${1}"
exit 2
}
execute()
{
"${@}"
returnCode="${?}"
[ "${returnCode}" -eq 0 ] || exit "${returnCode}"
return 0
}
makeDirectory()
{
if [ ! -a "${1}" ]
then
echo "Creating ${2} directory: ${1}"
execute mkdir -p -- "${1}"
elif [ ! -d "${1}" ]
then
syntaxError "not a directory: ${1}"
fi
}
copyContents()
{
execute cp -pR -- "${1}/"* "${2}"
}
copyFiles()
{
for f in $4
do
if [ -f "${1}/${f}" ]
then
echo "Installing ${3}: ${2}/${f}"
execute cp -p -- "${1}/${f}" "${2}"
elif [ -a "${1}/${f}" ]
then
programMessage "not a file: ${1}/${f}"
else
programMessage "${3} not found: ${1}/${f}"
fi
done
}
. "`dirname "${0}"`/brltty-config" || exit "${?}"
if [ "${#}" -eq 0 ]
then
syntaxError "missing destination directory."
fi
to="${1}"
shift
if [ "${#}" -eq 0 ]
then
from="${BRLTTY_EXECUTE_ROOT}"
elif [ "${#}" -eq 1 ]
then
from="${1}"
if [ ! -d "${from}" ]
then
syntaxError "source file hierarchy not found: ${from}"
fi
if [ ! -d "${from}" ]
then
syntaxError "source is not a directory."
fi
else
syntaxError "too many parameters."
fi
if [ "${to}" = "${from}" ]
then
syntaxError "source and destination are the same."
fi
makeDirectory "${to}" "destination"
makeDirectory "${to}${BRLTTY_PROGRAM_DIRECTORY}" "executables"
copyFiles "${from}${BRLTTY_PROGRAM_DIRECTORY}" "${to}${BRLTTY_PROGRAM_DIRECTORY}" "executable" "brltty brltty-config brltty-install"
conf="brltty.conf"
if [ -f "${from}${sysconfdir}/${conf}" ]
then
makeDirectory "${to}${sysconfdir}" "configuration"
copyFiles "${from}${sysconfdir}" "${to}${sysconfdir}" "configuration file" "${conf}"
else
programMessage "no configuration file: ${from}${sysconfdir}/${conf}"
fi
makeDirectory "${to}${BRLTTY_LIBRARY_DIRECTORY}" "library"
echo "Installing library files."
copyContents "${from}${BRLTTY_LIBRARY_DIRECTORY}" "${to}${BRLTTY_LIBRARY_DIRECTORY}"
makeDirectory "${to}${BRLTTY_DATA_DIRECTORY}" "data"
echo "Installing data files."
copyContents "${from}${BRLTTY_DATA_DIRECTORY}" "${to}${BRLTTY_DATA_DIRECTORY}"
echo "Installation complete."
exit 0
|