add install report
This commit is contained in:
parent
0659f6e0a5
commit
7f5d57a704
@ -149,6 +149,7 @@ sequence:
|
|||||||
- bootloader
|
- bootloader
|
||||||
- postcfg
|
- postcfg
|
||||||
- umount
|
- umount
|
||||||
|
- install-count
|
||||||
- show:
|
- show:
|
||||||
- finished
|
- finished
|
||||||
|
|
||||||
|
4
src/modules/installreport/installreport.conf
Normal file
4
src/modules/installreport/installreport.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SPDX-FileCopyrightText: no
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
skip_if_no_internet: true
|
10
src/modules/installreport/installreport.yaml
Normal file
10
src/modules/installreport/installreport.yaml
Normal 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 }
|
||||||
|
|
33
src/modules/installreport/main.py
Normal file
33
src/modules/installreport/main.py
Normal 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)
|
7
src/modules/installreport/module.desc
Normal file
7
src/modules/installreport/module.desc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# SPDX-FileCopyrightText: no
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
---
|
||||||
|
type: "job"
|
||||||
|
name: "installreport"
|
||||||
|
interface: "python"
|
||||||
|
script: "main.py"
|
Loading…
Reference in New Issue
Block a user