Browse Source

ignore errors when chowning at initial startup

Nick Sweeting 1 year ago
parent
commit
de7ab65f11
5 changed files with 7 additions and 19 deletions
  1. 1 1
      archivebox/config/legacy.py
  2. 0 12
      archivebox/main.py
  3. 1 1
      pyproject.toml
  4. 1 1
      requirements.txt
  5. 4 4
      uv.lock

+ 1 - 1
archivebox/config/legacy.py

@@ -581,7 +581,7 @@ def setup_django(out_dir: Path | None=None, check_db=False, config: benedict=CON
         _get_collection_id(DATA_DIR=CONSTANTS.DATA_DIR, force_create=True)
         _get_collection_id(DATA_DIR=CONSTANTS.DATA_DIR, force_create=True)
         if IS_ROOT:
         if IS_ROOT:
             with SudoPermission(uid=0):
             with SudoPermission(uid=0):
-                os.system(f'chown {ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP} "{CONSTANTS.DATA_DIR}"/*')
+                os.system(f'chown {ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP} "{CONSTANTS.DATA_DIR}"/* 2>/dev/null')
 
 
         bump_startup_progress_bar()
         bump_startup_progress_bar()
         try:
         try:

+ 0 - 12
archivebox/main.py

@@ -325,18 +325,6 @@ def init(force: bool=False, quick: bool=False, install: bool=False, out_dir: Pat
     from core.models import Snapshot
     from core.models import Snapshot
     from rich import print
     from rich import print
     
     
-    from archivebox.config.permissions import IS_ROOT, ARCHIVEBOX_USER, ARCHIVEBOX_GROUP
-    from archivebox.config.paths import _get_collection_id
-
-    # if running as root, chown the data dir to the archivebox user to make sure it's accessible to the archivebox user
-    if IS_ROOT:
-        with SudoPermission(uid=0):
-            os.system(f'chown {ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP} "{CONSTANTS.DATA_DIR}"')
-    _get_collection_id()
-    if IS_ROOT:
-        with SudoPermission(uid=0):
-            os.system(f'chown {ARCHIVEBOX_USER}:{ARCHIVEBOX_GROUP} "{CONSTANTS.DATA_DIR}"/*')
-    
     # if os.access(out_dir / CONSTANTS.JSON_INDEX_FILENAME, os.F_OK):
     # if os.access(out_dir / CONSTANTS.JSON_INDEX_FILENAME, os.F_OK):
     #     print("[red]:warning: This folder contains a JSON index. It is deprecated, and will no longer be kept up to date automatically.[/red]", file=sys.stderr)
     #     print("[red]:warning: This folder contains a JSON index. It is deprecated, and will no longer be kept up to date automatically.[/red]", file=sys.stderr)
     #     print("[red]    You can run `archivebox list --json --with-headers > static_index.json` to manually generate it.[/red]", file=sys.stderr)
     #     print("[red]    You can run `archivebox list --json --with-headers > static_index.json` to manually generate it.[/red]", file=sys.stderr)

+ 1 - 1
pyproject.toml

@@ -1,6 +1,6 @@
 [project]
 [project]
 name = "archivebox"
 name = "archivebox"
-version = "0.8.5rc31"
+version = "0.8.5rc32"
 requires-python = ">=3.10"
 requires-python = ">=3.10"
 description = "Self-hosted internet archiving solution."
 description = "Self-hosted internet archiving solution."
 authors = [{name = "Nick Sweeting", email = "[email protected]"}]
 authors = [{name = "Nick Sweeting", email = "[email protected]"}]

+ 1 - 1
requirements.txt

@@ -203,7 +203,7 @@ pydantic-core==2.23.4
     # via
     # via
     #   pydantic
     #   pydantic
     #   pydantic-pkgr
     #   pydantic-pkgr
-pydantic-pkgr==0.4.21
+pydantic-pkgr==0.4.22
     # via archivebox (pyproject.toml)
     # via archivebox (pyproject.toml)
 pydantic-settings==2.5.2
 pydantic-settings==2.5.2
     # via archivebox (pyproject.toml)
     # via archivebox (pyproject.toml)

+ 4 - 4
uv.lock

@@ -41,7 +41,7 @@ wheels = [
 
 
 [[package]]
 [[package]]
 name = "archivebox"
 name = "archivebox"
-version = "0.8.5rc31"
+version = "0.8.5rc32"
 source = { editable = "." }
 source = { editable = "." }
 dependencies = [
 dependencies = [
     { name = "atomicwrites" },
     { name = "atomicwrites" },
@@ -1834,16 +1834,16 @@ wheels = [
 
 
 [[package]]
 [[package]]
 name = "pydantic-pkgr"
 name = "pydantic-pkgr"
-version = "0.4.21"
+version = "0.4.22"
 source = { registry = "https://pypi.org/simple" }
 source = { registry = "https://pypi.org/simple" }
 dependencies = [
 dependencies = [
     { name = "pydantic" },
     { name = "pydantic" },
     { name = "pydantic-core" },
     { name = "pydantic-core" },
     { name = "typing-extensions" },
     { name = "typing-extensions" },
 ]
 ]
-sdist = { url = "https://files.pythonhosted.org/packages/a4/5d/25288d8eb7386e68ac3e19ed2874219dffc7225b5db61e7749668d4cb2fd/pydantic_pkgr-0.4.21.tar.gz", hash = "sha256:ace74f3d4ab1d69d16f52d40ee8897b47deb89f4c82e659c29fd242407adb64c", size = 38567 }
+sdist = { url = "https://files.pythonhosted.org/packages/33/27/7f53f0b7e7359b20ddef4483256f535190e8b0bf291f0d0e63209e882a0b/pydantic_pkgr-0.4.22.tar.gz", hash = "sha256:5b6f7b19938b82483f5ba664ddf9ba249b9e9900a1088b0162dd378fd9291ea9", size = 38723 }
 wheels = [
 wheels = [
-    { url = "https://files.pythonhosted.org/packages/8b/b5/1f36fc3fbd667ff6d1da581689fe9de2ef700a645d4f10f3f5c1afc7a4a6/pydantic_pkgr-0.4.21-py3-none-any.whl", hash = "sha256:6138ad0f979a6ea233ba3abc4010a0a974931796e94256f3c09e7fde5b020488", size = 41633 },
+    { url = "https://files.pythonhosted.org/packages/c1/48/783c3d7aa78fcd2bda2e0da83c163fb828647d12b9b82a71ca59eb82629b/pydantic_pkgr-0.4.22-py3-none-any.whl", hash = "sha256:f359e8676d92f9e8cc2bff44720407b04ff87c1df2da49077e72a2f9cb65aa2a", size = 41699 },
 ]
 ]
 
 
 [[package]]
 [[package]]