1 /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
2 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3 // Use of this source code is governed by a apache 2.0 license that can be
4 // found in the LICENSE file.
6 #include <common/installer_runner.h>
7 #include <common/pkgmgr_interface.h>
11 #include "hybrid/hybrid_installer.h"
12 #include "hybrid/hybrid_installer_factory.h"
13 #include "wgt/utils/wgt_app_query_interface.h"
14 #include "wgt/wgt_installer.h"
15 #include "wgt/wgt_installer_factory.h"
17 namespace ci = common_installer;
19 int main(int argc, char** argv) {
20 ci::PkgmgrInstaller pkgmgr_installer;
21 std::shared_ptr<wgt::WgtAppQueryInterface> query_interface(
22 new wgt::WgtAppQueryInterface());
24 auto pkgmgr = ci::PkgMgrInterface::Create(argc, argv, &pkgmgr_installer,
26 std::unique_ptr<ci::InstallerFactory> installer_factory;
28 LOG(ERROR) << "Options of pkgmgr installer cannot be parsed";
32 // This is workaround for hybrid apps as they requires much different flow
33 // but installer does not branch at all in current design
34 if (query_interface->IsHybridApplication(
35 pkgmgr->GetRequestInfo(), pkgmgr->GetUid())) {
36 LOG(INFO) << "Hybrid package detected";
37 ci::InstallerRunner runner(
38 std::make_unique<hybrid::HybridInstallerFactory>(), pkgmgr);
39 return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
41 ci::InstallerRunner runner(
42 std::make_unique<wgt::WgtInstallerFactory>(), pkgmgr);
43 return (runner.Run() == ci::AppInstaller::Result::OK) ? 0 : 1;
46 LOG(ERROR) << "Exception occured";