Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions tools/config-markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,39 @@
import sys
import json
import argparse
import re
from pathlib import Path

def extract_module_options_from_sh_files(directory):
module_options = {}

sh_files = Path(directory).glob("*.sh")
pattern = re.compile(r'\[\s*"(?P<module>[^"]+?),(?P<key>[^"]+?)"\s*\]\s*=\s*"(?P<value>[^"]*?)"')

for sh_file in sh_files:
with open(sh_file, 'r', encoding='utf-8') as f:
content = f.read()
for match in pattern.finditer(content):
module = match.group("module")
key = match.group("key")
value = match.group("value")

if module not in module_options:
module_options[module] = {}
module_options[module][key] = value

return module_options

# Setup paths
SCRIPT_DIR = Path(__file__).resolve().parent
CONFIG_PATH = SCRIPT_DIR.parent / 'lib' / 'armbian-config' / 'config.jobs.json'
IMAGES_DIR = SCRIPT_DIR / 'include' / 'images'
MARKDOWN_DIR = SCRIPT_DIR / 'include' / 'markdown'
DOCS_DIR = Path('docs')

# Add this line to load it at runtime
module_options = extract_module_options_from_sh_files(str(SCRIPT_DIR.parent / 'lib' / 'armbian-config'))

# Load JSON
if not CONFIG_PATH.exists():
print("Error: The configuration file 'config.jobs.json' was not found.")
Expand Down Expand Up @@ -99,10 +123,28 @@ def create_markdown_user(item, level=1, show_meta=True, force_title=False, skip_
if sub_item.get('short') and sub_item.get('description') and sub_item.get('short') != sub_item.get('description'):
md.append(f"\n{sub_item.get('description')}\n")
md.extend(insert_images_and_header(sub_item))
if sub_item.get('author'):
md.append(f"**Author:** {sub_item['author']}\n")
#if sub_item.get('author'):
# md.append(f"__Author:__ {sub_item['author']} ")
if sub_item.get('module'):
module = sub_item['module']
if module in module_options:
maintainer = module_options[module].get('maintainer')
if maintainer:
md.append(f"__Maintainer:__ {maintainer} ")
if sub_item.get('status'):
md.append(f"**Status:** {sub_item['status']}\n")
md.append(f"__Status:__ {sub_item['status']} ")
if sub_item.get('module'):
module = sub_item['module']
if module in module_options:
doc_link = module_options[module].get('arch')
if doc_link:
md.append(f"__Architecture:__ {doc_link} ")
if sub_item.get('module'):
module = sub_item['module']
if module in module_options:
doc_link = module_options[module].get('doc_link')
if doc_link:
md.append(f"__Documentation:__ [Link]({doc_link}) ")
first_sub = False

if sub_item.get('command'):
Expand Down
18 changes: 18 additions & 0 deletions tools/json/config.software.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"id": "SWAG01",
"description": "SWAG reverse proxy",
"short": "SWAG",
"module": "module_swag",
"command": [
"module_swag install"
],
Expand Down Expand Up @@ -59,6 +60,7 @@
"id": "HAB001",
"description": "openHAB empowering the smart home",
"short": "openHAB",
"module": "module_openhab",
"about": "This operation will install openHAB.",
"command": [
"module_openhab install"
Expand Down Expand Up @@ -127,6 +129,7 @@
"id": "DOM001",
"description": "Domoticz open source home automation",
"short": "Domoticz",
"module": "module_domoticz",
"about": "This operation will install Domoticz.",
"command": [
"module_domoticz install"
Expand Down Expand Up @@ -161,6 +164,7 @@
"id": "EVCC01",
"description": "EVCC - solar charging automation",
"short": "EVCC",
"module": "module_evcc",
"about": "This operation will install solar charging automation.",
"command": [
"module_evcc install"
Expand Down Expand Up @@ -201,6 +205,7 @@
"id": "PIH001",
"description": "Pi-hole DNS ad blocker",
"short": "Pi-hole",
"module": "module_pi_hole",
"command": [
"module_pi_hole install"
],
Expand Down Expand Up @@ -242,6 +247,7 @@
"id": "UNB001",
"description": "Unbound caching DNS resolver",
"short": "Unbound",
"module": "module_unbound",
"command": [
"module_unbound install"
],
Expand Down Expand Up @@ -273,6 +279,7 @@
"id": "ADG001",
"description": "AdGuardHome DNS sinkhole",
"short": "AdGuardHome",
"module": "module_adguardhome",
"command": [
"module_adguardhome install"
],
Expand Down Expand Up @@ -310,6 +317,7 @@
"id": "NAV001",
"description": "Navidrome music server and streamer compatible with Subsonic/Airsonic",
"short": "Navidrome",
"module": "module_navidrome",
"command": [
"module_navidrome install"
],
Expand Down Expand Up @@ -347,6 +355,7 @@
"id": "ABU001",
"description": "Do your finances with Actual Budget",
"short": "Actual Budget",
"module": "module_actualbudget",
"command": [
"module_actualbudget install"
],
Expand Down Expand Up @@ -635,6 +644,7 @@
"id": "DPL001",
"description": "Duplicati install",
"short": "Duplicati",
"module": "module_duplicati",
"about": "This operation will install Duplicati backup software",
"command": [
"module_duplicati install"
Expand Down Expand Up @@ -1089,6 +1099,7 @@
"id": "PGSQL1",
"description": "PostgreSQL install",
"short": "PostgreSQL",
"module": "module_postgres",
"about": "This operation will install PostgreSQL, an advanced relational database server",
"command": [
"module_postgres install"
Expand Down Expand Up @@ -1123,6 +1134,7 @@
"id": "DAT001",
"description": "Mariadb SQL database server",
"short": "Mariadb",
"module": "module_mariadb",
"command": [
"module_mariadb install"
],
Expand Down Expand Up @@ -1154,6 +1166,7 @@
"id": "REDIS1",
"description": "Redis install",
"short": "Redis",
"module": "module_redis",
"about": "This operation will install Redis, a powerful in-memory key-value database",
"command": [
"module_redis install"
Expand Down Expand Up @@ -1188,6 +1201,7 @@
"id": "MYA001",
"description": "phpMyAdmin web interface manager",
"short": "phpMyAdmin",
"module": "module_phpmyadmin",
"command": [
"module_phpmyadmin install"
],
Expand Down Expand Up @@ -1333,6 +1347,7 @@
"id": "CON001",
"description": "Docker minimal",
"short": "Docker",
"module": "module_docker",
"about": "This operation will install Docker Minimal.",
"command": [
"module_docker install minimal"
Expand Down Expand Up @@ -1378,6 +1393,7 @@
"id": "POR001",
"description": "Portainer container management platform",
"short": "Portainer",
"module": "module_portainer",
"prompt": "This operation will install Portainer container management platform.",
"command": [
"module_portainer install"
Expand Down Expand Up @@ -1440,6 +1456,7 @@
"id": "EMB001",
"description": "Emby organizes video, music, live TV, and photos",
"short": "Emby",
"module": "module_embyserver",
"about": "This operation will install Emby server.",
"command": [
"module_embyserver install"
Expand Down Expand Up @@ -1702,6 +1719,7 @@
"id": "UPK001",
"description": "Uptime Kuma self-hosted monitoring tool",
"short": "Uptime Kuma",
"module": "module_uptimekuma",
"about": "This operation will install Uptime Kuma",
"command": [
"module_uptimekuma install"
Expand Down