add install report

This commit is contained in:
Vitor Lopes 2023-11-23 10:24:35 +00:00
parent 0659f6e0a5
commit 7f5d57a704
5 changed files with 55 additions and 0 deletions

View File

@ -149,6 +149,7 @@ sequence:
- bootloader
- postcfg
- umount
- install-count
- show:
- finished

View File

@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
skip_if_no_internet: true

View File

@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
# SPDX-License-Identifier: GPL-3.0-or-later
---
$schema: https://json-schema.org/schema#
$id: https://calamares.io/schemas/install-count
additionalProperties: false
type: object
properties:
skip_if_no_internet: { type: boolean, default: true }

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import requests
import libcalamares
def proc(cmd):
return subprocess.run(cmd, capture_output=True, text=True).stdout.replace("\n", "")
def get_chassis():
return proc(['hostnamectl', '|', 'grep', 'Chassis']).replace("Chassis:\t", "")
def pretty_name():
## TODO
return "unknown"
def get_cala_version():
return ""
def run():
libcalamares.job.setprogress(1.0)
version = get_cala_version()
headers = {'user-agent': f"Calamares/{version}"}
host = "https://ping.manjaro.org/calamares"
if "vm" in get_chassis():
host = f"{host}vm"
try:
requests.get(host, headers=headers, timeout=3)
return "New installation successful"
except Exception as e:
return str(e)

View File

@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: no
# SPDX-License-Identifier: CC0-1.0
---
type: "job"
name: "installreport"
interface: "python"
script: "main.py"