Add scripts

This commit is contained in:
Ribbon 2024-08-15 14:54:36 +00:00 committed by Jeremy Soller
parent 36eb0faa86
commit 584a6e41c0
5 changed files with 92 additions and 0 deletions

10
scripts/cargo-update.sh Normal file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# This script runs "make f.recipe" and "cargo update" in the specified recipe
recipe_name="$1"
recipe_path=$(find cookbook/recipes -name "$recipe_name" -maxdepth 4)
make f."$recipe_name"
cd "$recipe_path"/source
cargo update

62
scripts/executables.sh Normal file
View file

@ -0,0 +1,62 @@
#!/usr/bin/env bash
# This script print all recipe executable names to find duplicates and verify executable name conflicts
usage() {
echo "List executable names to find duplicates"
echo "Usage: $0 [-h] [-a] [-arm64 | -i686] [recipes]"
echo "Default architecture is x86_64, -arm64 is aarch64, -i686 is i686"
echo "Only duplicates are listed unless -a is specified"
echo "-h is this message"
exit
}
cd cookbook
recipes=""
target="x86_64-unknown-redox"
uniq="uniq -D --skip-fields=1"
for arg in "${@:1}"
do
if [ "$arg" == "-arm64" ]
then
target="aarch64-unknown-redox"
elif [ "$arg" == "-i686" ]
then
target="i686-unknown-redox"
elif [ "$arg" == "-a" ]
then
uniq="cat"
elif [ "$arg" == "-h" ]
then
usage
else
recipes+=" $arg"
fi
done
if [ -z "$recipes" ]
then
recipes="$(target/release/list_recipes)"
fi
for recipe in $recipes
do
if [[ "$recipe" == *\/* ]]
then
recipe_name="$(basename $recipe)"
recipe_path="recipes/$recipe"
else
recipe_name="$recipe"
recipe_path="$(target/release/find_recipe $recipe_name)"
fi
for command in $(find "$recipe_path/target/$target/stage/usr/bin" -type f 2> /dev/null) \
$(find "$recipe_path/target/$target/stage/bin" -type f 2> /dev/null)
do
shortname="$(basename $command)"
echo "$recipe_path $shortname"
done
done | sort | $uniq

7
scripts/print-recipe.sh Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# This script print the recipe configuration
cd cookbook
cat $(target/release/find_recipe "$1")/recipe.*

5
scripts/recipe-match.sh Normal file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# This script print the recipe configuration files with determined text
bat --decorations=always $(rg "$1" -li --sort=path cookbook/recipes)

8
scripts/recipe-path.sh Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
FIND_RECIPE="find cookbook/recipes -maxdepth 4 -name"
for recipe in $*
do
${FIND_RECIPE} "${recipe}"
done