Add verbose var to Makefile

This commit is contained in:
flyingscorpio@arch-desktop 2021-03-12 12:23:00 +01:00
parent 2f7f150fc4
commit 03c19b675c
5 changed files with 29 additions and 11 deletions

View file

@ -1,3 +1,5 @@
VERBOSE=false
export VERBOSE
unpushed=$(shell git log --pretty=format:'%h' @{u}.. | wc -c)
all: lime2test cours procedures cv index

View file

@ -4,7 +4,9 @@
[ "$HOSTNAME" != lime2 ] || exit 1
echo "Updating index.html"
if [ "$VERBOSE" = true ]; then
echo "Updating index.html"
fi
chmod 644 ./index.html

View file

@ -4,13 +4,17 @@
[ "$HOSTNAME" != lime2 ] || exit 1
echo -n "Pulling cours... "
if [ "$VERBOSE" = true ]; then
echo -n "Pulling cours... "
fi
origin_file_time=$(stat -c %Y ~/tssr/cours/cours*.pdf)
current_file_time=$(stat -c %Y ./cours.pdf)
if [ "$origin_file_time" -gt "$current_file_time" ]; then
cp ~/tssr/cours/cours*.pdf ./cours.pdf && echo "Done"
cp ~/tssr/cours/cours*.pdf ./cours.pdf && echo "Updated cours"
else
if [ "$VERBOSE" = true ]; then
echo "Already up to date"
fi
fi

View file

@ -4,10 +4,14 @@
[ "$HOSTNAME" != lime2 ] || exit 1
echo -n "Pulling CV... "
if [ "$VERBOSE" = true ]; then
echo -n "Pulling CV... "
fi
cp ~/src/html-cv/out.html ./cv/index.html
cp ~/src/html-cv/data/cv-photo ./cv/data/cv-photo
cp -r ~/src/html-cv/css ./cv
echo "Done"
if [ "$VERBOSE" = true ]; then
echo "Done"
fi

View file

@ -12,18 +12,24 @@ for folder in ~/tssr/procedures/*; do
name=$(basename "$folder")
display_name=$(echo "$name" | sed -E 's/procedure_//g; s/_202.+//g; s/-/ /g; s/_/ /g')
if [[ "$name" = *chose* ]]; then # ignore procedure_chose
if [ "$VERBOSE" = true ]; then
echo "Ignoring ${name}"
fi
else
if [ "$VERBOSE" = true ]; then
echo -n "Pulling ${name}..."
fi
if [[ ! "$name" = *tablette* ]]; then
origin_file_time=$(stat -c %Y "$folder"/procedure*.pdf)
current_file_time=$(stat -c %Y ./procedures/procedure_"$name".pdf)
fi
if [ -z "$current_file_time" ] || [ "$origin_file_time" -gt "$current_file_time" ]; then
cp "$folder"/procedure*.pdf ./procedures/procedure_"$name".pdf
cp "$folder"/procedure*.pdf ./procedures/procedure_"$name".pdf && echo "Updated $name"
else
if [ "$VERBOSE" = true ]; then
echo "Already up to date"
fi
fi
sed -i "s@===PROCEDURE===@<li><p><a href='./procedure_${name}.pdf'>${display_name}</a></p></li>\n===PROCEDURE===@g" ./procedures/index.tmp.html
fi
fi
@ -31,6 +37,6 @@ done
chmod 644 ./procedures/index.html
sed 's/===PROCEDURE===//g' ./procedures/index.tmp.html > ./procedures/index.html && rm ./procedures/index.tmp.html && echo "Done"
sed 's/===PROCEDURE===//g' ./procedures/index.tmp.html > ./procedures/index.html && rm ./procedures/index.tmp.html
chmod 444 ./procedures/index.html