dev-util/debugedit: Added some checks to the update script.
authorLars Wendler <polynomial-c@gentoo.org>
Wed, 9 Nov 2016 10:06:46 +0000 (11:06 +0100)
committerLars Wendler <polynomial-c@gentoo.org>
Wed, 9 Nov 2016 10:06:46 +0000 (11:06 +0100)
Package-Manager: portage-2.3.2

dev-util/debugedit/files/update.sh

index db5495d41eb2c118406f594b95f540648c82bdd8..3fed29ad6dc25f512a5f87abf8ca5c613540dbdf 100755 (executable)
@@ -1,9 +1,22 @@
 #!/bin/bash
 
-DISTDIR=/usr/portage/distfiles
+DISTDIR="$(portageq envvar DISTDIR 2>/dev/null)"
+DISTDIR="${DISTDIR:-/usr/portage/distfiles}"
+if [[ ! -d "${DISTDIR}" ]] ; then
+       echo "No DISTDIR found."
+       exit 1
+fi
+
 PN=debugedit
 
-. /etc/init.d/functions.sh
+gentoo_functions="/lib/gentoo/functions.sh"
+if [[ -f "${gentoo_functions}" ]] ; then
+       . "${gentoo_functions}"
+else
+       echo "Failed to source ${gentoo_functions} file."
+       echo "Please install sys-apps/gentoo-functions package."
+       exit 1
+fi
 
 set -e