/ programs / x86_64 / exodus
exodus
 1  #!/bin/sh
 2  
 3  # AM INSTALL SCRIPT VERSION 3.5
 4  set -u
 5  APP=exodus
 6  SITE="https://exodus.com"
 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/$APP\nrm -R -f /opt/$APP" > ../remove
11  printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove
12  chmod a+x ../remove || exit 1
13  
14  # DOWNLOAD AND PREPARE THE APP, $version is also used for updates
15  version=$(wget -q https://aur.archlinux.org/packages/exodus -O - | tr '"' '\n' | grep "http" | grep ".zip$" | head -1)
16  if wget --version | head -1 | grep -q ' 1.'; then
17  	wget --user-agent="Mozilla/5.0" "$version" || exit 1
18  else
19  	wget "$version" || exit 1
20  fi
21  [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
22  [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
23  [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
24  cd ..
25  if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
26  rm -R -f ./tmp || exit 1
27  echo "$version" > ./version
28  chmod a+x "/opt/$APP/Exodus" || exit 1
29  
30  # LINK TO PATH
31  ln -s "/opt/$APP/Exodus" "/usr/local/bin/$APP"
32  
33  # SCRIPT TO UPDATE THE PROGRAM
34  cat >> ./AM-updater << 'EOF'
35  #!/bin/sh
36  set -u
37  APP=exodus
38  SITE="https://exodus.com"
39  version0=$(cat "/opt/$APP/version")
40  version=$(wget -q https://aur.archlinux.org/packages/exodus -O - | tr '"' '\n' | grep "http" | grep ".zip$" | head -1)
41  [ -n "$version" ] || { echo "Error getting link"; exit 1; }
42  if [ "$version" != "$version0" ]; then
43  	mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
44  	notify-send "A new version of $APP is available, please wait"
45  	if wget --version | head -1 | grep -q ' 1.'; then
46  		wget --user-agent="Mozilla/5.0" "$version" || exit 1
47  	else
48  		wget "$version" || exit 1
49  	fi
50  	[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
51  	[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
52  	[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
53  	cd ..
54  	if [ -d ./tmp/* 2>/dev/null ]; then mv --backup=t ./tmp/*/* ./; else mv --backup=t ./tmp/* ./"$APP" 2>/dev/null || mv --backup=t ./tmp/* ./; fi
55  	chmod a+x "/opt/$APP/Exodus || exit 1
56  	echo "$version" > ./version
57  	rm -R -f ./tmp ./*~
58  	notify-send "$APP is updated!"
59  	exit 0
60  fi
61  echo "Update not needed!"
62  EOF
63  chmod a+x ./AM-updater || exit 1
64  
65  # ICON
66  mkdir -p icons
67  cp ./bin/*.png -O ./icons/"$APP" 2> /dev/null
68  
69  # LAUNCHER
70  rm -f /usr/local/share/applications/"$APP"-AM.desktop
71  echo "[Desktop Entry]
72  Version=1.0
73  Type=Application
74  Name=Exodus
75  Exec=exodus %f
76  Icon=/opt/$APP/icons/$APP
77  Comment=All-in-one app to secure, manage and exchange blockchain assets
78  Categories=Utility;
79  Terminal=false
80  StartupNotify=true" >> /usr/local/share/applications/"$APP"-AM.desktop