It is no longer necessary to type the output name of the source bpm file

This commit is contained in:
EnumDev 2024-10-08 09:42:49 +03:00
parent 9ef4699c0d
commit 430a233879

View File

@ -1,9 +1,4 @@
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No output package name given!"
exit 1
fi
if [ -f .compilation-options ]; then
source ./.compilation-options
@ -20,9 +15,19 @@ while getopts "cskfa:" flag; do
esac
done
output="${@:$OPTIND:1}"
if [ -f pkg.info ]; then
echo "pkg.info file found"
else
echo "pkg.info file not found in $PWD"
exit 1
fi
if [[ ! "$output" =~ ^[a-z.A-Z0-9_-]{1,}$ ]]; then
output="${@:$OPTIND:1}"
if [ -z "$output" ]; then
pkgname=$(grep "^name: " pkg.info)
output=$(echo "$pkgname" | cut -d' ' -f2)"-src.bpm"
fi
if [ -z "$output" ] || [[ ! "$output" =~ ^[a-z.A-Z0-9_-]{1,}$ ]]; then
echo "Invalid output name! The name must only contain letters, numbers, hyphens or underscores!"
exit 1
fi
@ -72,13 +77,6 @@ else
fi
fi
if [ -f pkg.info ]; then
echo "pkg.info file found"
else
echo "pkg.info file not found in $PWD"
exit 1
fi
for pkginfo in ./pkg.inf*; do
pkginfo=$(basename "$pkginfo")
echo "${pkginfo} file found"