diff --git a/headers/os/package/PackageRoster.h b/headers/os/package/PackageRoster.h index a9134f52b2..61d6e9f5ef 100644 --- a/headers/os/package/PackageRoster.h +++ b/headers/os/package/PackageRoster.h @@ -56,6 +56,8 @@ public: BPackageRoster(); ~BPackageRoster(); + bool IsRebootNeeded(); + status_t GetCommonRepositoryCachePath(BPath* path, bool create = false) const; status_t GetUserRepositoryCachePath(BPath* path, diff --git a/src/kits/package/PackageRoster.cpp b/src/kits/package/PackageRoster.cpp index f5c8a42d80..bae024c657 100644 --- a/src/kits/package/PackageRoster.cpp +++ b/src/kits/package/PackageRoster.cpp @@ -52,6 +52,27 @@ BPackageRoster::~BPackageRoster() } +bool +BPackageRoster::IsRebootNeeded() +{ + BInstallationLocationInfo info; + + // We get information on the system package installation location. + // If we fail, we just have to assume a reboot is not needed. + if (GetInstallationLocationInfo(B_PACKAGE_INSTALLATION_LOCATION_SYSTEM, + info) != B_OK) + return false; + + // CurrentlyActivePackageInfos() will return 0 if no packages need to be + // activated with a reboot. Otherwise, the method will return the total + // number of packages in the system package directory. + if (info.CurrentlyActivePackageInfos().CountInfos() != 0) + return true; + + return false; +} + + status_t BPackageRoster::GetCommonRepositoryConfigPath(BPath* path, bool create) const {