summaryrefslogtreecommitdiffstats
path: root/urpm.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-01-15 16:57:15 +0000
committerOlivier Blin <oblin@mandriva.org>2004-01-15 16:57:15 +0000
commit40d1bb84fef9ec229bcb117eece7a93886cada86 (patch)
tree1265f9d60a96f2d23e59aadd143ea5a70cd7153d /urpm.pm
parentcf919b18788df5ed01b43018941c262a51596dfe (diff)
downloadurpmi-40d1bb84fef9ec229bcb117eece7a93886cada86.tar
urpmi-40d1bb84fef9ec229bcb117eece7a93886cada86.tar.gz
urpmi-40d1bb84fef9ec229bcb117eece7a93886cada86.tar.bz2
urpmi-40d1bb84fef9ec229bcb117eece7a93886cada86.tar.xz
urpmi-40d1bb84fef9ec229bcb117eece7a93886cada86.zip
- urpmi, urpme, urpmq: / can be used as root, it's not a particular case
- urpm.pm: lock rpm db in chroot, and urpmi db in / - urpmi: ask to be root to install binary rpms in chroot
Diffstat (limited to 'urpm.pm')
-rw-r--r--urpm.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/urpm.pm b/urpm.pm
index decfd7d4..6cbea321 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -2690,6 +2690,10 @@ sub download_source_packages {
%sources, %error_sources;
}
+#- lock policy concerning chroot :
+# - lock rpm db in chroot
+# - lock urpmi db in /
+
#- safety rpm db locking mechanism
sub exlock_rpm_db {
my ($urpm) = @_;
@@ -2698,7 +2702,7 @@ sub exlock_rpm_db {
my ($LOCK_EX, $LOCK_NB) = (2, 4);
#- lock urpmi database, but keep lock to wait for an urpmi.update to finish.
- open RPMLOCK_FILE, ">$urpm->{statedir}/.RPMLOCK";
+ open RPMLOCK_FILE, ">$urpm->{root}/$urpm->{statedir}/.RPMLOCK";
flock RPMLOCK_FILE, $LOCK_EX|$LOCK_NB or $urpm->{fatal}(7, N("urpmi database locked"));
}
sub shlock_rpm_db {
@@ -2708,12 +2712,12 @@ sub shlock_rpm_db {
my ($LOCK_SH, $LOCK_NB) = (1, 4);
#- create the .LOCK file if needed (and if possible)
- unless (-e "$urpm->{statedir}/.RPMLOCK") {
- open RPMLOCK_FILE, ">$urpm->{statedir}/.RPMLOCK";
+ unless (-e "$urpm->{root}/$urpm->{statedir}/.RPMLOCK") {
+ open RPMLOCK_FILE, ">$urpm->{root}/$urpm->{statedir}/.RPMLOCK";
close RPMLOCK_FILE;
}
#- lock urpmi database, if the LOCK file doesn't exists no share lock.
- open RPMLOCK_FILE, "$urpm->{statedir}/.RPMLOCK" or return;
+ open RPMLOCK_FILE, "$urpm->{root}/$urpm->{statedir}/.RPMLOCK" or return;
flock RPMLOCK_FILE, $LOCK_SH|$LOCK_NB or $urpm->{fatal}(7, N("urpmi database locked"));
}
sub unlock_rpm_db {