3 Commits

Author SHA1 Message Date
88b35ee923 backup(cli): use FHS-compliant default backup directory
- Replace dynamic repo name detection with stable default
- Switch default backups directory from /Backups to /var/lib/backup
- Align CLI defaults with Linux FHS best practices

https://chatgpt.com/share/69515eed-001c-800f-b1da-aee8d8683e63
2025-12-28 17:46:31 +01:00
71f79929be Changedf pi update mirror 2025-12-27 12:49:24 +01:00
0fb8efba4f Ignored .egg-info 2025-12-27 09:33:59 +01:00
5 changed files with 6 additions and 21 deletions

3
.gitignore vendored
View File

@@ -1,2 +1,3 @@
__pycache__ __pycache__
artifacts/ artifacts/
*.egg-info

View File

@@ -1,4 +1,4 @@
git@github.com:kevinveenbirkenbach/backup-docker-to-local.git git@github.com:kevinveenbirkenbach/backup-docker-to-local.git
ssh://git@git.veen.world:2201/kevinveenbirkenbach/backup-docker-to-local.git ssh://git@git.veen.world:2201/kevinveenbirkenbach/backup-docker-to-local.git
ssh://git@code.infinito.nexus:2201/kevinveenbirkenbach/backup-docker-to-local.git ssh://git@code.infinito.nexus:2201/kevinveenbirkenbach/backup-docker-to-local.git
https://pypi.org/project/baudolo/ https://pypi.org/project/backup-docker-to-local/

Binary file not shown.

BIN
dist/backup_docker_to_local-1.0.0.tar.gz vendored Normal file

Binary file not shown.

View File

@@ -4,22 +4,6 @@ import argparse
import os import os
from pathlib import Path from pathlib import Path
def _default_repo_name() -> str:
"""
Derive the repository name from the folder that contains `src/`.
Expected layout:
<repo-root>/src/baudolo/backup/cli.py
=> parents[0]=backup, [1]=baudolo, [2]=src, [3]=repo-root
"""
try:
return Path(__file__).resolve().parents[3].name
except Exception:
return "backup-docker-to-local"
def parse_args() -> argparse.Namespace: def parse_args() -> argparse.Namespace:
dirname = os.path.dirname(__file__) dirname = os.path.dirname(__file__)
default_databases_csv = os.path.join(dirname, "databases.csv") default_databases_csv = os.path.join(dirname, "databases.csv")
@@ -41,7 +25,7 @@ def parse_args() -> argparse.Namespace:
p.add_argument( p.add_argument(
"--repo-name", "--repo-name",
default=_default_repo_name(), default='backup-docker-to-local',
help="Backup repo folder name under <backups-dir>/<machine-id>/ (default: git repo folder name)", help="Backup repo folder name under <backups-dir>/<machine-id>/ (default: git repo folder name)",
) )
p.add_argument( p.add_argument(
@@ -51,8 +35,8 @@ def parse_args() -> argparse.Namespace:
) )
p.add_argument( p.add_argument(
"--backups-dir", "--backups-dir",
default="/Backups", default="/var/lib/backup/",
help="Backup root directory (default: /Backups)", help="Backup root directory (default: /var/lib/backup/)",
) )
p.add_argument( p.add_argument(