Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/core/appdir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,22 @@ namespace linuxdeploy {
return true;
}

// TODO: Reduce duplicated code between deploy methods

bool deployAppstreamFile(const fs::path& path) {
if (hasBeenVisitedAlready(path)) {
ldLog() << LD_DEBUG << "File has been visited already:" << desktopFile.path() << std::endl;
return true;
}

ldLog() << "Deploying appstream file" << path << std::endl;

auto filename = path.filename().string();
deployFile(path, appDirPath / "usr/share/metainfo" / filename, DEFAULT_PERMS);

return true;
}

static bool isInDebugSymbolsLocation(const fs::path& path) {
// TODO: check if there's more potential locations for debug symbol files
for (const std::string& dbgSymbolsPrefix : {".debug/"}) {
Expand Down Expand Up @@ -716,6 +732,10 @@ namespace linuxdeploy {
return d->deployIcon(path, targetFilename);
}

bool AppDir::deployAppstreamFile(const fs::path& path) {
return d->deployAppstreamFile(path);
}

bool AppDir::executeDeferredOperations() {
return d->executeDeferredOperations();
}
Expand Down
18 changes: 17 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int argc, char** argv) {
args::Flag showVersion(parser, "", "Print version and exit", {'V', "version"});
args::ValueFlag<int> verbosity(parser, "verbosity", "Verbosity of log output (0 = debug, 1 = info (default), 2 = warning, 3 = error)", {'v', "verbosity"});

args::ValueFlag<std::string> appDirPath(parser, "appdir", "Path to target AppDir", {"appdir"});
args::ValueFlag<std::string> appDirPath(parser, "appdir", "Path to target AppDir", {'a', "appdir"});

args::ValueFlagList<std::string> sharedLibraryPaths(parser, "library", "Shared library to deploy", {'l', "library"});
args::ValueFlagList<std::string> excludeLibraryPatterns(parser, "pattern", "Shared library to exclude from deployment (glob pattern)", {"exclude-library"});
Expand All @@ -43,6 +43,8 @@ int main(int argc, char** argv) {
args::ValueFlagList<std::string> iconPaths(parser, "icon file", "Icon to deploy", {'i', "icon-file"});
args::ValueFlag<std::string> iconTargetFilename(parser, "filename", "Filename all icons passed via -i should be renamed to", {"icon-filename"});

args::ValueFlag<std::string> appstreamPath(parser, "appstream file", "Appstream file to deploy", {"appstream-file"});

args::ValueFlag<std::string> customAppRunPath(parser, "AppRun path", "Path to custom AppRun script (linuxdeploy will not create a symlink but copy this file instead)", {"custom-apprun"});

args::Flag listPlugins(parser, "", "Search for plugins, print them to stdout and exit", {"list-plugins"});
Expand Down Expand Up @@ -276,6 +278,20 @@ int main(int argc, char** argv) {
}
}

// deploy appstream file to usr/share/metainfo
if (appstreamPath) {
appstreamPath = appstreamPath.Get();
if (!fs::exists(appstreamPath)) {
ldLog() << LD_ERROR << "No such file or directory: " << appstreamPath << std::endl;
return 1;
}

if (!appDir.deployAppstreamFile(appstreamPath)) {
ldLog() << LD_ERROR << "Failed to deploy appstream file: " << appstreamPath << std::endl;
return 1;
}
}

// perform deferred copy operations before creating other files here before trying to copy the files to the AppDir root
ldLog() << std::endl << "-- Copying files into AppDir --" << std::endl;
if (!appDir.executeDeferredOperations()) {
Expand Down