diff --git a/pisi/cli/command.py b/pisi/cli/command.py index eb0ad57e..802d23ed 100644 --- a/pisi/cli/command.py +++ b/pisi/cli/command.py @@ -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'))