Merge branch 'script-for-current-commit-hash' into 'master'

Add commit-hash.sh for recipe troubleshooting

Closes #1626

See merge request redox-os/redox!1776
This commit is contained in:
Jeremy Soller 2026-01-26 12:05:36 -07:00
commit 4b1868a2f5

View File

@ -1,15 +1,27 @@
#!/usr/bin/env bash
# This script show the current Git branch and commit of the recipe source
# This script shows the current Git commit hash of system recipes at recipes/core
if [ $# -ne 1 ]
set -e
# Check if recipes/core directory exists
if [ ! -d "recipes/core" ]
then
echo "Usage: $0 recipe_name"
echo " Print the commit hash for recipe_name"
echo "Error: recipes/core directory not found"
exit 1
fi
recipe_path="$(target/release/find_recipe $1)"
cd "$recipe_path"/source
git branch -v
# Iterate through all system recipes in recipes/core
for recipe_dir in recipes/core/*/
do
recipe_name=$(basename "$recipe_dir")
source_dir="$recipe_dir/source"
# Check if source directory exists and is a git repository
if [ -d "$source_dir" ] && [ -d "$source_dir/.git" ]
then
# Get the commit hash
commit_hash=$(cd "$source_dir" && git rev-parse HEAD)
echo "$recipe_name: $commit_hash"
fi
done