
Schedule WAPT Upgrade on Boot
Paquet d’installation silencieuse pour Schedule WAPT Upgrade on Boot
1.2-10
- package: tis-schedule-wapt-upgrade-on-boot
- name: Schedule WAPT Upgrade on Boot
- version: 1.2-10
- categories: System and network,Security
- maintainer: Tranquil IT
- locale: all
- target_os: windows
- architecture: all
- signature_date:
- size: 10.95 Ko
package : tis-schedule-wapt-upgrade-on-boot
version : 1.2-10
architecture : all
section : base
priority : optional
name : Schedule WAPT Upgrade on Boot
categories : System and network,Security
maintainer : Tranquil IT
description : Trigger "wapt-get upgrade -S --only_if_not_process_running=1" with WAPTservice when the PC boots
depends :
conflicts :
maturity : PROD
locale : all
target_os : windows
min_wapt_version : 2.1
sources :
installed_size :
impacted_process :
description_fr : Déclencher "wapt-get upgrade -S --only_if_not_process_running=1" avec WAPTservice au démarrage du PC
description_pl : Wyzwalaj "wapt-get upgrade -S --only_if_not_process_running=1" z WAPTservice podczas uruchamiania komputera
description_de : Auslösen von "wapt-get upgrade -S --only_if_not_process_running=1" mit WAPTservice beim Hochfahren des PCs
description_es : Activar "wapt-get upgrade -S --only_if_not_process_running=1" con WAPTservice al arrancar el PC
description_pt : Accionar "wapt-get upgrade -S --only_if_not_process_running=1" com WAPTservice quando o PC arranca
description_it : Attivare "wapt-get upgrade -S --only_if_not_process_running=1" con WAPTservice all'avvio del PC
description_nl : Trigger "wapt-get upgrade -S --only_if_not_process_running=1" met WAPTservice bij het opstarten van de PC
description_ru : Запуск "wapt-get upgrade -S --only_if_not_process_running=1" с помощью WAPTservice при загрузке ПК
audit_schedule :
editor :
keywords :
licence :
homepage :
package_uuid : 6069940e-def7-4607-a3ad-ad2f988382b6
valid_from :
valid_until :
forced_install_on :
changelog :
min_os_version :
max_os_version :
icon_sha256sum : 394a78606b3312802aca8be118327029c2e789ba97b377dd64673ef33d4e3587
signer : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature : tt5ntcBN5JVneFzW5O88vWNg0hChw/ckLvx357FT2IkO7Vq/MISbrge/oao0kB8t+FLaFiULOBaTjNDtiCGt6pL1+P3TBdm9MQq4jcEGX/sYMB+7cvoWAXhBNz92Gl3cWp0+LdI0S+eZ+YzyQZb0jEYPOm0JMWk8JMxuz6mjB6uaXS/wJt2eeB2Ye7omelGEzoYNuACfasL0+fSh6f96/mbS+sNfNQ/frm7dtr6ZQ24QDbshF+jtxEIYJWVs06KxPxs9uIn2p6FCxzYLWRHWM+znKImpuWoNXeXG3mREAR4zqXo/WuqMrOAyvqwho3wHi414jBhY/n6I1gFJwrNzHA==
signature_date : 2023-02-13T14:41:16.378650
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
# -*- coding: utf-8 -*-
from setuphelpers import *
import pythoncom
import time
# Defining variables
task_name = "WAPTupgradeOnBoot"
def install():
# Creating the scheduled task
if task_exists(task_name):
delete_task(task_name)
try:
create_onboot_task(task_name, "wapt-get", "upgrade -S --only_if_not_process_running=1")
print("Creating the scheduled task: %s" % task_name)
except:
print("Unable to create the scheduled task: %s" % task_name)
def uninstall():
# Removing the scheduled task
if task_exists(task_name):
try:
delete_task(task_name)
except:
print("Unable to disable the scheduled task: %s" % task_name)
def audit():
if not task_exists(task_name):
print("task %s don't exist, WAPT is installing package to fix that" % task_name)
install()
return "WARNING"
if not enable_task(task_name):
print("task %s is disable, WAPT is going to enable the task" % task_name)
enable_task(task_name)
return "WARNING"
else:
print("task %s exist and is active" % task_name)
return "OK"
def create_onboot_task(name, cmd, parameters, max_runtime=10):
"""creates a Windows scheduled task on boot and activate it.
Args:
name (str): name of task for reference
cmd(str) : command line
parameters (str) : arguments to append to cmd
max_runtime (int): maximum running time in minutes
Returns:
PyITask: scheduled task
"""
ts = pythoncom.CoCreateInstance(taskscheduler.CLSID_CTaskScheduler, None, pythoncom.CLSCTX_INPROC_SERVER, taskscheduler.IID_ITaskScheduler)
if "%s.job" % name not in ts.Enum():
task = ts.NewWorkItem(name)
task.SetApplicationName(cmd)
task.SetParameters(parameters)
task.SetAccountInformation("", None)
if max_runtime:
task.SetMaxRunTime(max_runtime * 60 * 1000)
# task.SetFlags(task.GetFlags() | taskscheduler.TASK_FLAG_)
ts.AddWorkItem(name, task)
run_time = time.localtime(time.time() + 300)
tr_ind, tr = task.CreateTrigger()
tt = tr.GetTrigger()
tt.Flags = 0
tt.BeginYear = int(time.strftime("%Y", run_time))
tt.BeginMonth = int(time.strftime("%m", run_time))
tt.BeginDay = int(time.strftime("%d", run_time))
tt.TriggerType = int(taskscheduler.TASK_EVENT_TRIGGER_AT_SYSTEMSTART)
tr.SetTrigger(tt)
pf = task.QueryInterface(pythoncom.IID_IPersistFile)
pf.Save(None, 1)
# task.Run()
else:
raise KeyError("%s already exists" % name)
task = ts.Activate(name)
# exit_code, startup_error_code = task.GetExitCode()
return task
84b416265c21c5d8a7928d0da35176d67391ec9396634e8c2286463c635b8fb4 : setup.py
394a78606b3312802aca8be118327029c2e789ba97b377dd64673ef33d4e3587 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
8b12c59a6ddaa2da888bab434e00f273c936efb606d857ea56a905b5137465c1 : WAPT/changelog.txt
8cc51a91dbe3317b1003b266019e45348dbb5b2bb99b0d84ca21c32b0c5820e6 : luti.json
172b38d26535a97465e71e7a718e8c4cde1676aa0df1e2633f3a05cb2b99e12a : WAPT/control
1.2-10
===
upgrade only_if_not_process_running
fix imports