#!/bin/bash set -f update_secure_path() { local secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin local extra_path=$(unset ROOTPATH; . "${EPREFIX}"/etc/profile.env; echo "${ROOTPATH}") if [[ ${extra_path} != */usr/sbin* ]]; then extra_path=$(unset PATH; . "${EPREFIX}"/etc/profile.env; echo "${PATH}") fi local IFS=: __ set -- ${extra_path} for __; do case $__ in ''|*/gcc-bin/*|*/gnat-gcc-bin/*|*/gnat-gcc/*) ;; *) [[ :${secure_path}: != *:"$__":* ]] && secure_path+=:$__ ;; esac done printf 'Defaults secure_path="%s"\n' "${secure_path}" > /etc/sudoers.d/secure_path } function main { local PATH=${PATH}:/lib/rc/bin einfo "Updating /etc/sudoers.d/secure_path ... " update_secure_path } main