Skip to content

Commit abbd4d3

Browse files
committed
Add AppImage installed path to linuxdeploy.conf
1 parent ff46a56 commit abbd4d3

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

ldnp/abstractpackager.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import configparser
12
import glob
23
import os
34
import shlex
@@ -241,6 +242,24 @@ def copy_appdir_contents(self):
241242
dirs_exist_ok=True,
242243
)
243244

245+
def write_ldnp_conf(self):
246+
conf_path = self.appdir_install_path / "usr" / "bin" / "linuxdeploy.conf"
247+
248+
config = configparser.ConfigParser()
249+
250+
try:
251+
with open(conf_path) as f:
252+
config.read_file(f)
253+
except FileNotFoundError:
254+
pass
255+
256+
config["ldnp"] = {
257+
"appdir_installed_path": str(self.appdir_installed_path),
258+
}
259+
260+
with open(conf_path, "w") as f:
261+
config.write(f)
262+
244263
def create_package(self, out_path: str | os.PathLike):
245264
# to be implemented by subclasses
246265
raise NotImplementedError

ldnp/deb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def create_package(self, out_path: str | os.PathLike):
8282

8383
self.copy_appdir_contents()
8484
self.copy_data_to_usr()
85+
self.write_ldnp_conf()
8586
self.generate_control_file()
8687
self.generate_shlibs_file()
8788
self.generate_deb(out_path)

ldnp/rpm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def create_package(self, out_path: str | os.PathLike):
149149

150150
self.copy_appdir_contents()
151151
self.copy_data_to_usr()
152+
self.write_ldnp_conf()
152153
self.generate_spec_file()
153154
self.generate_rpm(out_path)
154155

0 commit comments

Comments
 (0)