Ignore git directory, move fetch logic into seperate file

This commit is contained in:
Jeremy Soller 2017-05-11 20:53:21 -06:00
parent ca8ba79ac2
commit 362af48613
2 changed files with 17 additions and 7 deletions

16
fetch.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash -e
source config.sh
if [ $# = 0 ]
then
recipes="$(ls -1 recipes)"
else
recipes="$@"
fi
for recipe in $recipes
do
echo -e "\033[01;38;5;215mfetch - fetching $recipe\033[0m" >&2
./cook.sh "$recipe" fetch
done

View File

@ -11,18 +11,12 @@ fi
for recipe in $recipes
do
if [ ! -d "recipes/$recipe/source" ]
then
echo -e "\033[01;38;5;215mrepo - fetching and updating $recipe\033[0m" >&2
./cook.sh "$recipe" fetch
fi
if [ ! -f "recipes/$recipe/stage.tar" ]
then
echo -e "\033[01;38;5;215mrepo - building $recipe\033[0m" >&2
./cook.sh $recipe update build stage tar
else
TIME_SOURCE="$(find recipes/$recipe/source -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_SOURCE="$(find recipes/$recipe/source -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_STAGE="$(stat -c "%Y" recipes/$recipe/stage.tar)"
if [ "$TIME_SOURCE" -ge "$TIME_STAGE" ]
then