Skip to content

Commit 96e523d

Browse files
authored
"AM" 9.7 (#1448)
* Update install.am - remove torsocks support - use api.gh.pkgforge.dev in case api.github.com cannot be reached - restore changes in the AM-updater not to overload api.gh.pkgforge.dev * Update template.am - remove torsocks support - for previews, use api.gh.pkgforge.dev as a fallback if api.github.com is not reachable * Update README.md * Update appimageupdatetool (x86_64 and aarch64) - This script allows you to choose between the improved fork and the official AppImage. The fork is provided by the pkgforge-dev/AppImageUpdate, with GH rate-limit-bypass & misc QOL changes. * Update test-apps.yml * Update APP-MANAGER - remove torsocks support - during updates, use api.gh.pkgforge.dev as a fallback if api.github.com is not reachable - add new "$ALT_GH" variable - made "$ALT_GH" an exportable variable - added function to determine the number of apps coming from github.com - determine the number of allowed api calls by subtracting the number of apps coming from github from the number of remaining api calls - if the number of allowed api calls is less than 10, the proxy is activated - reduce the limit of API calls allowed to 5, to not force the proxy
1 parent 0a9e3fe commit 96e523d

File tree

7 files changed

+120
-93
lines changed

7 files changed

+120
-93
lines changed

.github/workflows/test-apps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ jobs:
338338
339339
else
340340
341-
if [[ "$pure_arg" =~ (gimp|libreoffice|mpv|wine) ]]; then
341+
if [[ "$pure_arg" =~ (appimageupdatetool|gimp|libreoffice|mpv|wine) ]]; then
342342
343343
echo 1 | am -i "${{ matrix.file }}" --debug 2>&1 || echo "try again" && echo 1 | am -i "${{ matrix.file }}" --debug 2>&1 || echo "last attempt" && echo 1 | am -i "${{ matrix.file }}" --debug 2>&1
344344

APP-MANAGER

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
AMVERSION="9.6.2"
3+
AMVERSION="9.7"
44

55
# Determine main repository and branch
66
AMREPO="https://raw.githubusercontent.com/ivan-hc/AM/main"
@@ -1046,51 +1046,35 @@ _update_determine_apps_version_changes() {
10461046
fi
10471047
}
10481048

1049-
_update_torsocks_handler() {
1050-
torsocks_congif_file=$(find /etc -type f -name torsocks.conf 2>/dev/null)
1051-
if [ -n "$torsocks_congif_file" ]; then
1052-
if grep -q "^#AllowOutboundLocalhost 1" "$torsocks_congif_file" && command -v appimageupdatetool 1>/dev/null; then
1053-
[ ! -f "$AMDATADIR"/torsocks.conf ] && cat "$torsocks_congif_file" > "$AMDATADIR"/torsocks.conf
1054-
sed -i 's/^#AllowOutboundLocalhost 1/AllowOutboundLocalhost 1/g' "$AMDATADIR"/torsocks.conf
1055-
[ -f "$AMDATADIR"/torsocks.conf ] && export TORSOCKS_CONF_FILE="$AMDATADIR"/torsocks.conf
1056-
GH_API_ALLOWED=$(torsocks curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/ivan-hc/AM/releases/latest | sed 's/[()",{} ]/\n/g' | grep "^ivan-hc" | head -1)
1057-
if [ -z "$GH_API_ALLOWED" ]; then
1058-
printf " ✖ %b update failed, please restart %btor.service\033[0m to fix! \n" "$APPNAME" "${Green}"
1059-
exit 1
1060-
fi
1049+
[ -z "$ALT_GH" ] && ALT_GH="api.gh.pkgforge.dev"
1050+
1051+
_update_determine_gh_apps_number() {
1052+
for arg in $ARGS; do
1053+
argpath=$(echo "$ARGPATHS" | grep "/$arg$")
1054+
if [ -f "$argpath"/AM-updater ] && grep -q "api.github.com" "$argpath"/AM-updater; then
1055+
[ -n "$GH_APPS" ] && GH_APPS=$(printf "%b\n%b\n" "$GH_APPS" "$arg") || GH_APPS="$arg"
10611056
fi
1057+
done
1058+
wait
1059+
[ -z "$GH_APPS" ] && GH_APPS_NUMBER="" || GH_APPS_NUMBER=$(echo "$GH_APPS" | wc -l | sed 's/ //g')
1060+
if [ -n "$GH_APPS_NUMBER" ]; then
1061+
GH_API_REMAINING=$(curl -Ls "https://api.github.com/rate_limit" | tr '{,' '\n' | grep -i remaining | tail -1 | grep -Eo "[0-9]*")
1062+
GH_API_ALLOWED=$(("$GH_API_REMAINING"-"$GH_APPS_NUMBER"))
10621063
fi
10631064
}
10641065

10651066
_update_run_updater() {
10661067
if grep -q "api.github.com" "$argpath"/AM-updater; then
1067-
GH_API_ALLOWED=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/ivan-hc/AM/releases/latest | sed 's/[()",{} ]/\n/g' | grep "^ivan-hc" | head -1)
1068-
if [ -z "$GH_API_ALLOWED" ]; then
1069-
if command -v torsocks 1>/dev/null; then
1070-
_update_torsocks_handler
1071-
if [ -z "$debug_update" ]; then
1072-
torsocks "$argpath"/AM-updater >/dev/null 2>&1
1073-
else
1074-
torsocks "$argpath"/AM-updater
1075-
fi
1076-
else
1077-
echo "$APPNAME cannot be updated, you have reached GitHub API limit. Install \"torsocks\" from your system package manager and retry!" \
1078-
| fold -sw 72 | sed 's/^/ /g; s/ ✖/✖/g'
1079-
fi
1080-
else
1081-
if [ -z "$debug_update" ]; then
1082-
"$argpath"/AM-updater >/dev/null 2>&1
1083-
else
1084-
"$argpath"/AM-updater
1085-
fi
1068+
if [ "$GH_API_ALLOWED" -le 5 ]; then
1069+
sed -i "s#api.github.com#$ALT_GH#g" "$argpath"/AM-updater
10861070
fi
1071+
fi
1072+
if [ -z "$debug_update" ]; then
1073+
"$argpath"/AM-updater >/dev/null 2>&1
10871074
else
1088-
if [ -z "$debug_update" ]; then
1089-
"$argpath"/AM-updater >/dev/null 2>&1
1090-
else
1091-
"$argpath"/AM-updater
1092-
fi
1075+
"$argpath"/AM-updater
10931076
fi
1077+
sed -i "s#$ALT_GH#api.github.com#g" "$argpath"/AM-updater 2>/dev/null
10941078
end=$(date +%s)
10951079
timelapsed=$((end - start))
10961080
[ "$timelapsed" = 1 ] && echo "$APPNAME is updated, $timelapsed second elapsed!" || echo "$APPNAME is updated, $timelapsed seconds elapsed!"
@@ -1117,7 +1101,6 @@ _update_all_apps() {
11171101
fi
11181102
done
11191103
wait
1120-
rm -f "$AMDATADIR"/torsocks.conf
11211104
_update_determine_apps_version_changes
11221105
_clean_all_tmp_directories_from_appspath >/dev/null
11231106
[ -d "$APPMAN_APPSPATH" ] && rm -Rf "$APPMAN_APPSPATH"/*/tmp
@@ -1163,6 +1146,9 @@ _use_update() {
11631146
if echo "$FLAGS" | grep -q -- "--debug"; then
11641147
debug_update="1"
11651148
fi
1149+
1150+
_update_determine_gh_apps_number
1151+
11661152
if [ -z "$ENTRIES" ]; then
11671153
_clean_amcachedir
11681154
_update_list_updatable_apps
@@ -1200,7 +1186,6 @@ _use_update() {
12001186
fi
12011187
done
12021188
wait
1203-
rm -f "$AMDATADIR"/torsocks.conf
12041189
exit 0
12051190
fi
12061191
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ To install "AM" you must first install the "core" dependencies from your package
8787
- "`less`", to read the ever-longer lists;
8888
- "`unzip`", to extract .zip packages;
8989
- "`tar`", to extract .tar* packages;
90-
- "`torsocks`", to connect to the TOR network;
9190
- "`zsync`", required by very few programs and AppImages (although it is mentioned in all installation scripts, it is often disabled because the managed .zsync files are often broken, especially for apps hosted on github.com).
9291

9392
</details>

modules/install.am

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ _post_installation_processes() {
228228

229229
_ending_the_installation() {
230230
LASTDIR=$(ls -td "$APPSPATH"/* | head -1 | sed 's:.*/::')
231+
[ -f "${LASTDIRPATH}"/AM-updater ] && sed -i "s#$ALT_GH#api.github.com#g" "${LASTDIRPATH}"/AM-updater 2>/dev/null
231232
if [ -f "${LASTDIRPATH}"/remove ]; then
232233
if test -d "${LASTDIRPATH}"/tmp; then
233234
echo " 💀 ERROR DURING INSTALLATION, REMOVED $APPNAME!"
@@ -259,20 +260,15 @@ _install_arg() {
259260
_check_if_spooky_flag_exists || return 1
260261
_check_kind_of_installation_script || return 1
261262
_apply_patches
262-
# Determine if Torsocks is needed
263-
if command -v torsocks 1>/dev/null; then
264-
TORSOCKS="1"
265-
fi
263+
# Determine if the app is hosted on github
266264
if grep -q "api.github.com" ./"$arg"; then
267-
GH_API_ALLOWED=$(curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos/ivan-hc/AM/releases/latest | sed 's/[()",{} ]/\n/g' | grep "^ivan-hc" | head -1)
268-
[ -z "$GH_API_ALLOWED" ] && [ -z "$TORSOCKS" ] && printf "💀 Cannot install \"%b\", you have reached GitHub API limit.\n\nInstall \"torsocks\" from your system package manager and retry! \n" "$arg" | fold -sw 72 | sed 's/^/ /g; s/ ✖/✖/g' && return 0
265+
GH_API_ALLOWED=$(curl -Ls "https://api.github.com/rate_limit" | tr '{,' '\n' | grep -i remaining | tail -1 | grep -Eo "[0-9]*")
266+
if [ "$GH_API_ALLOWED" -le 10 ]; then
267+
sed -i "s#api.github.com#$ALT_GH#g" ./"$arg"
268+
fi
269269
fi
270270
# Install script
271-
if grep -q "api.github.com" ./"$arg" && [ -z "$GH_API_ALLOWED" ] && [ -n "$TORSOCKS" ]; then
272-
$SUDOCMD torsocks ./"$arg"
273-
else
274-
$SUDOCMD ./"$arg"
275-
fi
271+
$SUDOCMD ./"$arg"
276272
echo ""
277273
_post_installation_processes
278274
_ending_the_installation

modules/template.am

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ _template_if_github() {
188188
COMMENT=$(curl $HeaderAuthWithGITPAT https://api.github.com/repos/"$RESPONSE" 2>/dev/null | grep description | sed 's/"description": "//' | sed 's/",//' | cut -c 3-)
189189
CURL_COMMAND_REF="curl -Ls https://api.github.com/repos"
190190
CURL_COMMAND_REF_PREVIEW="curl -Ls $HeaderAuthWithGITPAT https://api.github.com/repos"
191+
GH_API_ALLOWED=$(curl -Ls "https://api.github.com/rate_limit" | tr '{,' '\n' | grep -i remaining | tail -1 | grep -Eo "[0-9]*")
192+
if [ "$GH_API_ALLOWED" -le 10 ]; then
193+
CURL_COMMAND_REF_PREVIEW="curl -Ls https://$ALT_GH/repos"
194+
fi
191195
}
192196

193197
_template_if_codeberg() {
@@ -222,17 +226,10 @@ _template_if_git_repo() {
222226
echo "$DIVIDING_LINE"
223227
}
224228

225-
_template_test_github_url_if_torsocks_exists() {
229+
_template_test_github_url() {
226230
echo ""
227231
GHURLPREVIEW=$(eval "$GHURLPREVIEW_COMMAND")
228-
if [ -z "$GHURLPREVIEW" ]; then
229-
if command -v torsocks 1>/dev/null; then
230-
GHURLPREVIEW="torsocks $GHURLPREVIEW_COMMAND"
231-
eval "$GHURLPREVIEW"
232-
fi
233-
else
234-
echo "$GHURLPREVIEW"
235-
fi
232+
echo "$GHURLPREVIEW"
236233
}
237234

238235
_template_then_git_repo() {
@@ -251,10 +248,10 @@ _template_then_git_repo() {
251248
if ! echo "$yn" | grep -qi "^n"; then
252249
if [ "$templatetype" = 0 ]; then
253250
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*mage$\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | head -1"
254-
_template_test_github_url_if_torsocks_exists
251+
_template_test_github_url
255252
elif [ "$templatetype" = 2 ]; then
256253
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | head -1"
257-
_template_test_github_url_if_torsocks_exists
254+
_template_test_github_url
258255
fi
259256
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
260257
fi
@@ -270,10 +267,10 @@ _template_then_git_repo() {
270267
if ! echo "$yn" | grep -qi "^n"; then
271268
if [ "$templatetype" = 0 ]; then
272269
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*mage$\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | grep -i \"$response\" | head -1"
273-
_template_test_github_url_if_torsocks_exists
270+
_template_test_github_url
274271
elif [ "$templatetype" = 2 ]; then
275272
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | grep -i \"$response\" | head -1"
276-
_template_test_github_url_if_torsocks_exists
273+
_template_test_github_url
277274
fi
278275
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
279276
fi
@@ -287,10 +284,10 @@ _template_then_git_repo() {
287284
if ! echo "$yn" | grep -qi "^n"; then
288285
if [ "$templatetype" = 0 ]; then
289286
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*mage$\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | grep -v \"$response\" | head -1"
290-
_template_test_github_url_if_torsocks_exists
287+
_template_test_github_url
291288
elif [ "$templatetype" = 2 ]; then
292289
GHURLPREVIEW_COMMAND="$CURL_COMMAND_REF_PREVIEW/$RESPONSE/releases$setlatest | sed 's/[()\",{} ]/\n/g' | grep -oi \"https.*\" | grep -vi \"i386\|i686\|aarch64\|arm64\|armv7l\" | grep -v \"$response\" | head -1"
293-
_template_test_github_url_if_torsocks_exists
290+
_template_test_github_url
294291
fi
295292
echo -e "\n The URL above is an example of what both\n the install and update scripts will point to.\n"
296293
fi
Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,59 @@
11
#!/bin/sh
22

33
# AM INSTALL SCRIPT VERSION 3.5
4-
set -u
54
APP=appimageupdatetool
6-
SITE="AppImage/AppImageUpdate"
5+
SITE1="pkgforge-dev/AppImageUpdate"
6+
SITE2="AppImage/AppImageUpdate"
77

88
# CREATE DIRECTORIES AND ADD REMOVER
99
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
10-
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
10+
printf "#!/bin/sh\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
1111
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
1212
chmod a+x ../remove || exit 1
1313

14-
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15-
version=$(curl -Ls https://api.github.com/repos/AppImage/AppImageUpdate/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -i "aarch64\|arm64" | grep -i "appimageupdatetool" | head -1)
16-
wget "$version" || exit 1
17-
# Keep this space in sync with other installation scripts
18-
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
14+
# CHOOSE A VERSION
15+
read -r -p "
16+
Choose which version of appimageupdatetool AppImage to use:
17+
18+
1. Fork with rate-limit-bypass & misc QOL changes, it works
19+
on more distros than the official release (recommended)
20+
21+
Source: https://github.com/pkgforge-dev/AppImageUpdate
22+
23+
2. Official release
24+
25+
Source: https://github.com/AppImage/AppImageUpdate
26+
27+
Which version you choose (type a number and press ENTER)?" response
28+
case "$response" in
29+
1) rm -f /opt/"$APP"/version
30+
UPDATER=1
31+
version=$(curl -Ls https://api.github.com/repos/"$SITE1"/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*mage$' | grep -i "aarch64\|arm64" | head -1)
32+
wget "$version"
33+
echo "$version" >> /opt/$APP/version;;
34+
2) rm -f /opt/"$APP"/version
35+
version=$(curl -Ls https://api.github.com/repos/"$SITE2"/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*mage$' | grep -i "aarch64\|arm64" | head -1)
36+
UPDATER=2
37+
wget "$version"
38+
echo "$version" >> /opt/$APP/version;;
39+
*) /opt/"$APP"/remove && exit;;
40+
esac
1941
cd ..
2042
mv ./tmp/*mage ./"$APP"
21-
# Keep this space in sync with other installation scripts
2243
rm -R -f ./tmp || exit 1
23-
echo "$version" > ./version
2444
chmod a+x ./"$APP" || exit 1
2545

26-
# LINK TO PATH
46+
# LINK
2747
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
2848

2949
# SCRIPT TO UPDATE THE PROGRAM
3050
cat >> ./AM-updater << 'EOF'
3151
#!/bin/sh
3252
set -u
3353
APP=appimageupdatetool
34-
SITE="AppImage/AppImageUpdate"
54+
if [ -z "$APP" ]; then exit 1; fi
3555
version0=$(cat "/opt/$APP/version")
36-
version=$(curl -Ls https://api.github.com/repos/AppImage/AppImageUpdate/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -i "aarch64\|arm64" | grep -i "appimageupdatetool" | head -1)
56+
version=$(curl -Ls https://api.github.com/repos/$SITE/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*mage$' | grep -i "aarch64\|arm64" | head -1)
3757
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
3858
if command -v appimageupdatetool >/dev/null 2>&1; then
3959
cd "/opt/$APP" || exit 1
@@ -54,5 +74,10 @@ else
5474
echo "Update not needed!"
5575
fi
5676
EOF
77+
if [ "$UPDATER" = "1" ]; then
78+
sed -i 's#$SITE#pkgforge-dev/AppImageUpdate#g' /opt/"$APP"/AM-updater
79+
elif [ "$UPDATER" = "2" ]; then
80+
sed -i 's#$SITE#AppImage/AppImageUpdate#g' /opt/"$APP"/AM-updater
81+
fi
5782
chmod a+x ./AM-updater || exit 1
5883

programs/x86_64/appimageupdatetool

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,59 @@
11
#!/bin/sh
22

33
# AM INSTALL SCRIPT VERSION 3.5
4-
set -u
54
APP=appimageupdatetool
6-
SITE="AppImage/AppImageUpdate"
5+
SITE1="pkgforge-dev/AppImageUpdate"
6+
SITE2="AppImage/AppImageUpdate"
77

88
# CREATE DIRECTORIES AND ADD REMOVER
99
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
10-
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
10+
printf "#!/bin/sh\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
1111
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
1212
chmod a+x ../remove || exit 1
1313

14-
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15-
version=$(curl -Ls https://api.github.com/repos/AppImage/AppImageUpdate/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "appimageupdatetool.*x86_64" | head -1)
16-
wget "$version" || exit 1
17-
# Keep this space in sync with other installation scripts
18-
# Use tar fx ./*tar* here for example in this line in case a compressed file is downloaded.
14+
# CHOOSE A VERSION
15+
read -r -p "
16+
Choose which version of appimageupdatetool AppImage to use:
17+
18+
1. Fork with rate-limit-bypass & misc QOL changes, it works
19+
on more distros than the official release (recommended)
20+
21+
Source: https://github.com/pkgforge-dev/AppImageUpdate
22+
23+
2. Official release
24+
25+
Source: https://github.com/AppImage/AppImageUpdate
26+
27+
Which version you choose (type a number and press ENTER)?" response
28+
case "$response" in
29+
1) rm -f /opt/"$APP"/version
30+
UPDATER=1
31+
version=$(curl -Ls https://api.github.com/repos/"$SITE1"/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*86_64.*mage$' | head -1)
32+
wget "$version"
33+
echo "$version" >> /opt/$APP/version;;
34+
2) rm -f /opt/"$APP"/version
35+
version=$(curl -Ls https://api.github.com/repos/"$SITE2"/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*86_64.*mage$' | head -1)
36+
UPDATER=2
37+
wget "$version"
38+
echo "$version" >> /opt/$APP/version;;
39+
*) /opt/"$APP"/remove && exit;;
40+
esac
1941
cd ..
2042
mv ./tmp/*mage ./"$APP"
21-
# Keep this space in sync with other installation scripts
2243
rm -R -f ./tmp || exit 1
23-
echo "$version" > ./version
2444
chmod a+x ./"$APP" || exit 1
2545

26-
# LINK TO PATH
46+
# LINK
2747
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
2848

2949
# SCRIPT TO UPDATE THE PROGRAM
3050
cat >> ./AM-updater << 'EOF'
3151
#!/bin/sh
3252
set -u
3353
APP=appimageupdatetool
34-
SITE="AppImage/AppImageUpdate"
54+
if [ -z "$APP" ]; then exit 1; fi
3555
version0=$(cat "/opt/$APP/version")
36-
version=$(curl -Ls https://api.github.com/repos/AppImage/AppImageUpdate/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*mage$" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "appimageupdatetool.*x86_64" | head -1)
56+
version=$(curl -Ls https://api.github.com/repos/$SITE/releases | sed 's/[()",{} ]/\n/g' | grep -io 'https.*appimageupdatetool.*86_64.*mage$' | head -1)
3757
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
3858
if command -v appimageupdatetool >/dev/null 2>&1; then
3959
cd "/opt/$APP" || exit 1
@@ -54,5 +74,10 @@ else
5474
echo "Update not needed!"
5575
fi
5676
EOF
77+
if [ "$UPDATER" = "1" ]; then
78+
sed -i 's#$SITE#pkgforge-dev/AppImageUpdate#g' /opt/"$APP"/AM-updater
79+
elif [ "$UPDATER" = "2" ]; then
80+
sed -i 's#$SITE#AppImage/AppImageUpdate#g' /opt/"$APP"/AM-updater
81+
fi
5782
chmod a+x ./AM-updater || exit 1
5883

0 commit comments

Comments
 (0)