When the path provided by a user for the --statedir (or --cachedir)
contains a symlink swupd will fail to extrar tar files since
libarchive does not support extracting files through symlinks.
This commit fixes the issue allowing users to use symlinks in the
--statediri/--cachedir path.
Closes#1581
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit provides the --datadir and --cachedir flags that can be used
to specify different locations for the data and cache. If the same
location is desired for both (default) then users can still use the
existing --statedir flag.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
"Swupd clean" removes cache from certain pre-defined directories. This
commit udpdates the locations where clean looks for cache so it includes
the new locations where the cache is stored.
Swupd will continue looking at old cache locations until the bump to
format 31.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Currently there is only one location, known as "statedir", where swupd
stores data and cache. Normally it make sense to keep the data in a
path that is relative to the path prefix of the target system, since the
data is specific to that system, but cache can be independent of the
system, and that way it can be reused for other target systems if
desired.
This commit splits the cache and data into two different locations.
It also stores the cache in a path that is dependent of the mirror url
being used by swupd. The commit also makes all references to files in
the cache or data directories through getter functions thus removing the
hardcoded reference to the file's location, making it easier to move the
location in the future if needed. Lastly, this commit changes the read
permissions for the data directory and the manifest directories in the
cache to be user readable.
Instead of comparing all rules to all files we can use the fact that the
file list is already sorted to compare only the elements that we need.
So if n is the number of files and m is the number of rules we moved from a
O(n*m) code to O(n+m).
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Instead of saving it in a global string, just use a list of strings to
return the current mounted directories. Also moving function to sys.c
Also fixes hashdump command to correctly print the warning if file is a
mounted directory.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Function is_under_mounted_directory() has a bug in the file comparsion function,
so it's returning always false. As this is broken and this doesn't look to be
needed, removing it.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When swupd downloads manifests to the statedir they are downloaded in
directories that represent the version of clear that the manifests
belong to. However those version directories are stored in the statedir,
root directory. This commit moves them into their own "manifest"
directory so there is more consistency with the downloaded files.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Print a more useful error when we fail to locate a file to apply a
delta. Add a suggestion for the user to run `swupd repair` and make
it clear that the problem is in their system and not in the update
content.
Fixes#1425
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When swupd downloads manifests to the statedir they are downloaded in
directories that represent the version of clear that the manifests
belong to. However those version directories are stored in the statedir,
root directory. This commit moves them into their own "manifest"
directory so there is more consistency with the downloaded files.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some of these references to statedir where left in the code, this commit
moves them to the statedir.c module so references to content of the
statedir are not hardcoded. Files in the statedir can move to different
locations freely this way.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Don't run heuristics for os-install or repair --quick.
On os-install we want all files to be always installed. On repair --quick
we don't process any do_not_update files
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Actually thread_pool supports zero threads, that means exactly running in
serial. So rolling back to what it was before the integer conversion fix of
commit 2a7f181e00.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Instead of having a function to remove the contents of a specific
directory in the statedir this commit creates a generic function to
remove the contents of a directory without removing the directory
itself.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
check-update was trying to create a motd in a deprecated directory and
it was always failing.
Removing code for now.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit adds these function:
- statedir_get_delta_dir: to get the "download" directory
- tatedir_get_fullfile_tar: to get thet downloaded fullfile tar
- statedir_get_fullfile_renamed_tar: to get the renamed fullfile during
untarring
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds the following functions:
- statedir_get_staged_dir()
- statedir_get_staged_file()
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Currently we have two functions to track bundles, bundles should always
be tracked in the same location, if there is an exception to this rule
then it should be handled separately.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>