Page 1 of 1

[RESOLVED] f.lux package

Published: June 4, 2021 - 11:10 AM
by elelay
Good morning,

I'm trying to create a package for the small tool f.lux.
The problem is that f.lux installs itself in the PC's user profiles and more specifically in the AppData Local directory.
And since the installation is launched as NT Authority\System, f.lux tries to install itself in the system's user profile, which obviously does not exist and therefore returns an error.
install_error.png
install_error.png (9.31 KiB) Viewed 3428 times
Ignoring the error makes everything work, but it's not very clean.
Is there a way, for example, to launch this installation as another user? Like the local administrator account?

Here is my current code:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

bin_name = 'flux-setup.exe'
package_version = control.version.split('-',1)[0]

def install():
    killalltasks("flux.exe")
    install_exe_if_needed(bin_name,'/S /alluser',key='',min_version=package_version)

def uninstall():
    killalltasks("flux.exe")
    for user in local_users_profiles():
        flux_uninstall_path = makepath(user, '\AppData\Local\FluxSoftware\Flux\uninstall.exe')
        if isfile(flux_uninstall_path):
            run('{} /S'.format(flux_uninstall_path))

Re: f.lux package

Published: June 4, 2021 - 11:47 AM
by dcardon
Hello elelay,

one way to deal with this kind of podoware is to have the install() function copy the file to c:\program files\f.lux and then have session_setup() launch the installation in the user's home directory (there are examples on the forum).

That said, the best way would be to contact the developer to ensure their software installs properly in c:\program files. On a well-secured network with SRP/AppLocker, this kind of software behavior should be avoided (unless you're trying to retrieve ransomware...).

Regards,
Denis

Re: f.lux package

Published: June 4, 2021 - 2:32 PM
by elelay
Hello Denis,

Thank you very much for your quick reply.
If I understand correctly, this means that the installation will only take place the next time the user logs in?

Sincerely,

Re: f.lux package

Published: June 7, 2021 - 9:24 PM
by dcardon
In setup.py, the `def install()` section runs as the system account, so it's not very useful for a poorly developed app like Podoware that installs itself in the user's AppData. Therefore, the best way to handle this is to use `def session_setup()`, and yes, the app will be "installed" (if you can even call putting DLLs and EXEs in AppData "installing"...) when the user logs in.