u-boot-libre: fix help when run with './build release u-boot-libre'

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-08-03 02:05:05 +02:00
parent 981d9de953
commit dcdefe3a7e
Signed by: GNUtoo
GPG Key ID: 5F5DFCC14177E263
1 changed files with 22 additions and 1 deletions

View File

@ -20,7 +20,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
[ "x${DEBUG+set}" = 'xset' ] && set -v [ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e set -u -e
@ -39,9 +38,31 @@ uboot_release_topdir="${topdir}/release/u-boot-libre"
release_files="" release_files=""
# This detects if this script is called by the ./build script like
# that: ./build release u-boot-libre [arguments]
runs_from_build()
{
i=0
for arg in $(strings /proc/$PPID/cmdline) ; do
if [ $i -eq 1 ] && [ "${arg}" != "./build" ] ; then
return 1
elif [ $i -eq 2 ] && [ "${arg}" != "release" ] ; then
return 1
elif [ $i -eq 3 ] && [ "${arg}" != "u-boot-libre" ] ; then
return 1
fi
i=$(expr $i + 1)
done
return 0
}
usage() usage()
{ {
progname="resources/scripts/build/release/u-boot-libre" progname="resources/scripts/build/release/u-boot-libre"
if runs_from_build ; then
progname="./build release u-boot-libre"
fi
printf "Usage:\n" printf "Usage:\n"
printf "\t%s # %s\n" \ printf "\t%s # %s\n" \