--- pkgadd.cc 2006-07-15 01:53:43.000000000 +0400 +++ pkgadd.cc 2006-07-15 01:52:46.000000000 +0400 @@ -85,6 +85,7 @@ string o_package; bool o_upgrade = false; bool o_force = false; + bool o_ignore_perms = false; for (int i = 1; i < argc; i++) { string option(argv[i]); @@ -96,6 +97,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 { @@ -128,7 +131,7 @@ else if (!installed && o_upgrade) throw runtime_error("package " + package.first + " not previously installed (skip -u to install)"); - fileconflicts_t fileconflicts = db_find_conflicts(package.first, package.second); + fileconflicts_t fileconflicts = db_find_conflicts(package.first, package.second, o_ignore_perms); if (!fileconflicts.empty()) { if (o_force) { @@ -178,6 +181,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; 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;