mirror of
https://github.com/unixtensor/proxmox-ntfy.git
synced 2025-06-28 18:08:04 +00:00
package.py
-> command.py
a
This commit is contained in:
14
src/command.py
Normal file
14
src/command.py
Normal file
@ -0,0 +1,14 @@
|
||||
import subprocess
|
||||
|
||||
from typing import Optional
|
||||
|
||||
def package_installed(package_name: str) -> Optional[bool]:
|
||||
try:
|
||||
installed = subprocess.run(["dpkg", "-s", package_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE).returncode == 0
|
||||
if not installed:
|
||||
print(f"Package \"{package_name}\" not installed.")
|
||||
return installed
|
||||
except Exception as err:
|
||||
print(err)
|
||||
return None
|
||||
|
Reference in New Issue
Block a user