Add Reboot Check to BPackageRoster
A bit of an explanation for these weirdly named functions: LatestActivePackageInfos() returns the packages on the system that are both installed and fully set up. When packages are in the middle of being installed, LatestInactivePackageInfos() shows the packages in the process of being installed. Once the installation process is done, LatestInactivePackageInfos() returns nothing. If there are packages that can't be fully activated without a reboot, CurrentlyActivePackageInfos() will return the same information as LatestActivePackageInfos(), or if everything has been installed and activated, it will return no packages. Change-Id: Ia1814a5abda6d815c46e0b46dc812b4e7af81de3 Reviewed-on: https://review.haiku-os.org/c/1129 Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
parent
3392267267
commit
e2c7bb900c
@ -56,6 +56,8 @@ public:
|
||||
BPackageRoster();
|
||||
~BPackageRoster();
|
||||
|
||||
bool IsRebootNeeded();
|
||||
|
||||
status_t GetCommonRepositoryCachePath(BPath* path,
|
||||
bool create = false) const;
|
||||
status_t GetUserRepositoryCachePath(BPath* path,
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user