fix for list missing files, added option for cutsomdir #3

* custom base data directory for test and filesize
* list all missing files, not last only
This commit is contained in:
vv01f 2019-09-17 23:09:59 +02:00
parent 11b3d79727
commit 3185474366
Signed by untrusted user who does not match committer: vv01f
GPG Key ID: 02625A16AC1D1FF6
1 changed files with 33 additions and 4 deletions

37
gen.sh
View File

@ -56,16 +56,45 @@ newdataentry () {
dependencies="cat grep head cut date printf"
assert_tools ${dependencies}
err=0
customdir=$(pwd)
fl=""
test $# -eq 0 && {
>&2 echo "determining entry based on data.xml.\n"
lastentry=$(cat data.xml |grep -i "<schleuder id="|head -1|cut -d'"' -f2)
newentry=$(( $lastentry + 1 ))
} || {
# todo: switches
#~ for o in "$@"; do
#~ on=$(echo $o|cut -d"=" -f1)
#~ ov=$(echo $o|cut -d"=" -f2-)
#~ case $on in
# custom data directory for availability test and filesize, default pwd
#~ c)
#~ customdir) ;;
# custom issue, default next after top entry in data.xml
#~ i)
#~ issue) ;;
# custom timestamp, default: current time
#~ d)
#~ datetime) ;;
# custom teaser xml-text, default: none
#~ t)
#~ teaser) ;;
# help text
#~ h)
#~ help)
#~ *) ;;
#~ esac
#~ done
test -d $1 && {
customdir=$1; shift
>&2 echo "custom base directory for files such as jpg, pdf, epub: "${customdir}".\n"
}
test "$1" = "help" && {
echo "prints a new data entry for a release of datenschleuder\n"
echo "release [options]\n"
echo "option\tdescription\n"
echo "directory\tcustom data directory for availability test and filesize, default pwd"
echo "number\tprint entry for release with custom number, default is the increment of the top entry in data.xml\n"
echo "date\tuse a unix timestamp for a custom date\n"
echo "teaser\tinclude teaser xml-message as last argument(s)\n"
@ -98,15 +127,15 @@ newdataentry () {
#~ *) echo "file "${ffn}" not found, in "${d}"." ;;
esac
#~ echo $ffn
test -e ${ffn} && {
test -e ${customdir}"/"${ffn} && {
test "$d" = "covers" && {
echo "\t<image>"${cover}"</image>"
} || {
fs=$(stat -c %s ${ffn})
fs=$(stat -c %s ${customdir}"/"${ffn})
echo "\t<link filesize=\""${fs}"\">"${ffn}"</link>"
}
} || {
mfl=${ffn}"\n"
mfl=${mfl}" "${ffn}"\n"
#~ echo "file "${ffn}" not found."
err=3
}
@ -118,7 +147,7 @@ newdataentry () {
}
echo "</schleuder>"
test "$teaser" = "" && { >&2 echo "\nmissing teaser message."; }
test -e $cover || { >&2 echo "\nmissing cover."; }
test -e ${customdir}"/"$cover || { >&2 echo "\nmissing cover file: "${cover}; }
test $err -gt 0 && { >&2 echo "\nmissing files:\n"${mfl}; }
}
newinfoentry () {