31 lines
927 B
Python
31 lines
927 B
Python
"""Uninstall.exe — stops and removes the GTI Fiscal Agent service, then removes
|
|
the install directory (config, DPAPI credential, service host, state/logs) and
|
|
the ARP uninstall key. Invoked from Settings -> Apps -> GTI Fiscal Agent ->
|
|
Uninstall. Run elevated (PyInstaller --uac-admin); safe to run twice.
|
|
|
|
Never connects to the Hub and never reads the credential contents.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import install_common as common
|
|
|
|
|
|
def main() -> int:
|
|
install = common.install_dir()
|
|
common.remove_service()
|
|
common.remove_arp_entry()
|
|
if install.exists():
|
|
try:
|
|
shutil.rmtree(install, ignore_errors=True)
|
|
except OSError:
|
|
pass # leftover locked handle; SCM may still hold the binary briefly
|
|
print(f"GTI Fiscal Agent removed from {install}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main()) |