Hello,
I'm trying to install a Firefox update package from version 52.9esr to Firefox 68.9esr.
The problem is that this version upgrade creates a new default user profile.
The idea is to back up the file C:\Users\Username\AppData\Roaming\Mozilla\Firefox\profiles.ini to another folder during the installation (in my example, C:\temp) and then restore it to its original location after the installation is complete, in order to retain access to the user profile (containing bookmarks, passwords, etc.).
To do this, I have: `
from setuphelpers import *
uninstallkey = []
def install():
#copying the profiles.ini file from AppData to c:\Temp
print('saving the profiles.ini file')
filecopyto(user_appdata()+'\Mozilla\Firefox\profiles.ini','c:\Temp')
#killing the Firefox.exe process
print('closing Firefox')
killalltasks("firefox.exe")
#updating to Firefox 68.9.0esr (32-bit)
print('updating to Firefox 68.9.0esr (32-bit)')
install_exe_if_needed("Firefox Setup 68.9.0esr.exe",'/s',key='')
.....
Everything goes well when I run my installation from PyScripter on my development machine (running Windows 10 Pro); it correctly copies the profiles.ini file from C:\Users\Username\AppData\Roaming\Mozilla\Firefox\ to C:\Temp.
When I launch the installation of my package from the console to another machine (Debian 9 server, Wapt 1.7.4), I get an installation error:
IOError: [Errno 2] No such file or directory: u'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Mozilla\\Firefox\\profiles.ini'
It is looking for the profiles.ini file in the wrong place.
I've tried various approaches, including using `
from os import path
appdatapath = path.expandvars('%APPDATA%')
filecopyto(appdatapath+'\Mozilla\Firefox\profiles.ini','c:\Temp')`
, but the problem persists: the package works fine locally on the development machine using PyScripter, but I get the same error when I try to install the package from the console on another test machine.
There's a subtlety I'm missing: why does my script look for the file in the correct location when I install from PyScripter, and then look for it in `C:\Windows\system32\config\systemprofile\AppData\Roaming\Mozilla\Firefox` when I install from the console?
Thank you in advance for your help.
Sincerely,
Cyril G
user profile manipulation
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Hello,
when you test your package from PyScripter, the installation happens in your user's context.
When you run the installation on another machine, the installation is done as the SYSTEM user, who doesn't have a profile in the traditional sense.
If you only have one user on the machine, you'll need to retrieve the name of the last logged-in user profile and use that information to construct the correct path to C:\users\
I'm not sure if WAPT has a function to retrieve the last authenticated user on a machine.
Check the WAPT documentation; otherwise, there must be a registry key containing that information.
when you test your package from PyScripter, the installation happens in your user's context.
When you run the installation on another machine, the installation is done as the SYSTEM user, who doesn't have a profile in the traditional sense.
If you only have one user on the machine, you'll need to retrieve the name of the last logged-in user profile and use that information to construct the correct path to C:\users\
I'm not sure if WAPT has a function to retrieve the last authenticated user on a machine.
Check the WAPT documentation; otherwise, there must be a registry key containing that information.
in setuphelpers:
-> returns mydomain\user
for a local user
.\user
Also
returns a list ['user']
List of machine profiles:
Code: Select all
get_last_logged_on_user()for a local user
.\user
Also
Code: Select all
get_loggedinusers()List of machine profiles:
Code: Select all
local_users_profiles()
['C:\\Windows\\ServiceProfiles\\LocalService',
'C:\\Windows\\ServiceProfiles\\NetworkService',
'C:\\Users\\htouvet',
'C:\\Users\\user1']Tranquil IT
