From f43dcba705ac917b067e110aa2eed1c791df9a6d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 10 Dec 2024 07:53:06 +0100 Subject: [PATCH 01/16] build-debian-toolbox: Forward buildah to host Fixes autopkgtest-build-podman --- build-debian-toolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-debian-toolbox b/build-debian-toolbox index 71a42b8..cac95ec 100755 --- a/build-debian-toolbox +++ b/build-debian-toolbox @@ -47,7 +47,7 @@ sudo eatmydata apt-get install -y --no-install-recommends build-essential git-bu sudo eatmydata apt-get install -y --no-install-recommends autopkgtest qemu-system-x86 qemu-utils genisoimage uidmap # commands to forward to the host -for cmd in podman toolbox; do +for cmd in podman buildah toolbox; do printf "#!/bin/sh\n/usr/libexec/flatpak-xdg-utils/flatpak-spawn --host $cmd \42\$@\42\n" | sudo tee /usr/local/bin/$cmd >/dev/null sudo chmod a+x /usr/local/bin/$cmd done -- 2.47.2 From 30b70caaff5c8ecbfe6bec00c70ff116264ddc90 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 2 Jan 2025 06:38:06 +0100 Subject: [PATCH 02/16] consors-report.py: Updates --- consors-report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consors-report.py b/consors-report.py index 286d132..879a53b 100755 --- a/consors-report.py +++ b/consors-report.py @@ -17,7 +17,7 @@ CATEGORIES = { 'Medizin': re.compile(r'Apotheke|MVZ|\bmed\b|ZAB Abrechnung|Caika|HNOeins|PVS|Dr\..*Sellier|' r'BFS Health|Streifeneder|Labor|Physio|(Drescher.*Lung)|Osteopath|' '(Dr.*Borchers)|(Debeka.*Überweisung)|(DKV.*Überweisung)|Beihilfe|Klinik|' - 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte', re.I), + 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz', re.I), 'Versicherung': re.compile('((debeka|DKV|Hallesche|Versicherung|Alte Leipziger|ConceptIF|' 'Baloise).*Lastschrift)|Hallesche.*Bonu', re.I), 'Transport': re.compile('DB Vertrieb|DB Fernverkehr|Deutsche Bahn|Nextbike|Carsharing|Radstation', re.I), -- 2.47.2 From 8e581f751e4a314f1d39cc8308890178c4a1c291 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 6 Jan 2025 08:41:49 +0100 Subject: [PATCH 03/16] build-cockpit-toolbox: Drop neovim downgrade Not a thing any more for Fedora 41 --- build-cockpit-toolbox | 2 -- 1 file changed, 2 deletions(-) diff --git a/build-cockpit-toolbox b/build-cockpit-toolbox index a994f6e..8af7e61 100755 --- a/build-cockpit-toolbox +++ b/build-cockpit-toolbox @@ -24,8 +24,6 @@ sudo dnf install -y ansible bash-completion man-db man-pages moreutils fd-find r tmt python3-testcloud flatpak-builder flatpak-spawn qemu-ui-sdl \ fedpkg centpkg -sudo dnf downgrade -y neovim - # https://bugzilla.redhat.com/show_bug.cgi?id=2281714 sudo dnf install -y libglvnd-gles -- 2.47.2 From 5c4479410384f85e088aed156b32b4cce944db4c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 6 Jan 2025 08:42:03 +0100 Subject: [PATCH 04/16] backup: Adjust server backup passphrase path --- backup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup b/backup index 9593143..79dc369 100755 --- a/backup +++ b/backup @@ -43,8 +43,8 @@ scp .config/backup-passphrase piware.de:.cache/ ssh piware.de chmod u+w .cache/backup-passphrase trap "ssh piware.de shred -u .cache/backup-passphrase" EXIT INT QUIT PIPE -ssh piware.de restic --password-file .cache/backup-passphrase --repo backup/restic forget --prune --keep-within-hourly 24h --keep-within-daily 7d --keep-within-weekly 30d --keep-within-monthly 12m +ssh piware.de restic --password-file backup/backup-passphrase --repo backup/restic forget --prune --keep-within-hourly 24h --keep-within-daily 7d --keep-within-weekly 30d --keep-within-monthly 12m notify-send "Backup pruned successfully" -ssh piware.de restic --password-file .cache/backup-passphrase --repo backup/restic check || fail "BACKUP CHECK FAILED!" +ssh piware.de restic --password-file backup/backup-passphrase --repo backup/restic check || fail "BACKUP CHECK FAILED!" notify-send "Backup checked successfully" -- 2.47.2 From 4ab077a6ceffc9f87aeb756716287d28a38a155a Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 1 Feb 2025 06:49:09 +0100 Subject: [PATCH 05/16] system-maintenance: flatpak update through su does not work any more --- system-maintenance | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-maintenance b/system-maintenance index 8db4659..4b3557c 100755 --- a/system-maintenance +++ b/system-maintenance @@ -11,6 +11,6 @@ rpm-ostree upgrade # fix fonts between Fedora releases rm -rf ~martin/.cache/fontconfig -su -c 'flatpak -y update' martin - fstrim -av + +echo 'Run this now: flatpak -y update' -- 2.47.2 From d5f84897fa659270cea7d2bb38d7010caa9e5547 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 1 Feb 2025 12:44:45 +0100 Subject: [PATCH 06/16] consors-report.py: Updates --- consors-report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consors-report.py b/consors-report.py index 879a53b..444ecc0 100755 --- a/consors-report.py +++ b/consors-report.py @@ -20,7 +20,7 @@ CATEGORIES = { 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz', re.I), 'Versicherung': re.compile('((debeka|DKV|Hallesche|Versicherung|Alte Leipziger|ConceptIF|' 'Baloise).*Lastschrift)|Hallesche.*Bonu', re.I), - 'Transport': re.compile('DB Vertrieb|DB Fernverkehr|Deutsche Bahn|Nextbike|Carsharing|Radstation', re.I), + 'Transport': re.compile(r'DB Vertr\s*ieb|DB Fernverkehr|Deutsche Bahn|Nextbike|Carsharing|Radstation', re.I), 'Lebensmittel': re.compile('BIOS|Bäcker|Baecker|Baker|Schubert Bio|Ruta|Rewe|Edeka', re.I), 'Eigentumswohnungen': re.compile('Rechnung Darl.-Leistung|Semmelweis|BHP Buerkner|Dr. Schmitz', re.I), 'Hobby/Sport': re.compile('Holstein|Mrs. Sporty|Kieser|DJK|Dimaso', re.I), -- 2.47.2 From c8dd9e947adfe2f24c4ecb377b9e4c50262df5a4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 8 Mar 2025 07:46:45 +0100 Subject: [PATCH 07/16] consors-report: updates --- consors-report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/consors-report.py b/consors-report.py index 444ecc0..cf6c219 100755 --- a/consors-report.py +++ b/consors-report.py @@ -17,7 +17,7 @@ CATEGORIES = { 'Medizin': re.compile(r'Apotheke|MVZ|\bmed\b|ZAB Abrechnung|Caika|HNOeins|PVS|Dr\..*Sellier|' r'BFS Health|Streifeneder|Labor|Physio|(Drescher.*Lung)|Osteopath|' '(Dr.*Borchers)|(Debeka.*Überweisung)|(DKV.*Überweisung)|Beihilfe|Klinik|' - 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz', re.I), + 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz|Physico', re.I), 'Versicherung': re.compile('((debeka|DKV|Hallesche|Versicherung|Alte Leipziger|ConceptIF|' 'Baloise).*Lastschrift)|Hallesche.*Bonu', re.I), 'Transport': re.compile(r'DB Vertr\s*ieb|DB Fernverkehr|Deutsche Bahn|Nextbike|Carsharing|Radstation', re.I), -- 2.47.2 From e5357d5232868326c7b54dc1b6ed89aa2544b8cb Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 10 Mar 2025 07:01:14 +0100 Subject: [PATCH 08/16] daytime-term: Check sun rise/set instead of hardcoded time --- daytime-term | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/daytime-term b/daytime-term index 9d7c888..51f9b82 100755 --- a/daytime-term +++ b/daytime-term @@ -1,4 +1,5 @@ #!/bin/sh +DATA=$HOME/.cache/sunrise.json set -eu if [ "${1:-}" = "night" ]; then @@ -6,8 +7,17 @@ if [ "${1:-}" = "night" ]; then night=1 elif [ "${1:-}" = "day" ]; then night= -elif [ `date +%k` -ge 20 ] || [ `date +%k` -lt 7 ]; then - night=1 +else + # get daylight times at most once a day + if [ ! -e "$DATA" ] || [ $(( `date +%s` - `stat -c %Y $DATA` )) -gt 86400 ]; then + curl --silent --show-error -o "$DATA" 'https://api.sunrise-sunset.org/json?lat=48.22&lng=10.54&formatted=0' + fi + sunrise=$(jq -r .results.sunrise < ~/.cache/sunrise.json) + sunset=$(jq -r .results.sunset < ~/.cache/sunrise.json) + now=$(date '+%H%M') + if [ $now -le $(date -d "$sunrise" '+%H%M') ] || [ $now -ge $(date -d "$sunset" '+%H%M') ]; then + night=1 + fi fi if [ -n "${night:-}" ]; then -- 2.47.2 From 354881e5ab8e6b25e1c0196f80923977a0ecde31 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 1 Apr 2025 10:19:58 +0200 Subject: [PATCH 09/16] consors-report: updates --- consors-report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/consors-report.py b/consors-report.py index cf6c219..1241dbc 100755 --- a/consors-report.py +++ b/consors-report.py @@ -17,14 +17,16 @@ CATEGORIES = { 'Medizin': re.compile(r'Apotheke|MVZ|\bmed\b|ZAB Abrechnung|Caika|HNOeins|PVS|Dr\..*Sellier|' r'BFS Health|Streifeneder|Labor|Physio|(Drescher.*Lung)|Osteopath|' '(Dr.*Borchers)|(Debeka.*Überweisung)|(DKV.*Überweisung)|Beihilfe|Klinik|' - 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz|Physico', re.I), + 'Niklas Hermann|Alena Hauser|Strizrep|Aerzte|Hallesche.*Ausz|Physico|' + 'Orthop|Pathologie', re.I), 'Versicherung': re.compile('((debeka|DKV|Hallesche|Versicherung|Alte Leipziger|ConceptIF|' 'Baloise).*Lastschrift)|Hallesche.*Bonu', re.I), 'Transport': re.compile(r'DB Vertr\s*ieb|DB Fernverkehr|Deutsche Bahn|Nextbike|Carsharing|Radstation', re.I), 'Lebensmittel': re.compile('BIOS|Bäcker|Baecker|Baker|Schubert Bio|Ruta|Rewe|Edeka', re.I), 'Eigentumswohnungen': re.compile('Rechnung Darl.-Leistung|Semmelweis|BHP Buerkner|Dr. Schmitz', re.I), 'Hobby/Sport': re.compile('Holstein|Mrs. Sporty|Kieser|DJK|Dimaso', re.I), - 'Sparen': re.compile('Bausparkasse Mainz AG|FIL Fondsbank|MIG (Fonds|GmbH)|Netfonds AG|Festgeld', re.I), + 'Sparen': re.compile('Bausparkasse Mainz AG|FIL Fondsbank|MIG (Fonds|GmbH)|Netfonds AG|Festgeld|' + 'MORGAN STANLEY', re.I), 'Spenden': re.compile('Spende|Signal Foundation|nebenan.de|(paypal.*Sabine.Hossenf)|' 'Patreon|Umwelthilfe|Foerderer|Malteser|(Aktion Tier.*Mensch)|' 'campact|Amnesty|BN Landesverband', re.I), -- 2.47.2 From 495d45cbb1d3d1f406f6ea48e338ce5390be0603 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 23 Apr 2025 08:03:59 +0200 Subject: [PATCH 10/16] build-cockpit-toolbox: forward buildah to host --- build-cockpit-toolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-cockpit-toolbox b/build-cockpit-toolbox index 8af7e61..d0195a5 100755 --- a/build-cockpit-toolbox +++ b/build-cockpit-toolbox @@ -28,7 +28,7 @@ sudo dnf install -y ansible bash-completion man-db man-pages moreutils fd-find r sudo dnf install -y libglvnd-gles # commands to forward to the host -for cmd in podman toolbox nmcli eog evince flatpak; do +for cmd in podman buildah toolbox nmcli eog evince flatpak; do printf "#!/bin/sh\nexec flatpak-spawn --host $cmd \42\$@\42\n" | sudo tee /usr/local/bin/$cmd >/dev/null sudo chmod a+x /usr/local/bin/$cmd done -- 2.47.2 From ad04a727fd0c23ea12651c4546ccabf47cbc27f6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 18 May 2025 21:22:16 +0200 Subject: [PATCH 11/16] recipekeeper-split: Add --- recipekeeper-split | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 recipekeeper-split diff --git a/recipekeeper-split b/recipekeeper-split new file mode 100755 index 0000000..c43770a --- /dev/null +++ b/recipekeeper-split @@ -0,0 +1,69 @@ +#!/usr/bin/python3 +import re +import html +import xml.etree.ElementTree as ET + +input_file = "recipes.html" + + +def safe_filename(name): + name = re.sub(r"[^\w\s-]", '', name).strip().replace(' ', '_') + return name[:40] + + +with open(input_file, "r") as f: + content = f.read() + +# 1. Fix tags: make them self-closing +content_fixed = re.sub(r'(]*)(?', r'\1 />', content) + +# 2. Fix unquoted itemprop attribute values (itemprop=foo -> itemprop="foo") +# Only match when the value is not already quoted +content_fixed = re.sub(r'itemprop=([^\s">]+)', r'itemprop="\1"', content_fixed) + +# Parse as XML +tree = ET.ElementTree(ET.fromstring(content_fixed)) +root = tree.getroot() + +head = root.find('head') +body = root.find('body') +recipes = [div for div in body.findall('div') if div.get('class') == 'recipe-details'] + +# Prepare the tag string +meta_tag = '' + +for recipe in recipes: + h2 = recipe.find('.//h2[@itemprop="name"]') + meta_id = recipe.find('.//meta[@itemprop="recipeId"]') + if h2 is not None and h2.text and h2.text.strip(): + base = safe_filename(html.unescape(h2.text)) + elif meta_id is not None: + base = meta_id.attrib['content'] + else: + base = "recipe" + + filename = f"{base}.html" + + # Convert head to string and insert the meta tag after + head_str = ET.tostring(head, encoding="unicode") + head_str = re.sub( + r'()', # Match opening tag (with possible attributes) + r'\1\n' + meta_tag, # Insert meta tag right after opening tag + head_str, + count=1, + flags=re.IGNORECASE | re.DOTALL + ) + # fix too small font sizes + head_str = re.sub(r'14px', '18pt', head_str) + head_str = re.sub(r'24px', '24pt', head_str) + + out_html = ( + '\n\n' + + head_str + '\n' + + '\n' + + ET.tostring(recipe, encoding="unicode") + '\n' + + '\n' + ) + with open(filename, "w", encoding="utf-8") as out: + out.write(out_html) + print(f"Wrote: {filename}") -- 2.47.2 From 05937c6f0eb16d39a89583f6549c564cf3b2464e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 25 May 2025 12:49:27 +0200 Subject: [PATCH 12/16] ubuntu-backport-cockpit: Support local dsc --- ubuntu-backport-cockpit | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ubuntu-backport-cockpit b/ubuntu-backport-cockpit index 07e8c08..b1d1828 100755 --- a/ubuntu-backport-cockpit +++ b/ubuntu-backport-cockpit @@ -4,6 +4,8 @@ PACKAGE=${1:-cockpit} TARGET=${2:-noble} POCKET="${TARGET}-backports" +[ -z "${3:-}" ] || DSC=$(realpath "$3") + series_ver() { ver=$(wget -q -O- http://de.archive.ubuntu.com/ubuntu/dists/$1/universe/source/Sources.xz | xz -d | grep-dctrl -n -sVersion -XP $PACKAGE | sort -u | tail -n1) ver=${ver%~bpo*} @@ -28,7 +30,11 @@ upload() { rm -rf /tmp/backport mkdir /tmp/backport cd /tmp/backport -apt-get source $PACKAGE +if [ -n "${DSC:-}" ]; then + dpkg-source -x "$DSC" +else + apt-get source $PACKAGE +fi cd ${PACKAGE}-* case "$TARGET" in -- 2.47.2 From d1d4cca212d639f5d4211601a1671986aca6796b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 1 Jun 2025 16:48:25 +0200 Subject: [PATCH 13/16] recipekeeper-split: Start from zip file --- recipekeeper-split | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/recipekeeper-split b/recipekeeper-split index c43770a..2017862 100755 --- a/recipekeeper-split +++ b/recipekeeper-split @@ -1,9 +1,21 @@ #!/usr/bin/python3 -import re import html +import os +import re +import shutil +import sys import xml.etree.ElementTree as ET +import zipfile + +(recipe_zip, destdir) = sys.argv[1:] -input_file = "recipes.html" +# init destdir +if os.path.exists(destdir): + shutil.rmtree(destdir) +os.makedirs(destdir) + +with zipfile.ZipFile(recipe_zip, 'r') as archive: + archive.extractall(path=destdir) def safe_filename(name): @@ -11,7 +23,7 @@ def safe_filename(name): return name[:40] -with open(input_file, "r") as f: +with open(os.path.join(destdir, "recipes.html"), "r") as f: content = f.read() # 1. Fix tags: make them self-closing @@ -64,6 +76,9 @@ for recipe in recipes: ET.tostring(recipe, encoding="unicode") + '\n' + '\n' ) - with open(filename, "w", encoding="utf-8") as out: + with open(os.path.join(destdir, filename), "w", encoding="utf-8") as out: out.write(out_html) + print(f"Wrote: {filename}") + +os.remove(os.path.join(destdir, "recipes.html")) -- 2.47.2 From ea494ed1b2281fd01c7c42160df8cb695b6247d7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 2 Jun 2025 13:39:02 +0200 Subject: [PATCH 14/16] build-cockpit-toolbox: Drop obsolete libglvnd-gles hack --- build-cockpit-toolbox | 3 --- 1 file changed, 3 deletions(-) diff --git a/build-cockpit-toolbox b/build-cockpit-toolbox index d0195a5..868a9d2 100755 --- a/build-cockpit-toolbox +++ b/build-cockpit-toolbox @@ -24,9 +24,6 @@ sudo dnf install -y ansible bash-completion man-db man-pages moreutils fd-find r tmt python3-testcloud flatpak-builder flatpak-spawn qemu-ui-sdl \ fedpkg centpkg -# https://bugzilla.redhat.com/show_bug.cgi?id=2281714 -sudo dnf install -y libglvnd-gles - # commands to forward to the host for cmd in podman buildah toolbox nmcli eog evince flatpak; do printf "#!/bin/sh\nexec flatpak-spawn --host $cmd \42\$@\42\n" | sudo tee /usr/local/bin/$cmd >/dev/null -- 2.47.2 From eab8038c18a837fba1bfd7bcaee5e4ad9da77b14 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 7 Jun 2025 07:32:52 +0200 Subject: [PATCH 15/16] recipekeeper-split: Pacify mypy --- recipekeeper-split | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipekeeper-split b/recipekeeper-split index 2017862..a56f52e 100755 --- a/recipekeeper-split +++ b/recipekeeper-split @@ -39,6 +39,8 @@ root = tree.getroot() head = root.find('head') body = root.find('body') +assert head is not None +assert body is not None recipes = [div for div in body.findall('div') if div.get('class') == 'recipe-details'] # Prepare the tag string -- 2.47.2 From bde2ff3b090877d03c53ccb10e9fb5f14306bdfb Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 29 Jun 2025 10:24:46 +0200 Subject: [PATCH 16/16] build-debian-toolbox: Fix for Ubuntu containers toolbox trips over the existing ubuntu home dir and its uid 1000. --- build-debian-toolbox | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build-debian-toolbox b/build-debian-toolbox index cac95ec..df36cd0 100755 --- a/build-debian-toolbox +++ b/build-debian-toolbox @@ -8,6 +8,11 @@ toolbox rm -f $RELEASE || true podman pull docker.io/$DISTRO:$RELEASE toolbox -y create -c $RELEASE --image docker.io/$DISTRO:$RELEASE +# hack for ubuntu: need to remove existing home dir +if [ "$DISTRO" = "ubuntu" ]; then + podman unshare sh -exc "H=\$(podman mount $RELEASE); rm -r \$H/home/ubuntu; sed -i '/^ubuntu/d' \$H/etc/passwd \$H/etc/shadow" +fi + # can't do that with toolbox run yet, as we need to install sudo first podman start $RELEASE podman exec -it $RELEASE sh -exc ' -- 2.47.2