change package get

main
vitrinekast 8 months ago
parent fec1124210
commit 78a5b359d8

@ -42,10 +42,12 @@ since_last_boot = run_command(["uptime","-s"])
slb_date = datetime.strptime(since_last_boot, "%Y-%m-%d %H:%M:%S") slb_date = datetime.strptime(since_last_boot, "%Y-%m-%d %H:%M:%S")
time_since_last_boot = now - slb_date time_since_last_boot = now - slb_date
list_package_installs_init = subprocess.run(["grep", 'install', "/var/log/dpkg.log"], capture_output=True) dpkg_date = now.strftime("%Y-%m-%d")
list_package_installs = run_command(['grep', '-v', "status"], based=list_package_installs_init.stdout)
list_package_upgrade = subprocess.run(["grep", 'upgrade', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8') list_package_installs = subprocess.run(["grep","-E", '${dpkg_date}.*install|install.*${dpkg_date}', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8').splitlines()
list_package_remove = subprocess.run(["grep", 'remove', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8') list_package_upgrade = subprocess.run(["grep","-E", '${dpkg_date}.*upgrade|upgrade.*${dpkg_date}', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8').splitlines()
list_package_remove = subprocess.run(["grep","-E", '${dpkg_date}.*remove|remove.*${dpkg_date}', "/var/log/dpkg.log"], capture_output=True).stdout.decode('UTF-8').splitlines()
device_info_grab = subprocess.run(["grep", 'Model' , "/proc/cpuinfo"], check=True, capture_output=True) device_info_grab = subprocess.run(["grep", 'Model' , "/proc/cpuinfo"], check=True, capture_output=True)
device_info = run_command(['awk', '-F:', '{ print $2}'], based=device_info_grab.stdout) device_info = run_command(['awk', '-F:', '{ print $2}'], based=device_info_grab.stdout)
@ -74,9 +76,9 @@ output = template.render(
last_user_added_name=last_user_added_name, last_user_added_name=last_user_added_name,
users_created_today=users_created_today, users_created_today=users_created_today,
since_last_boot=since_last_boot, since_last_boot=since_last_boot,
list_package_installs=list_package_installs.splitlines(), list_package_installs=list_package_installs,
list_package_upgrade=list_package_upgrade.splitlines(), list_package_upgrade=list_package_upgrade,
list_package_remove=list_package_remove.splitlines(), list_package_remove=list_package_remove,
device_info=device_info, device_info=device_info,
days_since_last_boot = time_since_last_boot.days, days_since_last_boot = time_since_last_boot.days,
kitchen_services = kitchen_services, kitchen_services = kitchen_services,

Loading…
Cancel
Save