From 06762977d2ba17cf5e0805968d84a4cbc4500d28 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Tue, 25 Mar 2008 08:47:30 +0000 Subject: [PATCH] You have to be root for this operation --- pisi/cli/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'))