From c4ad8f998e96c64874f6f4c3c14daae70601ffad Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Fri, 19 Feb 2016 10:08:41 +0000 Subject: [PATCH] 50appstream: Only run as root 'appstreamcli refresh' only works when you are root. If you are running 'apt update' as a normal user (for example some sandboxed tools do this), then the failure of this Post-Invoke-Success hook causes the update to fail. E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi' E: Sub-process returned an error code --- contrib/apt-conf/50appstream | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/apt-conf/50appstream b/contrib/apt-conf/50appstream index 046a4622..d111ce99 100644 --- a/contrib/apt-conf/50appstream +++ b/contrib/apt-conf/50appstream @@ -44,5 +44,5 @@ Acquire::IndexTargets { # Refresh AppStream cache when APT's cache is updated (i.e. apt-cache update) APT::Update::Post-Invoke-Success { - "if /usr/bin/test -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi"; + "if /usr/bin/test $(id -u) -eq 0 -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi"; };