Rename dangerzone-converter to container

This commit is contained in:
Micah Lee 2021-11-29 15:30:21 -08:00
parent 3e11dc11e0
commit 2de2b6dca5
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
9 changed files with 25 additions and 27 deletions

4
.gitignore vendored
View file

@ -134,6 +134,6 @@ deb_dist
.DS_Store .DS_Store
install/windows/Dangerzone.wxs install/windows/Dangerzone.wxs
test_docs/sample-safe.pdf test_docs/sample-safe.pdf
share/dangerzone-converter.tar share/container.tar
share/dangerzone-converter.tar.gz share/container.tar.gz
share/image-id.txt share/image-id.txt

View file

@ -25,7 +25,7 @@ class GlobalCommon(object):
with open(self.get_resource_path("version.txt")) as f: with open(self.get_resource_path("version.txt")) as f:
self.version = f.read().strip() self.version = f.read().strip()
except FileNotFoundError: except FileNotFoundError:
# In dev mode, in Windows, get_resource_path doesn't work properly for dangerzone-container, but luckily # In dev mode, in Windows, get_resource_path doesn't work properly for the container, but luckily
# it doesn't need to know the version # it doesn't need to know the version
self.version = "unknown" self.version = "unknown"
@ -435,10 +435,8 @@ class GlobalCommon(object):
startupinfo=self.get_subprocess_startupinfo(), startupinfo=self.get_subprocess_startupinfo(),
) )
chunk_size = 1024 chunk_size = 10240
compressed_container_path = self.get_resource_path( compressed_container_path = self.get_resource_path("container.tar.gz")
"dangerzone-converter.tar.gz"
)
with gzip.open(compressed_container_path) as f: with gzip.open(compressed_container_path) as f:
while True: while True:
chunk = f.read(chunk_size) chunk = f.read(chunk_size)

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
echo "Building dangerzone-converter image" echo "Building container image"
podman build dangerzone-converter --tag dangerzone.rocks/dangerzone podman build container --tag dangerzone.rocks/dangerzone
echo "Saving dangerzone-converter image" echo "Saving container image"
podman save dangerzone.rocks/dangerzone -o share/dangerzone-converter.tar podman save dangerzone.rocks/dangerzone -o share/container.tar
echo "Compressing dangerzone-converter image" echo "Compressing container image"
gzip -f share/dangerzone-converter.tar gzip -f share/container.tar
echo "Looking up the image id" echo "Looking up the image id"
podman image ls dangerzone.rocks/dangerzone | grep "dangerzone.rocks/dangerzone" | tr -s ' ' | cut -d' ' -f3 > share/image-id.txt podman image ls dangerzone.rocks/dangerzone | grep "dangerzone.rocks/dangerzone" | tr -s ' ' | cut -d' ' -f3 > share/image-id.txt

View file

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
echo "Building dangerzone-converter image" echo "Building container image"
docker build dangerzone-converter --tag dangerzone.rocks/dangerzone docker build container --tag dangerzone.rocks/dangerzone
echo "Saving dangerzone-converter image" echo "Saving container image"
docker save dangerzone.rocks/dangerzone -o share/dangerzone-converter.tar docker save dangerzone.rocks/dangerzone -o share/container.tar
echo "Compressing dangerzone-converter image" echo "Compressing container image"
gzip -f share/dangerzone-converter.tar gzip -f share/container.tar
echo "Looking up the image id" echo "Looking up the image id"
docker image ls dangerzone.rocks/dangerzone | grep "dangerzone.rocks/dangerzone" | tr -s ' ' | cut -d' ' -f3 > share/image-id.txt docker image ls dangerzone.rocks/dangerzone | grep "dangerzone.rocks/dangerzone" | tr -s ' ' | cut -d' ' -f3 > share/image-id.txt

View file

@ -4,32 +4,32 @@ import os
def main(): def main():
print("Building dangerzone-converter image") print("Building container image")
subprocess.run( subprocess.run(
[ [
"docker", "docker",
"build", "build",
"dangerzone-converter", "container",
"--tag", "--tag",
"dangerzone.rocks/dangerzone", "dangerzone.rocks/dangerzone",
] ]
) )
print("Saving dangerzone-converter image") print("Saving container image")
subprocess.run( subprocess.run(
[ [
"docker", "docker",
"save", "save",
"dangerzone.rocks/dangerzone", "dangerzone.rocks/dangerzone",
"-o", "-o",
"share/dangerzone-converter.tar", "share/container.tar",
] ]
) )
print("Compressing dangerzone-converter image") print("Compressing container image")
chunk_size = 1024 chunk_size = 1024
with open("share/dangerzone-converter.tar", "rb") as f: with open("share/container.tar", "rb") as f:
with gzip.open("share/dangerzone-converter.tar.gz", "wb") as gzip_f: with gzip.open("share/container.tar.gz", "wb") as gzip_f:
while True: while True:
chunk = f.read(chunk_size) chunk = f.read(chunk_size)
if len(chunk) > 0: if len(chunk) > 0:
@ -37,7 +37,7 @@ def main():
else: else:
break break
os.remove("share/dangerzone-converter.tar") os.remove("share/container.tar")
print("Looking up the image id") print("Looking up the image id")
image_id = subprocess.check_output( image_id = subprocess.check_output(