* Enumeration for move types
*/
enum class MoveType : int {
+ NONE = -1,
TO_INTERNAL = 0,
TO_EXTERNAL = 1,
TO_EXTENDED = 2
namespace common_installer {
namespace filesystem {
+StepMoveInstalledStorage::StepMoveInstalledStorage(InstallerContext* context)
+ : Step(context), move_type_(MoveType::NONE) {
+}
+
Step::Status StepMoveInstalledStorage::process() {
PkgQueryInterface pkg_query(context_->pkgid.get(),
context_->uid.get());
public:
using Step::Step;
+ explicit StepMoveInstalledStorage(InstallerContext* context);
+
Status process() override;
Status clean() override;
break;
}
}
- if (gum_user_list == nullptr)
+ if (gum_user_list == nullptr) {
+ g_strfreev(user_type_strv);
return {};
+ }
UserList list;
for (GumUser* guser : GListRange<GumUser*>(gum_user_list)) {
} // namespace
int main(int argc, char *argv[]) {
- if (getuid() != kRootUserUid) {
- std::cerr << "This binary should be run as root user" << std::endl;
+ try {
+ if (getuid() != kRootUserUid) {
+ std::cerr << "This binary should be run as root user" << std::endl;
+ return -1;
+ }
+
+ InitPkgDB init_pkg_db;
+ if (!init_pkg_db.Init(argc, argv))
+ return -1;
+
+ if (!init_pkg_db.Run()) {
+ AddErrorFlag();
+ return -1;
+ }
+
+ return 0;
+ } catch(...) {
+ std::cerr << "Exception occured" << std::endl;
return -1;
}
-
- InitPkgDB init_pkg_db;
- if (!init_pkg_db.Init(argc, argv))
- return -1;
-
- if (!init_pkg_db.Run()) {
- AddErrorFlag();
- return -1;
- }
-
- return 0;
}
} // namespace
int main() {
- PkgRecoveryService service;
- service.Run();
- return 0;
+ try {
+ PkgRecoveryService service;
+ service.Run();
+ return 0;
+ } catch(...) {
+ LOG(ERROR) << "Exception occured";
+ return -1;
+ }
}