* Sampleconfig now detects if we have root permission. If not, a personal cfg file is made.

This commit is contained in:
michael 1999-06-24 21:58:39 +00:00
parent 8d7f55848b
commit e2762599f0

View File

@ -1,3 +1,4 @@
#!/bin/sh
# #
# $Id$ # $Id$
# #
@ -9,12 +10,22 @@ if [ $# != 1 ]; then
echo 'fpcdir = Path where FPC is installed' echo 'fpcdir = Path where FPC is installed'
exit 1 exit 1
fi fi
if [ -f /etc/ppc386.cfg ] ; then # Detect if we have write permission in root.
mv /etc/ppc386.cfg /etc/ppc386.orig >/dev/null 2>&1 if [ -w /etc ] ; then
echo Write permission in /etc.
thefile=/etc/ppc386.cfg
else
echo No write premission in /etc.
thefile=$HOME/.ppc386.cfg
fi
#
if [ -f $thefile ] ; then
mv $thefile $thefile.orig >/dev/null 2>&1
if [ $? == 0 ]; then if [ $? == 0 ]; then
echo Saved old config to /etc/ppc386.orig echo Saved old config to $thefile.orig
else else
echo Could not save old config. Bailing out... echo Could not save old config. Bailing out...
exit
fi fi
fi fi
@ -24,8 +35,8 @@ GCCDIR=`dirname $GCCSPEC`
echo Found libgcc.a in $GCCDIR echo Found libgcc.a in $GCCDIR
# Write the file # Write the file
echo Writing sample configuration file to /etc/ppc386.cfg echo Writing sample configuration file to $thefile
cat <<EOFCFG > /etc/ppc386.cfg cat <<EOFCFG > $thefile
# #
# Example ppc386.cfg for Free Pascal Compiler Version 0.99.12 # Example ppc386.cfg for Free Pascal Compiler Version 0.99.12
# #