Blame SOURCES/BZ-1097383-usr-readonly.patch

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