-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_appimage
executable file
·139 lines (90 loc) · 3.08 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
#
# tarball2appimage by LinuxDicasPro
#
####################################
destdir=~/__APPIMAGE__
test -e "../_APPIMAGE" && destdir="../_APPIMAGE" # Opcional
###########################################
arch="x86_64"
prg="4kvideodownloaderplus"
link="https://www.4kdownload.com/downloads"
###########################################
for i in {1..35}; { printf '─'; }; printf "\n"
printf "Search latest version: "
########
version="$(grep -Eom1 "([0-9]+[.]){2}[0-9]+" <(grep -A5 " 4K Video Downloader Plus" <(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://dl.4kdownload.com/app/4kvideodownloaderplus_${version}_amd64.tar.bz2"
link_svg="https://static.4kdownload.com/main/img/redesign/videodownloader.a855bb9dddb2.svg"
#########
wget -c -q --show-progress "$link_prg"
file_prg=${link_prg##*/}
cwd=$PWD
rm -rf "$prg.AppDir"
mkdir -p "$prg.AppDir"
cd "$prg.AppDir"
echo -e "\nextract $file_prg ..."
printf "$file_prg\t["
tar -jxf "$cwd/$file_prg" --checkpoint=500 --checkpoint-action=exec='printf ='
echo -e "]\n"
wget -c -q --show-progress -O "$prg.svg" "$link_svg"
####################################
appimage_name="4k Video Downloader Plus"
comment="Video Downloader"
categories="Network;"
####################################
echo "[Desktop Entry]
Name=$appimage_name
GenericName=$appimage_name
Comment=$comment
Exec=$prg
Icon=$prg
Type=Application
Terminal=false
Categories=$categories" > "$prg.desktop"
echo "#!/bin/bash
cd \$APPDIR
desktopfile=~/.local/share/applications/$prg.desktop
iconfile=~/.local/share/pixmaps/$prg.svg
test ! -e \"\$desktopfile\" && cp $prg.desktop ~/.local/share/applications/
test ! -e \"\$iconfile\" && cp $prg.svg ~/.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
cd \$APPDIR/$prg
./$prg.sh" > AppRun
chmod +x AppRun
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