Copy file after install MSI file

274 views
Skip to first unread message

tuxmartin

unread,
Sep 25, 2021, 11:52:09 AM9/25/21
to innosetup
Hello,
I need to create installer for my users which install OpenVPN client, import user VPN config and RDP connection file.

During setup I need to install OpenVPN-2.5.3-I601-amd64.msi.

But after OpenVPN install I have to copy OVPN config file to OpenVPN directory which path is in registry: HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN\config_dir - it points mostly to c:\Program Files\OpenVPN\config\ but you never know (drive letter, x86/x64, ...).

So I need:
1) Install OpenVPN-2.5.3-I601-amd64.msi
2) Read registry HKEY_LOCAL_MACHINE\SOFTWARE\OpenVPN\config_dir
3) Copy OVPN config file to path read from registry.

I can install MSI file and read registry, but I don't know how to copy file to path from registry. 


How can I do that?

Thanks for help,
Martin

Bill Stewart

unread,
Oct 4, 2021, 3:02:06 PM10/4/21
to innosetup
On Saturday, September 25, 2021 at 9:52:09 AM UTC-6 tuxmartin wrote:

I can install MSI file and read registry, but I don't know how to copy file to path from registry. 

The "Support Functions Reference" section in the documentation lists functions you can use to read data from the registry:


(Scroll down to "Registry Functions")

Bill

Martin Vancl

unread,
Oct 4, 2021, 9:19:32 PM10/4/21
to inno...@googlegroups.com
I already used RegQueryStringValue: https://gist.github.com/tuxmartin/1fd653a3f773a55a5596c44dbc990342#file-openvpn_rdp_test-iss-L50-L56
But I don't know how to copy file *after openvpn msi installation to path read from registry*.
I have to run 'RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\OpenVPN', 'config_dir', x)' after 'Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\OpenVPN-2.5.3-I601-amd64.msi"" /qb".....'. How can I do that?
Can you please help me?

Thanks,
MV


po 4. 10. 2021 v 21:02 odesílatel Bill Stewart <bste...@iname.com> napsal:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/9b1a5a3e-4374-4b7e-ba6c-2060b109e0c2n%40googlegroups.com.


José Gonçalves

unread,
Oct 4, 2021, 11:51:50 PM10/4/21
to innosetup
You can try using this code instead of : https://gist.github.com/tuxmartin/1fd653a3f773a55a5596c44dbc990342#file-openvpn_rdp_test-iss-L46-L62

[Run]
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\OpenVPN-2.5.3-I601-amd64.msi"" /qb"; WorkingDir: {tmp}; Description: "OpenVPN client"; Flags: hidewizard waituntilterminated; AfterInstall: MyAfterInstall

[Code]
function GetOpenVpnConfigDir(Param: string): string;
var
  x: string;
begin
  RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\OpenVPN', 'config_dir', x);
  Result := x;  
end;

procedure MyAfterInstall();
begin
  FileCopy(ExpandConstant('{app}\user.ovpn'), AddBackslash(GetOpenVpnConfigDir) + 'user.ovpn', False);
end;

Martin Vancl

unread,
Oct 5, 2021, 6:14:45 AM10/5/21
to inno...@googlegroups.com
Hi,
I still have the same problem. I used your code in my setup.
Everything is OK except copy ovpn file. I got this error https://ctrlv.cz/aW2Q there is setup log in gist too.

What am I doing wrong?

-- 
Martin

út 5. 10. 2021 v 5:51 odesílatel José Gonçalves <j.goncalves...@gmail.com> napsal:
You received this message because you are subscribed to a topic in the Google Groups "innosetup" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/innosetup/jGOTyhcDT14/unsubscribe.
To unsubscribe from this group and all its topics, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/3b9dcd28-2bee-4832-a251-9015a58a2778n%40googlegroups.com.


Martin Vancl

unread,
Oct 5, 2021, 9:37:00 AM10/5/21
to inno...@googlegroups.com

út 5. 10. 2021 v 12:14 odesílatel Martin Vancl <tux.m...@gmail.com> napsal:
Reply all
Reply to author
Forward
0 new messages