/ programs / x86_64 / celeste64
celeste64
 1  #!/bin/sh
 2  
 3  # AM INSTALL SCRIPT VERSION 3. 
 4  set -u
 5  APP=celeste64
 6  SITE="ExOK/Celeste64"
 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=$(curl -Ls https://api.github.com/repos/ExOK/Celeste64/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "linux-x64.zip" | head -1)
16  wget "$version" || exit 1
17  [ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
18  [ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
19  [ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
20  cd ..
21  if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
22  rm -R -f ./tmp || exit 1
23  echo "$version" > ./version
24  
25  # LINK TO PATH
26  ln -s "/opt/$APP/Celeste64" "/usr/local/bin/$APP"
27  
28  # SCRIPT TO UPDATE THE PROGRAM
29  cat >> ./AM-updater << 'EOF'
30  #!/bin/sh
31  set -u
32  APP=celeste64
33  SITE="ExOK/Celeste64"
34  version0=$(cat "/opt/$APP/version")
35  version=$(curl -Ls https://api.github.com/repos/ExOK/Celeste64/releases | sed 's/[()",{} ]/\n/g' | grep -oi "https.*" | grep -vi "i386\|i686\|aarch64\|arm64\|armv7l" | grep -i "linux-x64.zip" | head -1)
36  [ -n "$version" ] || { echo "Error getting link"; exit 1; }
37  if [ "$version" != "$version0" ]; then
38  	mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
39  	notify-send "A new version of $APP is available, please wait"
40  	wget "$version" || exit 1
41  	[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
42  	[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
43  	[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
44  	cd ..
45  	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
46  	echo "$version" > ./version
47  	rm -R -f ./tmp ./*~
48  	notify-send "$APP is updated!"
49  else
50  	echo "Update not needed!"
51  fi
52  EOF
53  chmod a+x ./AM-updater || exit 1
54  
55  # ICON
56  mkdir -p icons
57  wget https://portable-linux-apps.github.io/icons/celeste64.png -O ./icons/"$APP" 2> /dev/null
58  
59  # LAUNCHER
60  echo "[Desktop Entry]
61  Name=
62  Exec=$APP
63  Icon=/opt/$APP/icons/$APP
64  Type=Application
65  Terminal=false
66  Categories=Utility;" > /usr/local/share/applications/"$APP"-AM.desktop