/ programs / x86_64 / fastfetch
fastfetch
 1  #!/bin/sh
 2  
 3  # AM INSTALL SCRIPT VERSION 3.5
 4  set -u
 5  APP=fastfetch
 6  SITE="fastfetch-cli/fastfetch"
 7  
 8  # CREATE DIRECTORIES AND ADD REMOVER
 9  [ -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/fastfetch\nrm -R -f /opt/$APP" > ../remove
11  printf '\n%s' "rm -f /usr/local/bin/flashfetch" >> ../remove
12  chmod a+x ../remove || exit 1
13  
14  # DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15  version=$(curl -Ls https://api.github.com/repos/fastfetch-cli/fastfetch/releases/latest | sed 's/[()",{} ]/\n/g' | grep -oi 'https.*linux-amd64.tar.gz$' | head -1)
16  wget "$version" || exit 1
17  [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
18  cd ..
19  mv ./tmp/*/usr/* ./ || exit 1
20  rm -R -f ./tmp || exit 1
21  echo "$version" > ./version
22  chmod a+x /opt/"$APP"/bin/* || exit 1
23  
24  # LINK TO PATH
25  ln -s /opt/"$APP"/bin/* /usr/local/bin
26  
27  # SCRIPT TO UPDATE THE PROGRAM
28  cat >> ./AM-updater << 'EOF'
29  #!/bin/sh
30  set -u
31  APP=fastfetch
32  SITE="fastfetch-cli/fastfetch"
33  version0=$(cat "/opt/$APP/version")
34  version=$(curl -Ls https://api.github.com/repos/fastfetch-cli/fastfetch/releases/latest | sed 's/[()",{} ]/\n/g' | grep -oi 'https.*linux-amd64.tar.gz$' | head -1)
35  [ -n "$version" ] || { echo "Error getting link"; exit 1; }
36  if [ "$version" != "$version0" ]; then
37  	mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
38  	notify-send "A new version of $APP is available, please wait"
39  	wget "$version" || exit 1
40  	[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
41  	cd ..
42  	mv --backup=t ./tmp/*/usr/* ./ || exit 1
43  	chmod a+x /opt/"$APP"/bin/* || exit 1
44  	echo "$version" > ./version
45  	rm -R -f ./tmp ./*~
46  	notify-send "$APP is updated!"
47  else
48  	echo "Update not needed!"
49  fi
50  EOF
51  chmod a+x ./AM-updater || exit 1