[RESOLVED] f.lux package
Published: June 4, 2021 - 11:10 AM
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.
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:
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.
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))