app-eselect/eselect-opengl: Replace path_exists
authorMichał Górny <mgorny@gentoo.org>
Thu, 9 Aug 2018 14:49:40 +0000 (16:49 +0200)
committerMichał Górny <mgorny@gentoo.org>
Wed, 15 Aug 2018 07:30:58 +0000 (09:30 +0200)
Replace path_exists call with nullglob-based filename expansion.

app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild

index 1206be17c265cffa86693352b0980eadf992b73a..d3f04c9469cbe8c630236be25cfec4094e5011f3 100644 (file)
@@ -49,11 +49,15 @@ pkg_preinst() {
 }
 
 pkg_postinst() {
-       if path_exists "${EROOT}"/usr/lib*/opengl; then
+       local shopt_save=$(shopt -p nullglob)
+       shopt -s nullglob
+       local opengl_dirs=( "${EROOT}"/usr/lib*/opengl )
+       ${shopt_save}
+       if [[ -n ${opengl_dirs[@]} ]]; then
                # delete broken symlinks
-               find "${EROOT}"/usr/lib*/opengl -xtype l -delete
+               find "${opengl_dirs[@]}" -xtype l -delete
                # delete empty leftover directories (they confuse eselect)
-               find "${EROOT}"/usr/lib*/opengl -depth -type d -empty -exec rmdir -v {} +
+               find "${opengl_dirs[@]}" -depth -type d -empty -exec rmdir -v {} +
        fi
 
        if [[ -n "${OLD_IMPL}" && "${OLD_IMPL}" != '(none)' ]] ; then