added tagfile and make use of it in modules

This commit is contained in:
2021-12-15 10:55:18 +01:00
parent 925d32c2b6
commit a79d079cac
15 changed files with 81 additions and 31 deletions

View File

@@ -211,6 +211,23 @@ patchfile()
unset rights dstfile
}
# ------------------------------------------------------------------------------
# Put a small header in a file showing it have been automatically modified
tagfile()
{
for f in $@; do
local text="# File automatically modified by init.sh on $(stdtime)."
if [[ -e $f ]]; then
sed -i "1s/^/$text\n/" $f
else
echo $text > $f
sed -i -e "s/modified/generated/" $f
fi
done
}
# ------------------------------------------------------------------------------
# check a file exists and return error if not
file_exists()