-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy patham2pla-site
310 lines (275 loc) · 12.9 KB
/
am2pla-site
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
#!/usr/bin/env bash
# This is a script I use to create and update the application list on https://portable-linux-apps.github.io/
# Once created, the page will appear like this: https://portable-linux-apps.github.io/apps.html
# First of all, we need to create a file containing all the arguments that this script must read
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
arch="x86_64"
# ENTER THE DESKTOP DIRECTORY
cd "$(xdg-user-dir DESKTOP)" || exit 1
# GET THE NAMES OF ALL APPLICATION
cp "$HOME"/.local/share/AM/"$arch"-apps "$arch"-apps && echo -e "$(cat ./"$arch"-apps | awk -v FS="(◆ | : )" '{print $2}')" >> args
# GET THE EXACT NUMBER OF AVAILABLE APPS
ARGS=$(cat ./args)
APPS_NUMBER=$(grep -v "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch"-apps | grep -e "$" -c)
ITEMS_NUMBER=$(grep "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch"-apps | grep -e "$" -c)
CATEGORIES="android audio \
comic command-line communication \
disk \
education \
file-manager finance \
game gnome graphic \
internet \
kde \
office \
password \
steam system-monitor \
video \
web-app web-browser wine"
##########################################################
# UPDATE THE JSON FILE FOR FURTER ELECTRON-BASED FRONTENDS
##########################################################
function _update_json() {
echo "[" > apps.json
for arg in $ARGS; do
description=$(grep "◆ $arg :" "$arch"-apps | sed 's/"/\\"/g; s/^.*: //')
printf " {\n \"packageName\": \"%b\",\n \"description\": \"%b..\",\n \"icon\": \"https://portable-linux-apps.github.io/icons/%b.png\"\n },\n" "$arg" "$description" "$arg" >> apps.json
done
sed -i '$s/,$//' apps.json
echo "]" >> apps.json
}
_update_json
################################################
# COMMON FUNCTIONS NEEDED TO COMPILE OTHER PAGES
################################################
function _home_button {
echo ""
echo "| [Home](index.md) |"
echo "| --- |"
echo ""
}
function _table_head() {
echo "-----------------"
echo ""
echo "*NOTE, the installer scripts in the \"INSTALLER\" column are intended for use via \"AM\", and are therefore dedicated to a system-wide \
installation of applications (in /opt), and all that \"AppMan\" does is convert those scripts for local installation, changing the paths. \
**They are listed here for reading purposes only**!*"
echo ""
echo "*Should you decide to run them manually, the only way to remove the application is to run \
the command \"\`sudo /opt/appname/remove\`\", where \"appname\" is the name of the application directory containing the \"remove\" script. \
Likewise, you can also update applications by running the \"AM-updater\" script in the same directory.*"
echo ""
echo "*The \"AM\" project allow the autonomy of installed apps, regardless of the presence of \"AM\" itself in the system. However, it is strongly \
recommended to use \"AM\" and \"AppMan\" to take full advantage of all the benefits you could get from an application installed in this way.*"
echo ""
echo "*If you are here just to download apps manually, click on the program name and check the URL(s) on the application page. This site does not \
provide direct links, for security reasons, but it does provide the exact sources and references where you can find them!*"
echo ""
echo "*Transparency and credibility are the focus of this catalog. Happy exploring!*"
echo ""
echo "-----------------"
echo ""
echo "| ICON | PACKAGE NAME | DESCRIPTION | INSTALLER |"
echo "| --- | --- | --- | --- |"
}
function _categories_buttons() {
echo ""
echo "#### *Categories*"
echo ""
#- ***[SAMPLE](https://portable-linux-apps.github.io/SAMPLE.html)*** \
echo "***[AppImages](appimages.md)*** \
$(for c in $CATEGORIES; do printf " - ***[$c]($c.md)***"; done)"
echo ""
}
function _categories_buttons_on_footer() {
echo ""
echo "| [Back to Home](index.md) | [Back to Applications](apps.md)"
echo "| --- | --- |"
echo ""
}
function _back_to_apps_button() {
echo ""
echo "| [Back to Applications](apps.md) |"
echo "| --- |"
echo ""
}
function _footer_up() {
echo ""
echo ""
echo "---"
echo ""
echo "You can improve these pages via a [pull request](https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/pulls) \
to this site's [GitHub repository](https://github.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io), \
or report any problems related to the installation scripts in the '[issue](https://github.com/ivan-hc/AM/issues)' \
section of the main database, at [https://github.com/ivan-hc/AM](https://github.com/ivan-hc/AM)."
echo ""
echo "***PORTABLE-LINUX-APPS.github.io is my gift to the Linux community and was made with love for GNU/Linux and the Open Source philosophy.***"
echo ""
echo "---"
}
function _footer_down() {
echo "--------"
echo ""
echo "# Contacts"
echo "- **Ivan-HC** *on* [**GitHub**](https://github.com/ivan-hc)"
echo "- **AM-Ivan** *on* [**Reddit**](https://www.reddit.com/u/am-ivan)"
echo ""
echo "###### *You can support me and my work on [**ko-fi.com**](https://ko-fi.com/IvanAlexHC) and \
[**PayPal.me**](https://paypal.me/IvanAlexHC). Thank you!*"
echo ""
echo "--------"
echo ""
echo "*© 2020-present Ivan Alessandro Sala aka '"'Ivan-HC'"'* - I'm here just for fun!"
echo ""
echo ""
}
function _footer_apps() {
_footer_up
_home_button
_footer_down
}
function _footer_categories() {
_footer_up
_categories_buttons_on_footer
_footer_down
}
###############################
# COMPILE THE APPLICATIONS LIST
###############################
function _applications_list_header {
echo "# APPLICATIONS" > apps.md
_home_button >> apps.md
echo "#### Here are listed all **$APPS_NUMBER** unique applications, AppImage packages and command line utilities managed by [AM](https://github.com/ivan-hc/AM) \
and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture, plus **$ITEMS_NUMBER** more entries and items to help you install apps more easily." >> apps.md
echo "" >> apps.md
echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> apps.md
echo "" >> apps.md
_categories_buttons >> apps.md
_table_head >> apps.md
}
function _applications_list_body() {
for arg in $ARGS; do
description=$(grep "◆ $arg :" "$arch"-apps | sed 's/^.*: //; s/ *$//')
echo "| <img loading=\"lazy\" src=\"icons/$arg.png\" width=\"48\" height=\"48\"> | [***$arg***](apps/$arg.md) | *$description*..[ *read more* ](apps/$arg.md)*!* | [*blob*](https://github.com/ivan-hc/AM/blob/main/programs/$arch/$arg) **/** [*raw*](https://raw.githubusercontent.com/ivan-hc/AM/main/programs/$arch/$arg) |" >> body.txt &
done
wait
sort -u ./body.txt >> apps.md
}
_applications_list_header
_applications_list_body
_footer_apps >> apps.md
########################
# COMPILE APPIMAGES PAGE
########################
function _appimages_listing() {
APPIMAGES_LIST_AM=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64-appimages)
echo "$APPIMAGES_LIST_AM" | awk -v FS="(◆ | : )" '{print $2}' > args
ARGS=$(cat ./args)
APPIMAGES_NUMBER=$(cat ./args | wc -l)
}
function _appimages_list_header {
echo "# APPIMAGES" > appimages.md
_home_button >> appimages.md
echo "#### Here are listed the **$APPIMAGES_NUMBER** unique Appimages managed by [AM](https://github.com/ivan-hc/AM) \
and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> appimages.md
echo "" >> appimages.md
echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> appimages.md
echo "" >> appimages.md
_back_to_apps_button >> appimages.md
_categories_buttons >> appimages.md
_table_head >> appimages.md
}
function _appimages_list_body() {
for arg in $ARGS; do
grep "apps/$arg.md" ./body.txt >> appimages.md
done
}
_appimages_listing
_appimages_list_header
_appimages_list_body
_footer_categories >> appimages.md
######################################
# COMPILE THE MAIN PAGE OF THE WEBSITE
######################################
ST_APPS_NUMBER=$(($APPS_NUMBER-$APPIMAGES_NUMBER))
function _compile_the_homepage() {
wget -q https://raw.githubusercontent.com/Portable-Linux-Apps/Portable-Linux-Apps.github.io/main/index.md -O index.old
sed -n '1,10p' ./index.old > ./index.md
echo "#### *This site lists **$APPS_NUMBER** unique apps (**$APPIMAGES_NUMBER** Appimage packages and **$ST_APPS_NUMBER** standalone/portable programs), plus **$ITEMS_NUMBER** items.*" >> ./index.md
sed -n '12,19p' ./index.old >> ./index.md
_categories_buttons >> ./index.md
sed -n '25,20000p' ./index.old >> ./index.md
}
_compile_the_homepage
##################
# OTHER CATEGORIES
##################
function _category_list_header {
echo "# $(echo "$category" | tr a-z A-Z)" > "$category".md
_home_button >> "$category".md
echo "#### Here are listed **$APPS_NUMBER** programs and **$ITEMS_NUMBER** items for this category and managed by [AM](https://github.com/ivan-hc/AM) \
and [AppMan](https://github.com/ivan-hc/AppMan) for the x86_64 architecture." >> "$category".md
echo "" >> "$category".md
echo "*Use your browser's built-in search tool to easily navigate to this page or use the tags below.*" >> "$category".md
echo "" >> "$category".md
_back_to_apps_button >> "$category".md
_categories_buttons >> "$category".md
_table_head >> "$category".md
}
function _category_list_body() {
for arg in $ARGS; do
grep "apps/"$arg".md" ./body.txt >> $category.md
done
}
for category in $CATEGORIES; do
if [ "$category" = android ]; then
grep -i "$category\| adb \|fastboot\|phone\|platform-tools" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = audio ]; then
grep -i "$category\|music\|midi\|mp3\|sound" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = comic ]; then
grep -i "$category\|manga\|epub\|anime" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = command-line ]; then
grep -i "$category\|command line\| cli \|terminal\|fastboot\| npm \| bash \| shell \| dash \| zsh " ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = communication ]; then
grep -i "$category\|voip\|facebook\|messenger\|whatsapp\|mastodon\|skype\|chat\|social network\|zoom\|conferenc\|discord" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = disk ]; then
grep -i "$category\|partition\|usb" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = education ]; then
grep -i "$category\| edu\|science\|learn\|study\|teach\|translat\|geo\|child\| book\|ebook\|space simulator\|planet\|astronom" ./"$arch"-apps | grep -vi "game\|manga\|anime" >> "$arch-$category"
elif [ "$category" = file-manager ]; then
grep -i "$category\|file manager\|file browse\|browse.*file\|file explore" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = finance ]; then
grep -i "$category\|wallet\|money\|economy\|economic" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = game ]; then
grep -i "$category\|arcade\|steam\|wine\|strateg\|solitaire\|poker\|chess\|puzzle\|pinball\|adventure\|playstation\|xbox\|nintendo\|minecraft" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = graphic ]; then
grep -i "$category\|picture\|screensh\|gimp\|photo\|svg\|png\|autocad\|blender\|modeling\|paint\|pixel\|wallpaper" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = internet ]; then
grep -i "$category\|web browser\|browser web\|firefox\|chrome\|youtube\|torrent\|p2p\|chat\|whatsapp\|mastodon\|telegram\|skype" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = office ]; then
grep -i "$category\|document\|book\|pdf\|docx\|reader\|spreadsheet\| word \| excel " ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = password ]; then
grep -i "$category" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = system-monitor ]; then
grep -i "$category\|system monitor\|task manager\|system resource" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = video ]; then
grep -i "$category\|stream\|media player\|film\|movie\|netflix\|youtube\|iptv" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = web-app ]; then
grep -i "$category\|webapp\|web app\|ffwa" ./"$arch"-apps >> "$arch-$category"
elif [ "$category" = web-browser ]; then
grep -i "$category\|web browser\|browser web\|browser.*web\|browser.*chrome\|brave.*browser\|chrome.*browser\|chromium.*browser\|firefox.*web browser\|vivaldi\|thorium\|mercury\|librewolf" ./"$arch"-apps >> "$arch-$category"
else
grep -i "$category" ./"$arch"-apps >> "$arch-$category"
fi
echo -e "$(cat ./"$arch-$category" | awk -v FS="(◆ | : )" '{print $2}')" > args
ARGS=$(cat ./args)
APPS_NUMBER=$(grep -v "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
ITEMS_NUMBER=$(grep "ffwa-\|\"kdegames\"\|\"kdeutils\"\|\"node\"\|\"platform-tools\"" "$arch-$category" | grep -e "$" -c)
_category_list_header
_category_list_body
_footer_categories >> "$category".md
rm -f ./"$arch-$category"
done
######################
# END OF ALL PROCESSES
######################
rm ./args ./index.old ./"$arch"-apps ./body.txt