[yum-cvs] updateonboot/yum-updateonboot.init yumdownloader.py
Tim Lauridsen
timlau at linux.duke.edu
Wed Oct 17 08:11:40 UTC 2007
updateonboot/yum-updateonboot.init | 13 +++++++++++++
yumdownloader.py | 14 +++++++++++++-
2 files changed, 26 insertions(+), 1 deletion(-)
New commits:
commit ec6b44d2dba11ba7f8a3ee9eee34492207bdfb89
Author: Tim Lauridsen <tim at localhost.localdomain>
Date: Wed Oct 17 10:09:05 2007 +0200
Make yumdownloader work as non-root users even if *-source repos is enabled in *.repo files or by --enablerepo.
diff --git a/updateonboot/yum-updateonboot.init b/updateonboot/yum-updateonboot.init
index 5c1ba2e..3070b99 100755
--- a/updateonboot/yum-updateonboot.init
+++ b/updateonboot/yum-updateonboot.init
@@ -7,6 +7,19 @@
# specified groups
#
+### BEGIN INIT INFO
+# Provides: lsb-yum-updateonboot
+# Required-Start: $local_fs $network $remote_fs
+# Required-Stop: $local_fs $network $remote_fs
+# Should-Start:
+# Should-Stop:
+# Default-Start:
+# Default-Stop:
+# Short-Description: start the yum-updateonboot deamon
+# Description: Runs 'yum update' at boot. Also calls 'yum groupinstall' for \
+# specified groups
+### END INIT INFO
+
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
diff --git a/yumdownloader.py b/yumdownloader.py
index 3c3faf2..cc623a9 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -192,7 +192,7 @@ class YumDownloader(YumUtilBase):
progress.start(basename=os.path.basename(local),
size=os.stat(path).st_size)
shutil.copy2(path, local)
- progress.end(progress.size)
+ progress.end(progress.size)
# sligly modified from the one in YumUtilBase
def doUtilYumSetup(self,opts):
@@ -202,6 +202,11 @@ class YumDownloader(YumUtilBase):
try:
self._getTs()
self._getRpmDB()
+ # if running as non-root and '--source' is specified, then
+ # disable all enabled *-source repos, because we dont want then to be initialized
+ # yet.
+ if self.conf.uid != 0 and opts.source:
+ self._removeEnabledSourceRepos()
self._getRepos()
# if '--source' is used the add src to the archlist
if opts.source:
@@ -213,6 +218,13 @@ class YumDownloader(YumUtilBase):
self.logger.critical(str(msg))
sys.exit(1)
+ def _removeEnabledSourceRepos(self):
+ ''' Disable all enabled *-source repos.'''
+ for repo in self.repos.listEnabled():
+ if repo.id.endswith('-source'):
+ repo.close()
+ self.repos.disableRepo(repo.id)
+ srcrepo = repo.id
def addCmdOptions(self,parser):
parser.add_option("--destdir", default=".", dest="destdir",
More information about the Yum-cvs-commits
mailing list