-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_appimage
executable file
·120 lines (75 loc) · 2.66 KB
/
get_appimage
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
#!/bin/bash
#
# tarball2appimage by LinuxDicasPro
#
####################################
destdir=~/__APPIMAGE__
test -e "../_APPIMAGE" && destdir="../_APPIMAGE" # Opcional
###########################################
arch="x86_64"
prg="Upscayl"
link="https://github.com/upscayl/upscayl/releases"
###########################################
for i in {1..35}; { printf '─'; }; printf "\n"
printf "Search latest version: "
########
version="$(grep -Eom1 "([0-9]+[.]){2}[0-9]+" <(grep -A1 "Latest" <(links -dump "$link")))"
########
printf "\033[1;32m$version\033[m\n"
for i in {1..35}; { printf '─'; }; printf "\n"
test -z "$version" && {
echo "update script. version not found!"
exit 1
}
set -e
test ! -e $destdir && mkdir -p $destdir
cd $destdir
test -e "$prg-$version-$arch.AppImage" && {
echo "appimage found!"
exit 0
}
test ! -e "appimagetool-x86_64.AppImage" && {
link_tool="https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage"
wget -c -q --show-progress "$link_tool"
chmod +x "appimagetool-x86_64.AppImage"
}
#########
link_prg="https://github.com/upscayl/upscayl/releases/download/v${version}/upscayl-${version}-linux.AppImage"
#########
wget -c -q --show-progress "$link_prg"
file_prg=${link_prg##*/}
rm -rf "$prg.AppDir"
chmod +x $file_prg
./$file_prg --appimage-extract
mv squashfs-root "$prg.AppDir"
cd "$prg.AppDir"
mv AppRun AppRun-bak
echo "#!/bin/bash
cd \$APPDIR
desktopfile=~/.local/share/applications/upscayl.desktop
iconfile=~/.local/share/pixmaps/upscayl.png
test ! -e \"\$desktopfile\" && cp upscayl.desktop ~/.local/share/applications/
test ! -e \"\$iconfile\" && cp usr/share/icons/hicolor/1024x1024/apps/upscayl.png ~/.local/share/pixmaps/
if ! grep -q \"\$APPIMAGE\" \"\$desktopfile\"; then
sed -i \"s:Exec=.*:Exec=\$APPIMAGE:\" \"\$desktopfile\"
sed -i \"s:Icon=.*:Icon=\$iconfile:\" \"\$desktopfile\"
/usr/bin/update-desktop-database -q || true
test -e usr/share/icons/hicolor/icon-theme.cache && {
test -x /usr/bin/gtk-update-icon-cache && /usr/bin/gtk-update-icon-cache ~/.local/share/pixmaps/ 2>&1 >&- || true
}
fi
" > AppRun
cat AppRun-bak >> AppRun
chmod +x AppRun
####################################
appimage_name="Upscayl"
####################################
cd ..
printf "\n"; for ((i=0; i<$COLUMNS; i++)); { printf '─'; }; echo -e "\n"
env ARCH=$arch ./appimagetool-x86_64.AppImage "$prg.AppDir"
mv "${appimage_name// /_}-$arch.AppImage" "$prg-$version-$arch.AppImage"
printf "\n"; for ((i=0; i<$COLUMNS; i++)); { printf '─'; }; echo -e "\n"
rm -rf "$prg.AppDir"
cd ..
echo "appimage saved in $destdir/$prg-$version-$arch.AppImage"
exit 0