PortableLinuxGames/appImageBodegaSpec

95 lines
2.5 KiB
Plaintext
Raw Normal View History

2013-11-13 13:45:19 -08:00
#!/bin/bash
# Author : Ismael Barros² <ismael@barros2.org>
# License : BSD http://en.wikipedia.org/wiki/BSD_license
pg4l_dir=$(dirname $(readlink -f $0))
source "$pg4l_dir/util.sh"
OIFS=$IFS
NIFS=$'\n'
IFS=$NIFS
for i in $(ls -1t "$@"); do
pkg=$(basename "$i")
name=${pkg% *}
v=${pkg##* }
v=${v%.*}
release=${v#*r}
version=${v/r$release/}
version=${version%-}
2013-11-25 15:45:22 -08:00
#size=$(du "$i" | awk '{printf "%0.2f\n", $1/1000}')
size=$(du "$i" | awk '{printf $1}')
2013-11-13 13:45:19 -08:00
mountpoint="$(mktemp -d --suffix=_unpackAppImage)"
fuseiso -p "$i" "$mountpoint" || exit 1
desktopFile="$(ls -1 "$mountpoint"/*.desktop | head -n1)"
2013-11-25 15:45:22 -08:00
2013-11-13 13:45:19 -08:00
url=
if [ -f "$desktopFile" ]; then
title=$(desktopFile_getParameter "$desktopFile" "X-AppImage-Title")
url=$(desktopFile_getParameter "$desktopFile" "X-AppImage-URL")
fi
2013-11-25 15:45:22 -08:00
icon=
if [ -f "$mountpoint/.DirIcon" ]; then
icon=$(mktemp)
cp "$mountpoint/.DirIcon" "$icon"
fi
2013-11-13 13:45:19 -08:00
fusermount -u "$mountpoint"
2013-11-25 15:45:22 -08:00
icons=
screenshots=
[ -n "$icon" ] && icons+="$icon"
2013-11-13 13:45:19 -08:00
cat <<END
{
"name" : "$pkg",
"version" : "$version-r$release",
"description" : "",
2013-11-19 13:15:10 -08:00
"partner" : "1036",
2013-11-13 13:45:19 -08:00
"basePrice" : "0",
"file" : "$pkg",
"size" : "$size",
"previews" : [
2013-11-25 15:45:22 -08:00
END
for j in $icons; do
if [ -f "$j" ]; then
#size=$(identify -format "%[fx:w]x%[fx:h]" "$j")
width=$(identify -format "%[fx:w]" "$j")
case "$width" in
"512") subtype="huge" ;;
"256") subtype="large" ;;
"128") subtype="big" ;;
"64") subtype="medium" ;;
"48") subtype="small" ;;
"32") subtype="small" ;;
"22") subtype="tiny" ;;
*) subtype="unknown" ;;
esac
echo { \"type\" : \"icon\", \"subtype\" : \"$subtype\", \"file\" : \"$j\", \"mimetype\" : \"$(file -b --mime-type "$j")\" }
fi
done
for j in $screenshots; do
[ -f "$j" ] && echo { \"type\" : \"screenshot\", \"subtype\" : \"screen1\", \"file\" : \"$j\", \"mimetype\" : \"$(file -b --mime-type "$j")\" }
done
cat <<END
2013-11-13 13:45:19 -08:00
],
"tags" : [
2013-11-25 15:45:22 -08:00
{"type" : "license", "title" : "Proprietary / All rights reserved"},
2013-11-13 13:45:19 -08:00
{"type" : "contentrating", "title" : "Everyone"},
2013-11-25 15:45:22 -08:00
{"type" : "assetType", "title" : "game"},
2013-11-13 13:45:19 -08:00
{"type" : "author", "title" : "__AUTHOR__"},
{"type" : "publisher", "title" : "PortableLinuxGames.org"},
{"type" : "created", "title" : "$(date +%d-%m-%Y)"},
{"type" : "url", "title" : "$url"}
]
}
END
done