Index: pkgadd.h =================================================================== --- pkgadd.h (revision 9) +++ pkgadd.h (working copy) @@ -42,6 +42,7 @@ vector config_rules; bool o_upgrade; bool o_force; + bool o_ignore_perms; template filenames_t make_keep_list(const in_t& files, @@ -60,7 +61,8 @@ }; public: - pkgadd() : pkgutil("pkgadd"), o_upgrade(false) {} + pkgadd() : pkgutil("pkgadd"), o_upgrade(false), o_force(false), + o_ignore_perms(false) {} void resolve_conflicts(); virtual void run(int argc, char** argv); virtual void print_help() const; Index: pkgutil.cc =================================================================== --- pkgutil.cc (revision 9) +++ pkgutil.cc (working copy) @@ -257,7 +257,7 @@ } } -fileconflicts_t pkgutil::db_find_conflicts(const string& name, const pkginfo_t& pkginfo) +fileconflicts_t pkgutil::db_find_conflicts(const string& name, const pkginfo_t& pkginfo, const bool ignore_perms) { fileconflicts_t fileconflicts; filenames_t filenames; @@ -321,7 +321,7 @@ i++; filename = root + (*j).first.first; if (S_ISDIR((*j).first.second.mode)) { - if (permissions_equal(filename, j->first)) { + if (ignore_perms || permissions_equal(filename, j->first)) { fileconflicts.erase(j); } else j->second = CONFLICT_MODE; @@ -346,7 +346,7 @@ ); // If new file have changed permissions - it's conflict, // thus do not exclude it - if (tmp != fileconflicts.end() && permissions_equal(root + i->first, tmp->first)) + if (tmp != fileconflicts.end() && (ignore_perms || permissions_equal(root + i->first, tmp->first))) fileconflicts.erase(tmp->first); } Index: pkgutil.h =================================================================== --- pkgutil.h (revision 9) +++ pkgutil.h (working copy) @@ -125,7 +125,8 @@ void db_rm_pkg(const string& name); void db_rm_pkg(const string& name, const filenames_t& keep_list); void db_rm_fileconflicts(fileconflicts_t files, const filenames_t& keep_list); - fileconflicts_t db_find_conflicts(const string& name, const pkginfo_t& info); + fileconflicts_t db_find_conflicts(const string& name, const pkginfo_t& info, + const bool ignore_perms); // Tar.gz package_t pkg_open(const string& filename) const; Index: pkgadd.cc =================================================================== --- pkgadd.cc (revision 9) +++ pkgadd.cc (working copy) @@ -76,7 +76,8 @@ void pkgadd::resolve_conflicts() { fileconflicts_t fileconflicts = db_find_conflicts(package.first, - package.second); + package.second, + o_ignore_perms); if (!fileconflicts.empty()) { if (o_force) { @@ -125,6 +126,8 @@ o_upgrade = true; } else if (option == "-f" || option == "--force") { o_force = true; + } else if (option == "-i" || option == "--ignore-perms") { + o_ignore_perms = true; } else if (option[0] == '-' || !o_package.empty()) { throw runtime_error("invalid option " + option); } else { @@ -184,6 +187,7 @@ << "options:" << endl << " -u, --upgrade upgrade package with the same name" << endl << " -f, --force force install, overwrite conflicting files" << endl + << " -i, --ignore-perms ignore mode/ownership conflicts" << endl << " -r, --root specify alternative installation root" << endl << " -v, --version print version and exit" << endl << " -h, --help print help and exit" << endl;