mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-09-07 22:21:32 +00:00
Add check_mix_exists() function
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
This commit is contained in:
committed by
Matthew Johnson
parent
e18eb6917f
commit
ebf0373f00
@@ -173,6 +173,40 @@ void print_time_stats(timelist *head)
|
||||
}
|
||||
}
|
||||
|
||||
/* If the MIX_BUNDLES_DIR has any content then we can run through
|
||||
* adding the mix data to the OS */
|
||||
bool check_mix_exists(void)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
char *fullpath;
|
||||
int i;
|
||||
|
||||
string_or_die(&fullpath, "%s%s", path_prefix, MIX_DIR);
|
||||
|
||||
dir = opendir(fullpath);
|
||||
if (dir == NULL) {
|
||||
free(fullpath);
|
||||
return false;
|
||||
}
|
||||
for(i = 0; i < 3; i++) {
|
||||
entry = readdir(dir);
|
||||
if (!entry) {
|
||||
break;
|
||||
}
|
||||
if (!strcmp(entry->d_name, ".") ||
|
||||
!strcmp(entry->d_name, "..")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* If more than /. & /.. exists, then at least one bundle exists */
|
||||
if (i > 2) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int get_value_from_path(char **contents, const char *path, bool is_abs_path)
|
||||
{
|
||||
char line[LINE_MAX];
|
||||
|
||||
Reference in New Issue
Block a user