From bed34e22e8674a9b51ea587551c68ca53b815c94 Mon Sep 17 00:00:00 2001
From: Ruben Rodriguez <ruben@trisquel.info>
Date: Tue, 26 Mar 2019 14:18:03 -0400
Subject: [PATCH] Only chown to _apt when run as root

---
 helpers/config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/helpers/config b/helpers/config
index 6d3ba78d3..acd1ecf2f 100755
--- a/helpers/config
+++ b/helpers/config
@@ -72,7 +72,7 @@ mkdir -p ${LOCAL_APT}/etc/
 mkdir -p ${LOCAL_APT}/var/lib/dpkg
 touch ${LOCAL_APT}/var/lib/dpkg/status
 touch ${LOCAL_APT}/etc/trusted.gpg
-id _apt > /dev/null 2>&1 && chown _apt ${LOCAL_APT}  -R
+[ $UID = 0 ] && id _apt > /dev/null 2>&1 && chown _apt ${LOCAL_APT}  -R
 
 cat << EOF > ${LOCAL_APT}/etc/apt.conf
 Dir::State "${LOCAL_APT}/var/lib/apt";
@@ -115,7 +115,7 @@ EOF
 rm -rf PACKAGES/$PACKAGE
 mkdir PACKAGES/$PACKAGE
 cd PACKAGES/$PACKAGE
-id _apt > /dev/null 2>&1 && chown _apt .
+[ $UID = 0 ] && id _apt > /dev/null 2>&1 && chown _apt .
 
 #Get package and uncompress it
 apt-get update -c $LOCAL_APT/etc/apt.conf
-- 
GitLab