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
|
#!/bin/sh
# EAGLE installation script version 4.16
#
# Copyright (c) 2005 CadSoft Computer GmbH
INSTALLDIR="/opt/eagle"
MANDIR="/usr/share/man/man1 /usr/man/man1"
BINDIR="/usr/bin"
# Determine the source directory:
SRC=$0
test "${SRC:0:1}" = "/" || SRC=`pwd`/$SRC
SRC=${SRC%/*}
# Make sure we have a clean directory path:
cd "$SRC" || exit 1
SRC=`pwd`
cd "$OLDPWD"
if test "`basename $0`" = "install"; then
# Determine the destination directory:
DST=${1:-$INSTALLDIR}
test "${DST:0:1}" = "/" || DST=`pwd`/$DST
# Create the destination directory:
mkdir -p "$DST" || exit 1
# Make sure we have a clean directory path:
cd "$DST" || exit 1
DST=`pwd`
cd "$OLDPWD"
# Copy files to destination if necessary:
test "$SRC" = "$DST" || cp -rp "$SRC"/* "$DST" || exit 1
else
DST="$SRC"
fi
# The following can only be done if we are 'root':
if test "$UID" = "0"; then
# (Un)Install files:
if test "`basename $0`" = "install"; then
# Set the owner to 'root':
chown -R 0:0 "$DST"
# Install link to binary:
ln -f -s "$DST/bin/eagle" $BINDIR || exit 1
# Install man page:
for i in $MANDIR; do
if test -d $i; then
cp "$DST/man/eagle.1" $i || exit 1
break
fi
done
# Create symlink for 'uninstall':
ln -sf install "$DST/uninstall"
else
# Remove link to binary:
rm -f $BINDIR/eagle || exit 1
# Remove man page:
for i in $MANDIR; do
if test -a $i/eagle.1; then
rm -f $i/eagle.1 || exit 1
break
fi
done
# Remove eagle.key file:
rm -f "$DST/bin/eagle.key"
# Remove symlink for 'uninstall':
rm -f "$DST/uninstall"
exit 0;
fi
fi
test "`basename $0`" = "install" && echo "EAGLE successfully installed to '$DST'"
exit 0
|