diff --git a/BUILD.md b/BUILD.md index 46a4d7b..824f050 100644 --- a/BUILD.md +++ b/BUILD.md @@ -27,6 +27,26 @@ Create a .deb: ./install/linux/build_deb.py ``` +## Fedora + +Install dependencies: + +```sh +sudo dnf install -y rpm-build python3 python3-qt5 python3-appdirs python3-click +``` + +Run from source tree: + +```sh +./dev_script/dangerzone +``` + +Create a .rpm: + +```sh +./install/linux/build_rpm.py +``` + ## macOS Install Xcode from the Mac App Store. Once it's installed, run it for the first time to set it up. Also, run this to make sure command line tools are installed: `xcode-select --install`. And finally, open Xcode, go to Preferences > Locations, and make sure under Command Line Tools you select an installed version from the dropdown. (This is required for installing Qt5.) diff --git a/dangerzone/common.py b/dangerzone/common.py index 2da0ebe..9a2e449 100644 --- a/dangerzone/common.py +++ b/dangerzone/common.py @@ -68,7 +68,7 @@ class Common(object): # If this is fedora-like, use podman if os.path.exists("/usr/bin/dnf"): - self.container_runtime = "podman" + self.container_runtime = "/usr/bin/podman" # Otherwise, use docker else: self.container_runtime = "/usr/bin/docker" diff --git a/install/linux/build_rpm.py b/install/linux/build_rpm.py new file mode 100755 index 0000000..dc243da --- /dev/null +++ b/install/linux/build_rpm.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +import os +import sys +import inspect +import subprocess +import shutil + +sys.path.insert( + 0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +) +import dangerzone + +version = dangerzone.dangerzone_version +root = os.path.dirname( + os.path.dirname( + os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) + ) +) + + +def run(cmd): + subprocess.run(cmd, cwd=root, check=True) + + +def main(): + build_path = os.path.join(root, "build") + dist_path = os.path.join(root, "dist") + + print("* Deleting old build and dist") + if os.path.exists(build_path): + shutil.rmtree(build_path) + if os.path.exists(dist_path): + shutil.rmtree(dist_path) + + print("* Building RPM package") + run( + [ + "python3", + "setup.py", + "bdist_rpm", + "--requires=python3-qt5,python3-appdirs,python3-click", + ] + ) + + print("") + print("* To install run:") + print("sudo dnf install dist/dangerzone-{}-1.noarch.rpm".format(version)) + + +if __name__ == "__main__": + main()