Comments (1)
Alright is ready.
@GeoBoi254 I'm testing an universal template that hopefully will make this easier, however here the success rate was 50%:
#!/bin/sh
# AM INSTALL SCRIPT VERSION 3.
set -u
APP=REPLACETHIS
SITE="REPO/APP"
# CREATE DIRECTORIES AND ADD REMOVER
[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > "/opt/$APP/remove"
#printf '\n%s' "rm -f /usr/share/applications/AM-$APP.desktop" >> "/opt/$APP/remove"
chmod a+x "/opt/$APP/remove"
# DOWNLOAD AND PREPARE THE APP, $version is also used for updates
version=$(curl -Ls https://api.github.com/repos/"$SITE"/releases | sed 's/[()",{} ]/\n/g' | grep -oiE "https.*$APP.*(x|d|86_)64.*(z$|ip$|$APP$)" | grep -vi "apple\|windows\|darwin" | head -1)
wget "$version" || exit 1
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
cd ..
if [ -d ./tmp/* 2>/dev/null ]; then mv ./tmp/*/* ./; else mv ./tmp/* ./"$APP" 2>/dev/null || mv ./tmp/* ./; fi
rm -R -f ./tmp || exit 1
echo "$version" > ./version
chmod a+x "/opt/$APP/$APP" || exit 1
# LINK TO PATH
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"
# SCRIPT TO UPDATE THE PROGRAM
cat >> "/opt/$APP/AM-updater" << 'EOF'
#!/bin/sh
set -u
APP=REPLACETHIS
SITE="REPO/APP"
version0=$(cat "/opt/$APP/version")
version=$(curl -Ls https://api.github.com/repos/"$SITE"/releases | sed 's/[()",{} ]/\n/g' | grep -oiE "https.*$APP.*(x|d|86_)64.*(z$|ip$|$APP$)" | grep -vi "apple\|windows\|darwin" | head -1)
[ -n "$version" ] || { echo "Error getting link"; exit 1; }
if [ "$version" != "$version0" ]; then
mkdir "/opt/$APP/tmp" && cd "/opt/$APP/tmp" || exit 1
notify-send "A new version of $APP is available, please wait"
wget "$version" || exit 1
[ -e ./*7z ] && 7z x ./*7z && rm -f ./*7z
[ -e ./*tar.* ] && tar fx ./*tar.* && rm -f ./*tar.*
[ -e ./*zip ] && unzip -qq ./*zip 1>/dev/null && rm -f ./*zip
cd ..
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
chmod a+x "/opt/$APP/$APP" || exit 1
echo "$version" > ./version
rm -R -f ./tmp ./*~
notify-send "$APP is updated!"
exit 0
fi
echo "Update not needed!"
EOF
chmod a+x "/opt/$APP/AM-updater"
Example for fixit
you only have to replace APP
and SITE
for this:
APP=fixit
SITE="eugene-babichenko/fixit"
And same thing in the updater part:
APP=fixit
SITE="eugene-babichenko/fixit"
You can test this by copying the script to $HOME, and then simply run appman -i ./script
and hopefully it will install, if it does you can PR the script or open an issue with it so that it can be added.
The apps in red were the ones where the script needed extra changes, all those cases was with how the url is gotten, nothing else in the script needed to be changed.
from am.
Related Issues (20)
- Apps HOT 15
- Cannot remove apps HOT 29
- Apps HOT 6
- Option to skip _patch_bashrc_and_profile #705 HOT 7
- Appimages HOT 1
- App HOT 12
- genact wrong version HOT 2
- Apps HOT 9
- Apps HOT 16
- Sandbox problems due to an incompatible Aisap release: workaround! HOT 1
- [REQUEST] Yandex AppImage HOT 15
- Some notes HOT 4
- Support aarch64, i686... and others
- Apps HOT 4
- Ma se non trova /usr/local/share/apllications perché non se lo crea?.A parte questo geniale! HOT 2
- "Apparmor" issues in newer Ubuntu releases (NOTE, this discussion is also in "italian" language, but you can join in English and use a translator) HOT 1
- Il menù di Cinnamon non trova i .desktop in /usr/local/share/applications/ ma è un problema di Cinnamon. HOT 11
- Unable to move .desktop file when installing an application HOT 2
- music assistant HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from am.