/
fastfetch
55 lines (45 loc) · 1.42 KB
/
fastfetch
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
#!/bin/sh
APP=fastfetch
SITE="fastfetch-cli/fastfetch"
# CREATE THE FOLDER
mkdir /opt/$APP
cd /opt/$APP
# ADD THE REMOVER
echo '#!/bin/sh' >> /opt/$APP/remove
echo "rm -R -f /opt/$APP /usr/local/bin/$APP /usr/local/bin/flashfetch" >> /opt/$APP/remove
chmod a+x /opt/$APP/remove
# DOWNLOAD THE ARCHIVE
mkdir tmp
cd ./tmp
version=$(curl -Ls https://api.github.com/repos/fastfetch-cli/fastfetch/releases | jq '.' | grep browser_download_url | grep -i linux-amd64.tar.gz | cut -d '"' -f 4 | head -1)
wget $version
echo "$version" >> /opt/$APP/version
tar fx ./*tar*; rm -R -f ./*tar*
cd ..
mv --backup=t ./tmp/*/usr/* ./
rm -R -f ./tmp
# LINK
ln -s /opt/$APP/bin/$APP /usr/local/bin/$APP; ln -s /opt/$APP/bin/flashfetch /usr/local/bin/flashfetch
# SCRIPT TO UPDATE THE PROGRAM
cat >> /opt/$APP/AM-updater << 'EOF'
#!/usr/bin/env bash
APP=fastfetch
version0=$(cat /opt/$APP/version)
version=$(curl -Ls https://api.github.com/repos/fastfetch-cli/fastfetch/releases | jq '.' | grep browser_download_url | grep -i linux-amd64.tar.gz | cut -d '"' -f 4 | head -1)
if [ $version = $version0 ]; then
echo "Update not needed!"
else
notify-send "A new version of $APP is available, please wait"
mkdir /opt/$APP/tmp
cd /opt/$APP/tmp
wget $version
tar fx ./*tar*; rm -R -f ./*tar*
cd ..
mv --backup=t ./tmp/*/usr/* ./
rm ./version
echo $version >> ./version
rm -R -f ./tmp ./*~
notify-send "$APP is updated!"
fi
EOF
chmod a+x /opt/$APP/AM-updater