Output auto-cpufreq version for snap/aur/auto-cpufreq-installer

This commit is contained in:
Adnan Hodzic 2021-02-04 23:27:19 +01:00
parent d062ca940f
commit 6bffee4535
2 changed files with 23 additions and 12 deletions

View File

@ -55,11 +55,26 @@ def file_stats():
auto_cpufreq_stats_file = open(auto_cpufreq_stats_path, "w")
sys.stdout = auto_cpufreq_stats_file
# ToDo: read version from snap/snapcraft.yaml and write to $SNAP/version for use with snap installs
# also come up with same kind of solution for AUR
# get distro name
dist_name = distro.id()
# display running version of auto-cpufreq
def app_version():
print("auto-cpufreq version:")
# snap package
if os.getenv('PKG_MARKER') == "SNAP":
print(getoutput("echo Snap: $SNAP_VERSION"))
# aur package
elif dist_name in ["arch", "manjaro", "garuda"]:
try:
print("Build git commit:", check_output(["git", "describe", "--always"]).strip().decode())
print("pacman -Qi auto-cpufreq* | grep Version")
except:
pass
else:
# source code (auto-cpufreq-installer)
try:
print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode())
except:
pass
@ -671,7 +686,7 @@ def python_info():
run("echo \"distro package\" $(pip3 show distro | sed -n -e 's/^.*Version: //p')", shell=True)
def device_info():
print("Computer type", getoutput('dmidecode --string chassis-type'))
print("Computer type:", getoutput('dmidecode --string chassis-type'))
def distro_info():

View File

@ -87,11 +87,7 @@ def main(monitor, live, install, stats, log, daemon, debug):
distro_info()
sysinfo()
print("")
if os.getenv('PKG_MARKER') == "SNAP":
print("Snap package: yes")
else:
app_version()
print("Snap package: no")
print("")
python_info()
print("")