@@ -459,14 +459,22 @@ sudo chmod a+x appstreamcli-x86_64.AppImage
459459 # License
460460 AS_LICENSE=" "
461461 DT_LICENSE=" "
462- if [ -f database/$INPUTBASENAME /* appdata.xml ] ; then
463- AS_LICENSE=$( cat database/$INPUTBASENAME /* appdata.xml | xmlstarlet sel -t -m " /component/project_license" -v .) || true
464- fi
465- DT_LICENSE=$( grep -r " X-AppImage-Payload-License=.*" database/$INPUTBASENAME /* .desktop | cut -d ' =' -f 2)
462+ AS_LICENSE=$(
463+ xmlstarlet sel -t \
464+ -m " /component/project_license" -v . \
465+ $( ls database/$INPUTBASENAME /* .{appdata,metainfo}.xml 2> /dev/null)
466+ ) || true
467+ DT_LICENSE=$(
468+ grep -h " X-AppImage-Payload-License=" database/$INPUTBASENAME /* .desktop 2> /dev/null \
469+ | cut -d ' =' -f 2
470+ ) || true
466471 if [ x" $AS_LICENSE " != x" " ] ; then
467472 echo " license: $AS_LICENSE " >> apps/$INPUTBASENAME .md
468473 elif [ x" $DT_LICENSE " != x" " ] ; then
469474 echo " license: $DT_LICENSE " >> apps/$INPUTBASENAME .md
475+ else
476+ echo " No license found!"
477+ exit 1
470478 fi
471479 # Icon
472480 ICONBASENAME=$( basename " $ICONFILE " )
@@ -490,9 +498,13 @@ sudo chmod a+x appstreamcli-x86_64.AppImage
490498 # Authors
491499 echo " " >> apps/$INPUTBASENAME .md
492500 echo " authors:" >> apps/$INPUTBASENAME .md
493- GH_USER=$( grep " ^https://github.com.*" data/$INPUTBASENAME | cut -d ' /' -f 4 )
494- GH_REPO=$( grep " ^https://github.com.*" data/$INPUTBASENAME | cut -d ' /' -f 5 )
495- OBS_USER=$( grep " ^http.*://download.opensuse.org/repositories/home:/" data/$INPUTBASENAME | cut -d " /" -f 6 | sed -e ' s|:||g' )
501+ GH_USER=$( grep " ^https://github.com/" data/$INPUTBASENAME | cut -d ' /' -f 4) || true
502+ GH_REPO=$( grep " ^https://github.com/" data/$INPUTBASENAME | cut -d ' /' -f 5) || true
503+ OBS_USER=$(
504+ grep -h " ^http.*://download.opensuse.org/repositories/home:/" " data/$INPUTBASENAME " 2> /dev/null \
505+ | cut -d " /" -f 6 \
506+ | sed ' s|:||g'
507+ ) || true
496508 # BB_USER=$(grep "^https://bitbucket.org.*" data/$INPUTBASENAME | cut -d '/' -f 4 )
497509 # BB_REPO=$(grep "^https://bitbucket.org.*" data/$INPUTBASENAME | cut -d '/' -f 5 )
498510 if [ x" $GH_USER " == x" " ] ; then
@@ -518,7 +530,7 @@ sudo chmod a+x appstreamcli-x86_64.AppImage
518530 echo " - type: Download" >> apps/$INPUTBASENAME .md
519531 echo " url: https://github.com/$GH_USER /$GH_REPO /releases" >> apps/$INPUTBASENAME .md
520532 fi
521- OBS_LINK=$( grep " ^http.*://download.opensuse.org.*latest.*AppImage$" data/$INPUTBASENAME | sed -e ' s|http://d|https://d|g' )
533+ OBS_LINK=$( grep " ^http.*://download.opensuse.org.*latest.*AppImage$" data/$INPUTBASENAME | sed -e ' s|http://d|https://d|g' ) || true
522534 if [ x" $OBS_LINK " != x" " ] ; then
523535 echo " - type: Download" >> apps/$INPUTBASENAME .md
524536 echo " url: $OBS_LINK .mirrorlist" >> apps/$INPUTBASENAME .md
0 commit comments