-
Notifications
You must be signed in to change notification settings - Fork 10
/
feedgen.sh
executable file
·95 lines (93 loc) · 2.85 KB
/
feedgen.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Title: spm
# Description: Downloads and installs AppImages and precompiled tar archives. Can also upgrade and remove installed packages.
# Dependencies: GNU coreutils, tar, wget, python3.x
# Author: simonizor
# Website: http://www.simonizor.gq
# License: GPL v2.0 only
# Generates spm-feed.json containing info for AppImages and precompiled tar packages
rm -f "$HOME"/github/spm/spm-feed.json
cat >"$HOME"/github/spm/spm-feed.json << EOL
{
"version": 1,
"home_page_url": "https://github.com/simoniz0r/spm",
"feed_url": "https://simoniz0r.github.io/spm-feed.json",
"description": "json feed containing package information for spm.",
"updated_at": "$(date)",
"expired": false,
"appimages": [
EOL
for image in $(dir -C -w 1 $HOME/github/spm/appimages); do
image="$(echo $image | rev | cut -f2- -d'.' | rev)"
INSTALLNAME="$(jq -r '.installname' ~/github/spm/appimages/$image.json)"
[ "$INSTALLNAME" = "null" ] && INSTALLNAME="$(jq -r '.name' ~/github/spm/appimages/$image.json | tr '[:upper:]' '[:lower:]')"
PACKAGETYPE="$(jq -r '.type' ~/github/spm/appimages/$image.json)"
[ "$PACKAGETYPE" = "null" ] && PACKAGETYPE="AppImage"
cat >>"$HOME"/github/spm/spm-feed.json << EOL
{
"name": "$(jq -r '.name' ~/github/spm/appimages/$image.json)",
"installname": "$INSTALLNAME",
"type": "$PACKAGETYPE",
"description": "$(jq -r '.description' ~/github/spm/appimages/$image.json)",
"authors": [
{
"name": "$(jq -r '.authors[0].name' ~/github/spm/appimages/$image.json)",
"url": "$(jq -r '.authors[0].url' ~/github/spm/appimages/$image.json)"
}
],
"links": [
{
"type": "$(jq -r '.links[0].type' ~/github/spm/appimages/$image.json)",
"url": "$(jq -r '.links[0].url' ~/github/spm/appimages/$image.json)"
},
{
"type": "$(jq -r '.links[1].type' ~/github/spm/appimages/$image.json)",
"url": "$(jq -r '.links[1].url' ~/github/spm/appimages/$image.json)"
}
],
"installinfo": [
{
"version": "Not Installed",
"size": "Not Installed",
"tag": "Not Installed",
"status": "Not Installed"
}
]
},
EOL
echo "$(tput setaf 2)$image has been added to spm-feed.json$(tput sgr0)"
done
cat >>"$HOME"/github/spm/spm-feed.json << EOL
{
"END": "END",
"name": "END",
"installname": "removeme",
"type": "END",
"authors": [
{
"name": "END",
"url": "END"
}
],
"links": [
{
"type": "END",
"url": "END"
},
{
"type": "END",
"url": "END"
}
],
"installinfo": [
{
"version": "END",
"size": "END",
"tag": "END",
"status": "END"
}
]
}
]
}
EOL