Add verbose var to Makefile
This commit is contained in:
parent
2f7f150fc4
commit
03c19b675c
5 changed files with 29 additions and 11 deletions
2
Makefile
2
Makefile
|
@ -1,3 +1,5 @@
|
||||||
|
VERBOSE=false
|
||||||
|
export VERBOSE
|
||||||
unpushed=$(shell git log --pretty=format:'%h' @{u}.. | wc -c)
|
unpushed=$(shell git log --pretty=format:'%h' @{u}.. | wc -c)
|
||||||
|
|
||||||
all: lime2test cours procedures cv index
|
all: lime2test cours procedures cv index
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
[ "$HOSTNAME" != lime2 ] || exit 1
|
[ "$HOSTNAME" != lime2 ] || exit 1
|
||||||
|
|
||||||
echo "Updating index.html"
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo "Updating index.html"
|
||||||
|
fi
|
||||||
|
|
||||||
chmod 644 ./index.html
|
chmod 644 ./index.html
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,17 @@
|
||||||
|
|
||||||
[ "$HOSTNAME" != lime2 ] || exit 1
|
[ "$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)
|
origin_file_time=$(stat -c %Y ~/tssr/cours/cours*.pdf)
|
||||||
current_file_time=$(stat -c %Y ./cours.pdf)
|
current_file_time=$(stat -c %Y ./cours.pdf)
|
||||||
|
|
||||||
if [ "$origin_file_time" -gt "$current_file_time" ]; then
|
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
|
else
|
||||||
echo "Already up to date"
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo "Already up to date"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -4,10 +4,14 @@
|
||||||
|
|
||||||
[ "$HOSTNAME" != lime2 ] || exit 1
|
[ "$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/out.html ./cv/index.html
|
||||||
cp ~/src/html-cv/data/cv-photo ./cv/data/cv-photo
|
cp ~/src/html-cv/data/cv-photo ./cv/data/cv-photo
|
||||||
cp -r ~/src/html-cv/css ./cv
|
cp -r ~/src/html-cv/css ./cv
|
||||||
|
|
||||||
echo "Done"
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo "Done"
|
||||||
|
fi
|
||||||
|
|
|
@ -12,17 +12,23 @@ for folder in ~/tssr/procedures/*; do
|
||||||
name=$(basename "$folder")
|
name=$(basename "$folder")
|
||||||
display_name=$(echo "$name" | sed -E 's/procedure_//g; s/_202.+//g; s/-/ /g; s/_/ /g')
|
display_name=$(echo "$name" | sed -E 's/procedure_//g; s/_202.+//g; s/-/ /g; s/_/ /g')
|
||||||
if [[ "$name" = *chose* ]]; then # ignore procedure_chose
|
if [[ "$name" = *chose* ]]; then # ignore procedure_chose
|
||||||
echo "Ignoring ${name}"
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo "Ignoring ${name}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo -n "Pulling ${name}..."
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo -n "Pulling ${name}..."
|
||||||
|
fi
|
||||||
if [[ ! "$name" = *tablette* ]]; then
|
if [[ ! "$name" = *tablette* ]]; then
|
||||||
origin_file_time=$(stat -c %Y "$folder"/procedure*.pdf)
|
origin_file_time=$(stat -c %Y "$folder"/procedure*.pdf)
|
||||||
current_file_time=$(stat -c %Y ./procedures/procedure_"$name".pdf)
|
current_file_time=$(stat -c %Y ./procedures/procedure_"$name".pdf)
|
||||||
fi
|
fi
|
||||||
if [ -z "$current_file_time" ] || [ "$origin_file_time" -gt "$current_file_time" ]; then
|
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
|
else
|
||||||
echo "Already up to date"
|
if [ "$VERBOSE" = true ]; then
|
||||||
|
echo "Already up to date"
|
||||||
|
fi
|
||||||
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
|
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
|
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
|
chmod 444 ./procedures/index.html
|
||||||
|
|
Loading…
Reference in a new issue