Skip to content

Commit

Permalink
use shell.require_executable to verify existence of mksquashfs
Browse files Browse the repository at this point in the history
  • Loading branch information
azubieta committed Jun 16, 2022
1 parent a08ae8d commit 6ff2b1a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions appimagebuilder/modules/prime/appimage_primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import lief

from appimagebuilder.modules.prime.base_primer import BasePrimer
from appimagebuilder.utils import shell


class AppImagePrimer(BasePrimer):
Expand All @@ -42,8 +43,7 @@ def prime(self):
self._get_appimage_kit_runtime()

# create payload
payload_path = self.context.app_dir.with_suffix(".squashfs")
self._make_squashfs(self.context.app_dir, payload_path)
payload_path = self._make_squashfs(self.context.app_dir)

# prepare carrier (a.k.a. "runtime" using a different name to differentiate from the AppRun settings)
shutil.copyfile(self.carrier_path, self.appimage_path)
Expand Down Expand Up @@ -72,12 +72,13 @@ def _resolve_appimage_file_name(self):

return appimage_file_name

def _make_squashfs(self, appdir: pathlib.Path, appdir_squashfs_path):
mksquashfs_bin = shutil.which("mksquashfs")
def _make_squashfs(self, appdir: pathlib.Path):
payload_path = appdir.with_suffix(".squashfs")
mksquashfs_bin = shell.require_executable("mksquashfs")
command = [
mksquashfs_bin,
str(appdir),
str(appdir_squashfs_path),
str(payload_path),
"-root-owned",
"-noappend",
"-reproducible",
Expand All @@ -88,6 +89,7 @@ def _make_squashfs(self, appdir: pathlib.Path, appdir_squashfs_path):
self.logger.info("Creating squashfs from AppDir")
self.logger.debug(" ".join(command))
subprocess.run(command, check=True)
return payload_path

def _get_appimage_kit_runtime(self):
url = (
Expand Down

0 comments on commit 6ff2b1a

Please sign in to comment.