You have to be root for this operation

This commit is contained in:
Faik Uygur
2008-03-25 08:47:30 +00:00
parent 00234a8a61
commit 06762977d2
+5 -1
View File
@@ -10,6 +10,7 @@
# Please read the COPYING file. # Please read the COPYING file.
# #
import os
import sys import sys
import optparse import optparse
@@ -67,7 +68,7 @@ class Command(object):
return Command.cmd_dict[cmd](args) return Command.cmd_dict[cmd](args)
if fail: if fail:
raise Error(_("Unrecognized command: %s") % cmd) raise pisi.cli.Error(_("Unrecognized command: %s") % cmd)
else: else:
return None return None
@@ -162,6 +163,9 @@ class Command(object):
else: else:
ui = pisi.cli.CLI() ui = pisi.cli.CLI()
if write and not os.access(pisi.context.config.packages_dir(), os.W_OK):
raise pisi.cli.Error(_("You have to be root for this operation."))
pisi.api.set_userinterface(ui) pisi.api.set_userinterface(ui)
pisi.api.set_options(self.options) pisi.api.set_options(self.options)
pisi.api.set_comar(self.comar and not ctx.get_option('ignore_comar')) pisi.api.set_comar(self.comar and not ctx.get_option('ignore_comar'))