Skip to content

Commit

Permalink
fwupdate_upload: single rootfs update scheme support (#108) (#113)
Browse files Browse the repository at this point in the history
* fwupdate_upload: use dir defined by wb-watch-update if it exists
* fwupdate_upload: fix python formatting
  • Loading branch information
webconn authored Apr 24, 2023
1 parent ece5fb5 commit bc53c48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions configs/usr/lib/cgi-bin/fwupdate_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import tempfile
from cgi import FieldStorage

if os.path.islink("/var/run/wb-watch-update.dir"):
RW_DIR = os.path.realpath("/var/run/wb-watch-update.dir")
else:
RW_DIR = os.environ.get("UPLOADS_DIR", "/var/www/uploads") # nginx user should has rw access

RW_DIR = os.environ.get("UPLOADS_DIR", "/var/www/uploads") # nginx user should has rw access
TMP_DIR = os.path.join(RW_DIR, "state", "tmp") # excluded from wb-watch-update
os.makedirs(TMP_DIR, exist_ok=True)

Expand All @@ -31,12 +34,11 @@ class DiskFieldStorage(FieldStorage):
"""

def make_file(self):
location = TMP_DIR # has rw access & excluded from wb-watch-update
location = TMP_DIR # has rw access & excluded from wb-watch-update
if self._binary_file:
return tempfile.TemporaryFile("wb+", dir=location)
else:
return tempfile.TemporaryFile("w+",
encoding=self.encoding, newline = '\n', dir=location)
return tempfile.TemporaryFile("w+", encoding=self.encoding, newline="\n", dir=location)


form = DiskFieldStorage(encoding="utf-8")
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
wb-configs (3.13.1-wb102) stable; urgency=medium

* fwupdate_upload: single rootfs update scheme support

-- Nikita Maslov <[email protected]> Thu, 20 Apr 2023 19:03:31 +0600

wb-configs (3.13.1-wb101) stable; urgency=medium

* set Wi-Fi AP channel to 1 explicitly (channels 6 and 13 seems to be
Expand Down

0 comments on commit bc53c48

Please sign in to comment.