mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-11-07 22:18:29 +01:00
automatically generate repository files
This commit is contained in:
parent
24f887a2c0
commit
71e63d2bf2
102
packages.json
102
packages.json
@ -1,11 +1,93 @@
|
||||
[
|
||||
{
|
||||
"pkgname": "wTerm",
|
||||
"name": "Terminal",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/README.md",
|
||||
"category": "System",
|
||||
"author": "xsang.le@gmail.com",
|
||||
"version": "0.0.3-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/build/release/wTerm.zip"
|
||||
}
|
||||
]
|
||||
{
|
||||
"pkgname": "About",
|
||||
"name": "__(About AntOS)",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/About/README.md",
|
||||
"category": "Other",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/About/build/release/About.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "ActivityMonitor",
|
||||
"name": "Activity monitor",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ActivityMonitor/README.md",
|
||||
"category": "System",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ActivityMonitor/build/release/ActivityMonitor.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "GraphEditor",
|
||||
"name": "Graph Editor",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/GraphEditor/README.md",
|
||||
"category": "Office",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.4-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/GraphEditor/build/release/GraphEditor.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "MarkOn",
|
||||
"name": "Markdown editor",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/MarkOn/README.md",
|
||||
"category": "Utils",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/MarkOn/build/release/MarkOn.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "OpenPage",
|
||||
"name": "OpenPage",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OpenPage/README.md",
|
||||
"category": "Other",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.2-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OpenPage/build/release/OpenPage.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "Preview",
|
||||
"name": "Preview",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Preview/README.md",
|
||||
"category": "Utils",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/Preview/build/release/Preview.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "RemoteDesktop",
|
||||
"name": "WVNC remote desktop",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/README.md",
|
||||
"category": "Other",
|
||||
"author": "",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/RemoteDesktop/build/release/RemoteDesktop.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "ShowCase",
|
||||
"name": "ShowCase",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/README.md",
|
||||
"category": "Other",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/build/release/ShowCase.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "TinyEditor",
|
||||
"name": "TinyEditor",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/TinyEditor/README.md",
|
||||
"category": "Other",
|
||||
"author": "",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/TinyEditor/build/release/TinyEditor.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "wTerm",
|
||||
"name": "Terminal",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/README.md",
|
||||
"category": "System",
|
||||
"author": "Xuan Sang LE",
|
||||
"version": "0.0.1-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/build/release/wTerm.zip"
|
||||
}
|
||||
|
||||
]
|
51
reposify.sh
Executable file
51
reposify.sh
Executable file
@ -0,0 +1,51 @@
|
||||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
repodir=$1
|
||||
repofile=$2
|
||||
|
||||
function get_json_entry()
|
||||
{
|
||||
cmd="cat $1 | sed -n 's/\"$2\"[[:space:]]*:[[:space:]]*\"\(.*\)\"[[:space:]]*,*/\1/p'|sed -e 's/^[[:space:]]*//'"
|
||||
value=$(eval "$cmd")
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
function join_by { local IFS="$1"; shift; echo "$*"; }
|
||||
|
||||
function gen_pkg_meta()
|
||||
{
|
||||
author=$(get_json_entry "$1/package.json" "author")
|
||||
name=$(get_json_entry "$1/package.json" "name")
|
||||
category=$(get_json_entry "$1/package.json" "category")
|
||||
version=$(get_json_entry "$1/package.json" "version")
|
||||
printf "\t{\n"
|
||||
printf "\t\t\"pkgname\": \"%s\",\n" "$2"
|
||||
printf "\t\t\"name\": \"%s\",\n" "$name"
|
||||
printf "\t\t\"description\": \"https://raw.githubusercontent.com/lxsang/antosdk-apps/master/%s/README.md\",\n" "$2"
|
||||
printf "\t\t\"category\": \"%s\",\n" "$category"
|
||||
printf "\t\t\"author\": \"%s\",\n" "$author"
|
||||
printf "\t\t\"version\": \"%s\",\n" "$version"
|
||||
printf "\t\t\"download\": \"https://raw.githubusercontent.com/lxsang/antosdk-apps/master/%s/build/release/%s.zip\"\n" "$2" "$2"
|
||||
printf "\t}\n"
|
||||
}
|
||||
# generate packages meta-data
|
||||
[ ! -d "$repodir" ] && echo "No such directory: $repodir" && exit 1
|
||||
[ -z "$repofile" ] && repofile="packages.json"
|
||||
echo "[" > "$repofile"
|
||||
for file in "$repodir"/* ; do
|
||||
if [ -d "$file" ]; then
|
||||
pkgname=$(basename "$file")
|
||||
# test if it has release file
|
||||
pkgpath="$file/build/release/$pkgname.zip"
|
||||
if [ -f "$pkgpath" ] && [ -f "$file/package.json" ]; then
|
||||
#read the package meta-data
|
||||
meta=$(gen_pkg_meta "$file" "$pkgname")
|
||||
printf "%s,\n" "$meta" >> "$repofile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
sed '$ s/,$//' < "$repofile" > "$repofile.tmp"
|
||||
printf "\n]" >> "$repofile.tmp"
|
||||
mv "$repofile.tmp" "$repofile"
|
Loading…
Reference in New Issue
Block a user