mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
improved arg parsing
This commit is contained in:
parent
8acf217365
commit
eea22e84c8
@ -1,9 +1,9 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
<component name="ProjectRunConfigurationManager">
|
||||||
<configuration default="false" name="build-all tmp" type="ShConfigurationType">
|
<configuration default="false" name="build-all" type="ShConfigurationType">
|
||||||
<option name="SCRIPT_TEXT" value="" />
|
<option name="SCRIPT_TEXT" value="" />
|
||||||
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
|
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
|
||||||
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/build-pkg/build-all" />
|
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/build-pkg/build-all" />
|
||||||
<option name="SCRIPT_OPTIONS" value="pkglist.tmp" />
|
<option name="SCRIPT_OPTIONS" value="" />
|
||||||
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
|
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
|
||||||
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/build-pkg" />
|
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/build-pkg" />
|
||||||
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
|
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
|
@ -69,20 +69,40 @@ function space_separated_to_array() {
|
|||||||
readarray -d " " -t ptr2 < <(printf '%s' "$ptr")
|
readarray -d " " -t ptr2 < <(printf '%s' "$ptr")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function usage() {
|
||||||
|
echo "Usage:
|
||||||
|
${0} <PKGLIST-FILE> [-- <makepkgArguments>]
|
||||||
|
${0} -- <makepkgArguments>
|
||||||
|
With PKGLIST-FILE a file containing zero or more package names in each line, separated by space.
|
||||||
|
All packages in a line will be built sequentially and are then synced to the remote repository
|
||||||
|
before continuing with the next line.";
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
||||||
# parse arguments
|
# parse arguments
|
||||||
{
|
{
|
||||||
if [ $# -lt 1 ]; then
|
if [ "${1}" == '-h' ] || [ "${1}" == '--help' ] ; then
|
||||||
echo "Usage: ${0} <PKGLIST-FILE> [<makepkgArguments>]
|
usage
|
||||||
With PKGLIST-FILE a file containing zero or more package names in each line, separated by space.
|
fi
|
||||||
All packages in a line will be built sequentially and are then synced to the remote repository
|
|
||||||
before continuing with the next line.";
|
if [ "${1}" == '--' ]; then
|
||||||
exit 1;
|
shift; # remove first arg
|
||||||
|
else
|
||||||
|
# If $1 not set or null, use 'pkglist.tmp'.
|
||||||
|
PKGLIST="${1:-pkglist.tmp}"
|
||||||
|
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
if [ "${2}" == '--' ]; then
|
||||||
|
shift; # remove first arg
|
||||||
|
shift; # remove second arg
|
||||||
|
else
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKGLIST="${1}"
|
|
||||||
shift; # remove first arg
|
|
||||||
MAKEPKG_ARGS=("$@")
|
MAKEPKG_ARGS=("$@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
../git-pull || exit $?
|
../git-pull || exit $?
|
||||||
./build-all pkglist.tmp || exit $?
|
./build-all || exit $?
|
||||||
echo '' > pkglist.tmp
|
echo '' > pkglist.tmp
|
||||||
|
Loading…
Reference in New Issue
Block a user