summaryrefslogtreecommitdiff
path: root/src/apk_database.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-10-07 13:29:34 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-10-07 14:11:29 +0300
commit09e48d8f06bfb924b80ce3e95c281524c4891828 (patch)
treeb3da94f56dc065577baa06e0f3d8cd43d2500bf8 /src/apk_database.h
parente0f9b0897be8e5524eaeef302249c90498d3218a (diff)
downloadapk-tools-09e48d8f06bfb924b80ce3e95c281524c4891828.tar.gz
apk-tools-09e48d8f06bfb924b80ce3e95c281524c4891828.tar.bz2
apk-tools-09e48d8f06bfb924b80ce3e95c281524c4891828.tar.xz
apk-tools-09e48d8f06bfb924b80ce3e95c281524c4891828.zip
db: rework directory permission handling
Apk used to reset directory permissions always, but this is undesirable if user has modified the permissions - especially during tmpfs boot. Though, it is desirable to update the permissions when packaging has changed permissions, or a new package is installed and the merged permission mask / owner changes. Thus the new code updates the permissions only if: 1) We are booting and directory is not in apkovl 2) The directory is modified by a package install/remove/upgrade 3) The filesystem directory permission matched database Additionally "apk fix --directory-permissions" can be used to reset all directory permissions to the database defaults. Fixes #2966
Diffstat (limited to 'src/apk_database.h')
-rw-r--r--src/apk_database.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index 23a2dd6..7d95011 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -47,7 +47,7 @@ enum apk_protect_mode {
struct apk_protected_path {
char *relative_pattern;
- unsigned protect_mode : 4;
+ unsigned protect_mode : 3;
};
APK_ARRAY(apk_protected_path_array, struct apk_protected_path);
@@ -64,10 +64,13 @@ struct apk_db_dir {
unsigned short refs;
unsigned short namelen;
- unsigned protect_mode : 4;
+ unsigned protect_mode : 3;
unsigned has_protected_children : 1;
+
+ unsigned seen : 1;
+ unsigned created : 1;
unsigned modified : 1;
- unsigned recalc_mode : 1;
+ unsigned update_permissions : 1;
char rooted_name[1];
char name[];
@@ -211,6 +214,7 @@ int apk_db_write_config(struct apk_database *db);
int apk_db_permanent(struct apk_database *db);
int apk_db_check_world(struct apk_database *db, struct apk_dependency_array *world);
int apk_db_fire_triggers(struct apk_database *db);
+void apk_db_update_directory_permissions(struct apk_database *db);
struct apk_package *apk_db_pkg_add(struct apk_database *db, struct apk_package *pkg);
struct apk_package *apk_db_get_pkg(struct apk_database *db, struct apk_checksum *csum);