On Sat, 11 Apr 2020, fredvs via fpc-pascal wrote:

It will create one in your home directory if it detects you do not have
root access.
Could you explain that?
Of course if you can show me a trick for configuring a script that will
install fpc in the home directory (.fpc.cfg), with for example the
hard-coded directory /home/user/instantfpc, I will use it.

But the condition will be that the user has nothing write, only run a
script.

The default install.sh used by FPC calls samplecfg to create the config file
for the compiler.

samplecfg is located in compiler/utils.

Line 40 and following contain:

# Detect if we have write permission in sysdir.
if [ -w "$sysdir" ] ; then
  echo Write permission in $sysdir.
  fpccfgfile="$sysdir"/fpc.cfg
  fppkgfile="$sysdir"/fppkg.cfg
  defaultfile="$sysdir"/fppkg/default
  compilerconfigdir="-d CompilerConfigDir=$sysdir/fppkg"
  fppkgconfdir=$sysdir/fppkg/conf.d
else
  echo No write premission in $sysdir.
  fpccfgfile="$HOME"/.fpc.cfg
  fppkgfile="$HOME"/.config/fppkg.cfg
  defaultfile="$HOME"/.fppkg/config/default
  fppkgconfdir="$HOME"/.fppkg/config/conf.d
fi

So as you can see, when the user does not have write permissions in /etc or
/local/etc, it will write a config file in the user home directory, exactly
where the compiler will pick it up.

So you see, we've covered the situation you are trying to solve.

It has been so for ages, all you need to do is use what is there correctly.

There is no need to change anything.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to