Free Pascal copying problems

I'm trying to copy some files over to a certain directory. Which is a part of an installation process.

Here's my code so far:

VAR S: STRING;
shell('cp *.rgd '+S);

Where "S" points to a directory and *.rgd are actually zip files that will be extracted later on in the installation process.

Here's what happens when the installation program is executed:

Renegade Version 1.10 Install Utility

This utility will install Renegade BBS Version 1.19/Alpha.
Please make sure that UNZIP and this file are located
in the same directory as the archive RGV110.ZIP.

You will only be asked to enter the main path for the BBS
directory.

Install Renegade BBS Version 1.10? Yes

Please enter main path for the bbs (Example: /opt/rg)
: /opt/rg2

Archive:  rgv10.zip
caution: filename not matched:  /opt/rg2
cp: missing destination file operand after '*.rgd/opt/rg2'
Try 'cp --help' for more information.
cp: missing destination file operand after '*.rgd/opt/rg2'
Try 'cp --help' for more information.
unzip:  cannot find or open /opt/rg2/bbs.rgd, /opt/rg2/bbs.rgd.zip or /opt/rg2/bbs.rgd.ZIP.
unzip:  cannot find or open /opt/rg2/data.rgd, /opt/rg2/data.rgd.zip or /opt/rg2/data.rgd.ZIP.
unzip:  cannot find or open /opt/rg2/misc.rgd, /opt/rg2/misc.rgd.zip or /opt/rg2/misc.rgd.ZIP.
unzip:  cannot find or open /opt/rg2/msgs.rgd, /opt/rg2/msgs.rgd.zip or /opt/rg2/msgs.rgd.ZIP.
unzip:  cannot find or open /opt/rg2/netfoss.rgd, /opt/rg2/netfoss.rgd.zip or /opt/rg2/netfoss.rgd.ZIP.
unzip:  cannot find or open /opt/rg2/prot.rgd, /opt/rg2/prot.rgd.zip or /opt/rg2/prot.rgd.ZIP.

An unhandled exception occurred at $0804957A :

EInOutError : File not found
$0804957A
$08049C1A

Thanks for your time. Any and all help is greatly appreciated.

@ignatius , hi, is the part of the same code you ported and were asking questions on

It seems to miss the space
'*.rgd /opt/rg2'

1 Like

Yes, it is.

does @MadeInGermany observation address the issue ?

I'm not quite sure how to implement his answer.

@ignatius, well, from the messages being output from the command it looks like its malformed .
Show your [pascal] code.

From what I can ascertain, you are trying to copy *.rgd files from the rgv10.zip archive to the /opt/rg2/ directory , is this correct, if so, why not just do that

unzip rgv10.zip '*.rgd' -d /opt/rg2/

Yes. That works, but I need it to "point" to the arbitrary directory. With the "S" variable.

@ignatius , please, take the time/effort to respond to teammates questions/suggestions

have you tried debugging the code ?

does it need to be a binary ? , from what I recall, it could probably be done in a shell script ( once i see your code I can take a fresh assessment )

tks

http://catch22.zapto.org/install.pas

I read

	shell('unzip rgv10.zip '*.rgd' -d' /opt/rg2/);

but think it should be

	shell('unzip rgv10.zip "*.rgd" -d /opt/rg2/');

i.e. the whole argument to the shell function is one 'string in ticks' and embedded quotes are " "

I think shell('unzip rgv10.zip *.rgd -d /opt/rg2/'); should also work correctly, given there aren't any .rgd files present in your current working directory.

No, you want unzip to match the *.rgd in the archive, not the shell.
The quoted "*.rgd" prevents the shell from accidental matching/expanding; it passes the dequoted *.rgd to the unzip.

Exactly, thus it should also work correctly without any quotes around *.rgd, as long as there aren't any .rgd files inside the directory (should I have phrased it differently?)

Why should we hope that, if a simple quoting can assure it?
Always assume Murphy's law!

1 Like

I haven't actually written anything in Pascal for over 15 or so years (let alone for *nix systems), so please bare with me :slight_smile:
So on the other hand, how can we be sure, that the shell() function doesn't treat " as \" and i.e. passes that \" as a literal part of the filename to the shell? Another thing that's bothering me is: why is /opt/rg2/ hardcoded, when it's allegedly supposed to be provided as the only one of the installer inputs? (for now is it for debug purposes only?)
Anyway, sorry for the off-topic.

And also, not to "waste replies" on "academic discussions" only and for a broader context (I'd like to know more), @ignatius in your other thread you mentioned that you "ported" a DOS application to GNU/Linux

  • Why this particular version? (and is it 1.10 or 1.19/A?) Is the complete source code available publicly? (there are newer DOS versions available at https://www.rgbbs.info/ )
  • What particular data does the installer need to write ("manually") to certain files? What's the expected format of this data?
  • Why is the installer written in Pascal? (when it apparently looks, like a shell script would be more suitable for it)

Actually, at this point, i'm going to throw in the towel. And write a shell script for this.

A few questions, regarding the shell script:

  1. How would I set the (arbitrary) directory to install to?
  2. How would I pass that information to the rest of the installation process?

Thank you for all of your help. It's greatly appreciated.

Nevermind. I figured it out.

@ignatius , good to know, so, now show/share your solution please so everyone benefits from the shared knowledge.

tks