From cfabe8d2784383f5bd8e53602032d7b1006c094f Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 3 Feb 2024 17:53:24 +0100 Subject: [PATCH] Add db-update command --- scripts/p7s/distrobox.py | 15 +++++++++++++-- scripts/pyproject.toml | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/p7s/distrobox.py b/scripts/p7s/distrobox.py index 45e11a6..2e4e5ce 100644 --- a/scripts/p7s/distrobox.py +++ b/scripts/p7s/distrobox.py @@ -2,9 +2,20 @@ import os import subprocess +IMAGE="quay.io/alexpdp7/workstation:latest" +NAME="workstation-latest" + + def create(): - subprocess.run(["distrobox", "create", "-i", "quay.io/alexpdp7/workstation:latest"], check=True) + subprocess.run(["distrobox", "create", "-i", IMAGE], check=True) def enter(): - os.execvp("distrobox", ["distrobox", "enter", "workstation-latest"]) + os.execvp("distrobox", ["distrobox", "enter", NAME]) + + +def update(): + subprocess.run(["distrobox", "rm", "-f", NAME], check=True) + subprocess.run(["podman", "rmi", IMAGE], check=True) + subprocess.run(["podman", "pull", IMAGE], check=True) + subprocess.run(["distrobox", "create", "-i", IMAGE], check=True) diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml index 1480d2f..a98507a 100644 --- a/scripts/pyproject.toml +++ b/scripts/pyproject.toml @@ -20,6 +20,7 @@ ruscreen = 'p7s.ruscreen:main' mbsync_config = 'p7s.mail:generate_config' db-create = 'p7s.distrobox:create' db-enter = 'p7s.distrobox:enter' +db-update = 'p7s.distrobox:update' nextcloud_setup = 'p7s.nextcloud:setup_nextcloud' soju_setup = 'p7s.soju:setup_soju' bitlbee_setup = 'p7s.bitlbee:setup_bitlbee' -- 2.47.3