mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
PackageManager: Create /usr/Ports directory when updating the ports list
When updating /usr/Ports/AvailablePorts.md, the file or even the entire /usr/Ports directory might not exist. To cope with this, we should be able to create it ourselves. To ensure we are able to do this, we should unveil both /usr and /usr/Ports.
This commit is contained in:
parent
4303965986
commit
b6b2c6f3e2
2 changed files with 10 additions and 2 deletions
|
@ -26,8 +26,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::pledge("stdio recvfd thread unix rpath cpath wpath"));
|
||||
|
||||
TRY(Core::System::unveil("/tmp/session/%sid/portal/request", "rw"));
|
||||
TRY(Core::System::unveil("/usr/Ports/installed.db"sv, "rwc"sv));
|
||||
TRY(Core::System::unveil("/usr/Ports/AvailablePorts.md"sv, "rwc"sv));
|
||||
TRY(Core::System::unveil("/usr"sv, "c"sv));
|
||||
TRY(Core::System::unveil("/usr/Ports"sv, "rwc"sv));
|
||||
TRY(Core::System::unveil("/res"sv, "r"sv));
|
||||
TRY(Core::System::unveil("/usr/lib"sv, "r"sv));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
@ -54,6 +54,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
HashMap<String, InstalledPort> installed_ports;
|
||||
HashMap<String, AvailablePort> available_ports;
|
||||
if (show_all_installed_ports || show_all_dependency_ports || !query_package.is_null()) {
|
||||
if (Core::System::access("/usr/Ports/installed.md"sv, R_OK).is_error()) {
|
||||
warnln("pkg: /usr/Ports/installed.md isn't accessible, did you install a package in the past?");
|
||||
return 1;
|
||||
}
|
||||
installed_ports = TRY(InstalledPort::read_ports_database());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue