M doc/os_api/endpoints/pure/device_info_endpoint.md => doc/os_api/endpoints/pure/device_info_endpoint.md +8 -4
@@ 78,8 78,10 @@ enum class Method
"trayState":"1",
"version": "0.73.1",
"serialNumber": "12345678901234",
- "backupLocation": "path/to/directory",
- "syncPackageLocationLocation": "path/to/directory"
+ "recoveryStatusFilePath": "path/to/recovery_status",
+ "updateFilePath": "path/to/update_package",
+ "backupFilePath": "path/to/backup_package",
+ "syncFilePath": "path/to/sync_package",
},
"endpoint":1,
"status":200,
@@ 112,8 114,10 @@ enum class Method
- *uuid* - unique payload id, same as in request message
- *version* - os version string
- *serialNumber* - device serial number (14 digits)
- - *"backupLocation"* - path to the location of backup files on device file-system
- - *"syncPackageLocation"* - path to the location of sync package on device filesystem
+ - *recoveryStatusFilePath* - location of the PureRecovery status file
+ - *updateFilePath* - location of the update package
+ - *backupFilePath* - location of the backup package
+ - *syncFilePath* - location of the sync package
```
struct Network
M image/user/boot.json => image/user/boot.json +2 -2
@@ 8,7 8,7 @@
"prefix" : "/system_a"
},
"b": {
- "bootable": true,
+ "bootable": false,
"successful": false,
"boot_attempts_left": "10",
"prefix" : "/system_b"
@@ 19,6 19,6 @@
"os": "os.bin",
"recovery": "recovery.bin",
"bin_dir": "bin",
- "update_dir": "/user/update"
+ "update_dir": "/user/temp/update"
}
}
M module-services/service-desktop/Sync.cpp => module-services/service-desktop/Sync.cpp +1 -1
@@ 92,7 92,7 @@ bool Sync::PackSyncFiles(const std::filesystem::path &path)
}
auto isTarFileOpen = false;
- std::filesystem::path tarFilePath = (purefs::dir::getSyncPackagePath() / path.filename());
+ std::filesystem::path tarFilePath = (purefs::dir::getTemporaryPath() / path.filename());
mtar_t tarFile;
auto cleanup = gsl::finally([&isTarFileOpen, &tarFile]() {
M module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp => module-services/service-desktop/endpoints/include/endpoints/JsonKeyNames.hpp +31 -29
@@ 25,35 25,37 @@ namespace sdesktop::endpoints::json
inline constexpr auto networkOperatorName = "networkOperatorName";
inline constexpr auto accessTechnology = "accessTechnology";
- inline constexpr auto update = "update";
- inline constexpr auto updateInfo = "updateInfo";
- inline constexpr auto updateError = "updateError";
- inline constexpr auto errorCode = "errorCode";
- inline constexpr auto statusCode = "statusCode";
- inline constexpr auto updateHistory = "updateHistory";
- inline constexpr auto usbMscMode = "usbMscMode";
- inline constexpr auto versionString = "string";
- inline constexpr auto fileExists = "fileExists";
- inline constexpr auto boot = "boot";
- inline constexpr auto version = "version";
- inline constexpr auto taskId = "id";
- inline constexpr auto state = "state";
- inline constexpr auto success = "success";
- inline constexpr auto reboot = "reboot";
- inline constexpr auto rebootMode = "rebootMode";
- inline constexpr auto request = "request";
- inline constexpr auto restore = "restore";
- inline constexpr auto finished = "finished";
- inline constexpr auto pending = "pending";
- inline constexpr auto location = "location";
- inline constexpr auto reason = "reason";
- inline constexpr auto serialNumber = "serialNumber";
- inline constexpr auto caseColour = "caseColour";
- inline constexpr auto fileList = "fileList";
- inline constexpr auto files = "files";
- inline constexpr auto backupLocation = "backupLocation";
- inline constexpr auto syncPackageLocation = "syncPackageLocation";
- inline constexpr auto deviceToken = "deviceToken";
+ inline constexpr auto update = "update";
+ inline constexpr auto updateInfo = "updateInfo";
+ inline constexpr auto updateError = "updateError";
+ inline constexpr auto errorCode = "errorCode";
+ inline constexpr auto statusCode = "statusCode";
+ inline constexpr auto updateHistory = "updateHistory";
+ inline constexpr auto usbMscMode = "usbMscMode";
+ inline constexpr auto versionString = "string";
+ inline constexpr auto fileExists = "fileExists";
+ inline constexpr auto boot = "boot";
+ inline constexpr auto version = "version";
+ inline constexpr auto taskId = "id";
+ inline constexpr auto state = "state";
+ inline constexpr auto success = "success";
+ inline constexpr auto reboot = "reboot";
+ inline constexpr auto rebootMode = "rebootMode";
+ inline constexpr auto request = "request";
+ inline constexpr auto restore = "restore";
+ inline constexpr auto finished = "finished";
+ inline constexpr auto pending = "pending";
+ inline constexpr auto location = "location";
+ inline constexpr auto reason = "reason";
+ inline constexpr auto serialNumber = "serialNumber";
+ inline constexpr auto caseColour = "caseColour";
+ inline constexpr auto fileList = "fileList";
+ inline constexpr auto files = "files";
+ inline constexpr auto recoveryStatusFilePath = "recoveryStatusFilePath";
+ inline constexpr auto updateFilePath = "updateFilePath";
+ inline constexpr auto backupFilePath = "backupFilePath";
+ inline constexpr auto syncFilePath = "syncFilePath";
+ inline constexpr auto deviceToken = "deviceToken";
namespace updateprocess
{
M module-services/service-desktop/endpoints/include/endpoints/deviceInfo/DeviceInfoEndpointCommon.hpp => module-services/service-desktop/endpoints/include/endpoints/deviceInfo/DeviceInfoEndpointCommon.hpp +6 -0
@@ 40,6 40,12 @@ namespace sdesktop::endpoints
{
return http::Code::BadRequest;
};
+
+ protected:
+ static constexpr auto updateFilename = "update.tar";
+ static constexpr auto syncFilename = "sync.tar";
+ static constexpr auto backupFilename = "backup.tar";
+ static constexpr auto recoveryStatusFilename = "recovery_status.json";
};
} // namespace sdesktop::endpoints
M module-services/service-desktop/include/service-desktop/Constants.hpp => module-services/service-desktop/include/service-desktop/Constants.hpp +1 -1
@@ 8,4 8,4 @@
namespace service::name
{
inline constexpr auto service_desktop = "ServiceDesktop";
-};
+}
M module-vfs/paths/filesystem_paths.cpp => module-vfs/paths/filesystem_paths.cpp +2 -20
@@ 10,14 10,11 @@ namespace
constexpr inline auto PATH_USER = "/user";
constexpr inline auto PATH_CONF = "/mfgconf";
constexpr inline auto PATH_DB = "db";
- constexpr inline auto PATH_UPDATE = "update";
- constexpr inline auto PATH_SYNC = "sync";
constexpr inline auto PATH_LOGS = "log";
constexpr inline auto PATH_CRASH_DUMPS = "crash_dumps";
constexpr inline auto PATH_USER_MEDIA =
"media"; // TODO this won't work with our current non-hierarchical MTP implementation
- constexpr inline auto PATH_TMP = "tmp";
- constexpr inline auto PATH_BACKUP = "backup";
+ constexpr inline auto PATH_TMP = "temp";
constexpr inline auto PATH_ASSETS = "assets";
constexpr inline auto PATH_DATA = "data";
} // namespace
@@ 51,16 48,6 @@ namespace purefs
return getSystemDiskPath() / PATH_DB;
}
- std::filesystem::path getUpdateDirPath() noexcept
- {
- return getUserDiskPath() / PATH_UPDATE;
- }
-
- std::filesystem::path getSyncPackagePath() noexcept
- {
- return getUserDiskPath() / PATH_SYNC; // TODO what's this?
- }
-
std::filesystem::path getLogsPath() noexcept
{
return getSystemDiskPath() / PATH_LOGS;
@@ 78,12 65,7 @@ namespace purefs
std::filesystem::path getTemporaryPath() noexcept
{
- return getSystemDiskPath() / PATH_TMP; // TODO is it needed + if it is, where it should be placed
- }
-
- std::filesystem::path getBackupOSPath() noexcept
- {
- return getUserDiskPath() / PATH_BACKUP; // TODO is it still needed?
+ return getSystemDiskPath() / PATH_TMP;
}
std::filesystem::path getBootJSONPath() noexcept
M module-vfs/paths/include/purefs/filesystem_paths.hpp => module-vfs/paths/include/purefs/filesystem_paths.hpp +0 -2
@@ 15,13 15,11 @@ namespace purefs
std::filesystem::path getUserDiskPath() noexcept;
std::filesystem::path getMfgConfPath() noexcept;
std::filesystem::path getDatabasesPath() noexcept;
- std::filesystem::path getUpdateDirPath() noexcept;
std::filesystem::path getSyncPackagePath() noexcept;
std::filesystem::path getLogsPath() noexcept;
std::filesystem::path getCrashDumpsPath() noexcept;
std::filesystem::path getUserMediaPath() noexcept;
std::filesystem::path getTemporaryPath() noexcept;
- std::filesystem::path getBackupOSPath() noexcept;
std::filesystem::path getBootJSONPath() noexcept;
std::filesystem::path getAssetsDirPath() noexcept;
std::filesystem::path getSystemDataDirPath() noexcept;
M products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp => products/BellHybrid/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +15 -11
@@ 31,17 31,21 @@ namespace sdesktop::endpoints
{
auto [totalDeviceSpaceMiB, reservedSystemSpaceMiB, usedUserSpaceMiB] = getStorageInfo();
- context.setResponseBody(
- json11::Json::object({{json::batteryLevel, std::to_string(Store::Battery::get().level)},
- {json::batteryState, std::to_string(static_cast<int>(Store::Battery::get().state))},
- {json::deviceSpaceTotal, std::to_string(totalDeviceSpaceMiB)},
- {json::systemReservedSpace, std::to_string(reservedSystemSpaceMiB)},
- {json::usedUserSpace, std::to_string(usedUserSpaceMiB)},
- {json::gitRevision, (std::string)(GIT_REV)},
- {json::gitBranch, (std::string)GIT_BRANCH},
- {json::currentRTCTime, std::to_string(static_cast<uint32_t>(std::time(nullptr)))},
- {json::version, std::string(VERSION)},
- {json::serialNumber, getSerialNumber()}}));
+ context.setResponseBody(json11::Json::object(
+ {{json::batteryLevel, std::to_string(Store::Battery::get().level)},
+ {json::batteryState, std::to_string(static_cast<int>(Store::Battery::get().state))},
+ {json::deviceSpaceTotal, std::to_string(totalDeviceSpaceMiB)},
+ {json::systemReservedSpace, std::to_string(reservedSystemSpaceMiB)},
+ {json::usedUserSpace, std::to_string(usedUserSpaceMiB)},
+ {json::gitRevision, (std::string)(GIT_REV)},
+ {json::gitBranch, (std::string)GIT_BRANCH},
+ {json::currentRTCTime, std::to_string(static_cast<uint32_t>(std::time(nullptr)))},
+ {json::version, std::string(VERSION)},
+ {json::serialNumber, getSerialNumber()},
+ {json::recoveryStatusFilePath, purefs::dir::getTemporaryPath() / recoveryStatusFilename},
+ {json::updateFilePath, purefs::dir::getTemporaryPath() / updateFilename},
+ {json::backupFilePath, purefs::dir::getTemporaryPath() / backupFilename},
+ {json::syncFilePath, purefs::dir::getTemporaryPath() / syncFilename}}));
return http::Code::OK;
}
M products/PurePhone/CMakeLists.txt => products/PurePhone/CMakeLists.txt +2 -2
@@ 108,9 108,9 @@ include(AddVersionJson)
add_directories(
TARGET create_user_directories
- PREFIX ${SYSROOT_PATH}/user/media/app
+ PREFIX ${SYSROOT_PATH}/user
DEPENDS system_directories_common
- DIRECTORIES music_player
+ DIRECTORIES data temp media/app/music_player
)
if (${PROJECT_TARGET} STREQUAL "TARGET_RT1051")
M products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp => products/PurePhone/services/desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +4 -3
@@ 19,7 19,6 @@
namespace sdesktop::endpoints
{
-
auto DeviceInfoEndpoint::getSerialNumber() -> std::string
{
return dynamic_cast<ServiceDesktop *>(ownerServicePtr)->getSerialNumber();
@@ 58,8 57,10 @@ namespace sdesktop::endpoints
{json::version, std::string(VERSION)},
{json::serialNumber, getSerialNumber()},
{json::caseColour, getCaseColour()},
- {json::backupLocation, purefs::dir::getBackupOSPath().string()},
- {json::syncPackageLocation, purefs::dir::getSyncPackagePath().string()},
+ {json::recoveryStatusFilePath, purefs::dir::getTemporaryPath() / recoveryStatusFilename},
+ {json::updateFilePath, purefs::dir::getTemporaryPath() / updateFilename},
+ {json::backupFilePath, purefs::dir::getTemporaryPath() / backupFilename},
+ {json::syncFilePath, purefs::dir::getTemporaryPath() / syncFilename},
{json::deviceToken, getDeviceToken()}}));
return http::Code::OK;
M scripts/lua/migration/migration.lua => scripts/lua/migration/migration.lua +2 -2
@@ 56,7 56,7 @@ local function read_db_version(file)
end
local function db_migrate_up(db_path, scripts, target_version)
- current_version = read_db_version(db_path)
+ local current_version = read_db_version(db_path)
if current_version == target_version then
return migration.retcode.ALREADY_UP_TO_DATE
@@ 73,7 73,7 @@ local function db_migrate_up(db_path, scripts, target_version)
end
local function db_migrate_down(db_path, scripts, target_version)
- current_version = read_db_version(db_path)
+ local current_version = read_db_version(db_path)
if current_version == target_version then
return migration.retcode.ALREADY_UP_TO_DATE
M scripts/lua/share/helpers.lua => scripts/lua/share/helpers.lua +1 -1
@@ 79,7 79,7 @@ function helpers.copy_file(filename_in, filename_out)
fd_out:close()
end
---- Remove directory and its content
+--- Remove directory and its contents
-- @function rmdir
-- @param dir directory to remove
function helpers.rmdir(dir)