|
|
65829f |
commit 507182919894e9bf75b08a75cb22c49d852c8278
|
|
|
65829f |
Author: James Antill <james@and.org>
|
|
|
65829f |
Date: Wed May 21 15:14:55 2014 -0400
|
|
|
65829f |
|
|
|
65829f |
Check /usr for writability before running a transaction.
|
|
|
65829f |
|
|
|
65829f |
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
|
|
|
65829f |
index 4ec7689..c39544d 100644
|
|
|
65829f |
--- a/docs/yum.conf.5
|
|
|
65829f |
+++ b/docs/yum.conf.5
|
|
|
65829f |
@@ -892,6 +892,11 @@ shouldn't be needed as yum should always solve or fail, however it has been
|
|
|
65829f |
observed that it can loop forever with very large system upgrades. Setting
|
|
|
65829f |
this to `0' (or "<forever>") makes yum try forever. Default is `100'.
|
|
|
65829f |
|
|
|
65829f |
+.IP
|
|
|
65829f |
+\fBusr_w_check\fR
|
|
|
65829f |
+Either `0' or `1'. Set this to `0' to disable the checking for writability on
|
|
|
65829f |
+/usr in the installroot (when going into the depsolving stage). Default is `1'
|
|
|
65829f |
+(perform the check).
|
|
|
65829f |
|
|
|
65829f |
.SH "[repository] OPTIONS"
|
|
|
65829f |
.LP
|
|
|
65829f |
diff --git a/yum/config.py b/yum/config.py
|
|
|
65829f |
index 7bb56d0..f0f4e96 100644
|
|
|
65829f |
--- a/yum/config.py
|
|
|
65829f |
+++ b/yum/config.py
|
|
|
65829f |
@@ -906,6 +906,8 @@ class YumConf(StartupConf):
|
|
|
65829f |
|
|
|
65829f |
check_config_file_age = BoolOption(True)
|
|
|
65829f |
|
|
|
65829f |
+ usr_w_check = BoolOption(True)
|
|
|
65829f |
+
|
|
|
65829f |
_reposlist = []
|
|
|
65829f |
|
|
|
65829f |
def dump(self):
|
|
|
65829f |
diff --git a/yummain.py b/yummain.py
|
|
|
65829f |
index fa76af8..ee8d632 100755
|
|
|
65829f |
--- a/yummain.py
|
|
|
65829f |
+++ b/yummain.py
|
|
|
65829f |
@@ -209,6 +209,17 @@ def main(args):
|
|
|
65829f |
logger.critical(msg)
|
|
|
65829f |
if unlock(): return 200
|
|
|
65829f |
return 3
|
|
|
65829f |
+
|
|
|
65829f |
+ # Mainly for ostree, but might be useful for others.
|
|
|
65829f |
+ if base.conf.usr_w_check:
|
|
|
65829f |
+ usrinstpath = base.conf.installroot + "/usr"
|
|
|
65829f |
+ usrinstpath = usrinstpath.replace('//', '/')
|
|
|
65829f |
+ if not os.access(usrinstpath, os.W_OK):
|
|
|
65829f |
+ logger.critical(_('No write access to %s directory') % usrinstpath)
|
|
|
65829f |
+ logger.critical(_(' Maybe this is an ostree image?'))
|
|
|
65829f |
+ logger.critical(_(' To disable you can use --setopt=usr_w_check=false'))
|
|
|
65829f |
+ if unlock(): return 200
|
|
|
65829f |
+ return 1
|
|
|
65829f |
|
|
|
65829f |
# Depsolve stage
|
|
|
65829f |
verbose_logger.log(logginglevels.INFO_2, _('Resolving Dependencies'))
|
|
|
65829f |
commit 6e64b142014dc3c5489aed7966f0948948054fb7
|
|
|
65829f |
Author: James Antill <james@and.org>
|
|
|
65829f |
Date: Wed May 21 18:29:28 2014 -0400
|
|
|
65829f |
|
|
|
65829f |
Check for existance, so mock etc. is happy.
|
|
|
65829f |
|
|
|
65829f |
diff --git a/yummain.py b/yummain.py
|
|
|
65829f |
index ee8d632..24bbe6c 100755
|
|
|
65829f |
--- a/yummain.py
|
|
|
65829f |
+++ b/yummain.py
|
|
|
65829f |
@@ -214,7 +214,8 @@ def main(args):
|
|
|
65829f |
if base.conf.usr_w_check:
|
|
|
65829f |
usrinstpath = base.conf.installroot + "/usr"
|
|
|
65829f |
usrinstpath = usrinstpath.replace('//', '/')
|
|
|
65829f |
- if not os.access(usrinstpath, os.W_OK):
|
|
|
65829f |
+ if (os.path.exists(usrinstpath) and
|
|
|
65829f |
+ not os.access(usrinstpath, os.W_OK)):
|
|
|
65829f |
logger.critical(_('No write access to %s directory') % usrinstpath)
|
|
|
65829f |
logger.critical(_(' Maybe this is an ostree image?'))
|
|
|
65829f |
logger.critical(_(' To disable you can use --setopt=usr_w_check=false'))
|