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.
#
import os
import sys
import optparse
@@ -67,7 +68,7 @@ class Command(object):
return Command.cmd_dict[cmd](args)
if fail:
raise Error(_("Unrecognized command: %s") % cmd)
raise pisi.cli.Error(_("Unrecognized command: %s") % cmd)
else:
return None
@@ -162,6 +163,9 @@ class Command(object):
else:
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_options(self.options)
pisi.api.set_comar(self.comar and not ctx.get_option('ignore_comar'))