~earboxer/apkbrowser-gemini

ref: bbb09ad1c777215d0cbdebf1c1a40e4adf235816 apkbrowser-gemini/package -rwxr-xr-x 1.5 KiB
bbb09ad1Zach DeCook Project: Add readme and license 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
. ./config.sh
IFS=/
set -- $PATH_INFO

branch="$(printf '%s' $2 | tr -dc '[:alnum:]-')"
repo="$(printf '%s' $3 | tr -dc '[:alnum:]-')"
arch="$(printf '%s' $4 | tr -dc '[:alnum:]-')"
package="$(printf '%s' $5 | tr -dc '[:alnum:]-')"

IFS="$(printf "\t")"

set -- $(
	printf "SELECT version, description, url, license, size, installed_size, origin, maintainer.name, build_time, \`commit\`
		FROM packages
		LEFT JOIN maintainer on packages.maintainer = maintainer.id
		WHERE repo=\"$repo\" AND arch=\"$arch\" AND packages.name=\"$package\";" | \
	sqlite3 -separator "$(printf "\t")" "db/$branch.db"
)

if ! test "$9" -gt "1118668260"; then
	printf "51 Not Found\r\n"
	exit 1
fi

version="$1"
description="$2"
project="$3"
license="$4"
size="$(printf %d\\n "$5" | numfmt --to=iec-i)"
installed_size="$(printf %d\\n "$6" | numfmt --to=iec-i)"
origin="$7"
maintainer="$8"
build_time="$(TZ="" date --date="@$9" "+%Y-%m-%d %T")"
commit="${10}"

printf "20 text/gemini\r\n"
echo "#	$package"
echo "## Package details"
echo "* Version:	$version"
echo "* Description:	$description"
echo "=>	$project"
echo "* License:	$license"
echo "* Size:	$size"
echo "* Installed Size:	$installed_size"
echo "* Origin:	$origin"
echo "* Maintainer:	$maintainer"
echo "* Build time:	$build_time"
echo "=> $external_git_commit$commit Commit:	$commit"
# echo "=> Git repository:"
# echo "=> Build log"
echo "=>	/content/$branch/$repo/$arch/$package	Contents"
echo "## Depends"
echo "## Required by"
echo "## Sub Packages"