Make PORTAGE_INST_UID and PORTAGE_INST_GID default to 0 in case of environment problems.
authorZac Medico <zmedico@gentoo.org>
Sat, 18 Mar 2006 20:29:55 +0000 (20:29 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 18 Mar 2006 20:29:55 +0000 (20:29 -0000)
svn path=/main/trunk/; revision=2942

bin/dobin
bin/dosbin
bin/emerge-webrsync
bin/misc-functions.sh

index ba22f81e249ab24ca5d4cd411aa7b9a5d624103f..a3269edee28a739f182f14bb67e3252afa8c3587 100755 (executable)
--- a/bin/dobin
+++ b/bin/dobin
@@ -16,7 +16,7 @@ ret=0
 
 for x in "$@" ; do
        if [[ -e ${x} ]] ; then
-               install -m0755 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} "${x}" "${D}${DESTTREE}/bin"
+               install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/bin"
        else
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
index 9cae684a8d6da0e98d4a35a04463d18e0285b23e..30aa7893c9d06f0850f24ae74f4b24a452b2a119 100755 (executable)
@@ -16,7 +16,7 @@ ret=0
 
 for x in "$@" ; do
        if [[ -e ${x} ]] ; then
-               install -m0755 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} "${x}" "${D}${DESTTREE}/sbin"
+               install -m0755 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} "${x}" "${D}${DESTTREE}/sbin"
        else
                echo "!!! ${0##*/}: ${x} does not exist" 1>&2
                false
index f92c9262cc3c0208cac3a12682bcdc344fa79fdd..2bce994a909244eb3ca2335871fa768e7402ee9f 100755 (executable)
@@ -51,7 +51,7 @@ fi
 sync_local() {
        echo Syncing local tree...
        if type -p tarsync &> /dev/null; then
-               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${PORTAGE_INST_UID} -g ${PORTAGE_INST_GID} -e /distfiles -e /packages -e /local; then
+               if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o ${PORTAGE_INST_UID:-0} -g ${PORTAGE_INST_GID:-0} -e /distfiles -e /packages -e /local; then
                        echo "tarsync failed; tarball is corrupt?"
                        exit 1;
                fi
@@ -64,7 +64,7 @@ sync_local() {
                fi
                rm -f $FILE
                # Make sure user and group file ownership is ${PORTAGE_INST_UID}:${PORTAGE_INST_GID}
-               chown -R ${PORTAGE_INST_UID}:${PORTAGE_INST_GID} portage
+               chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} portage
                cd portage
                rsync -av --progress --stats --delete --delete-after \
                --exclude='/distfiles' --exclude='/packages' \
index dff882232065937e23167550de0754e0ed9cb34e..e5751e136a24b2576a27d819a7e3ebc8fd15c7b7 100644 (file)
@@ -220,14 +220,14 @@ install_qa_check() {
        find "${D}/" -user  portage | while read file; do
                count=$(( $count + 1 ))
                if [ -L "${file}" ]; then
-                       lchown ${PORTAGE_INST_UID} "${file}"
+                       lchown ${PORTAGE_INST_UID:-0} "${file}"
                else
                        s=$(stat_perms "$file")
                        if [ -z "${s}" ]; then
                                ewarn "failed stat_perm'ing $file.  User intervention during install isn't wise..."
                                continue
                        fi
-                       chown ${PORTAGE_INST_UID} "$file"
+                       chown ${PORTAGE_INST_UID:-0} "$file"
                        chmod "$s" "$file"
                fi
        done
@@ -239,14 +239,14 @@ install_qa_check() {
        find "${D}/" -group portage | while read file; do
                count=$(( $count + 1 ))
                if [ -L "${file}" ]; then
-                       lchgrp ${PORTAGE_INST_GID} "${file}"
+                       lchgrp ${PORTAGE_INST_GID:-0} "${file}"
                else
                        s=$(stat_perms "$file")
                        if [ -z "${s}" ]; then
                                echo "failed stat_perm'ing '$file' . User intervention during install isn't wise..."
                                continue
                        fi
-                       chgrp ${PORTAGE_INST_GID} "$file"
+                       chgrp ${PORTAGE_INST_GID:-0} "$file"
                        chmod "$s" "$file"
                fi
        done