1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gogs_ynh.git synced 2024-09-03 20:36:23 +02:00

Detect arch with uname, inspired by getcaddy.com

This commit is contained in:
mbugeia 2016-10-18 00:09:26 +02:00
parent 5f29a8f6a1
commit b30ec6b691
2 changed files with 14 additions and 12 deletions

View file

@ -47,7 +47,7 @@ Gogs v0.9.71
- [YunoHost forum thread](https://forum.yunohost.org/t/gogs-package-an-awesome-github-alternative/1127)
Architecture: this package is compatible with amd64, i386 and arm, the package will try to detect it with the command arch and fail if it can't find it. If that happen please open an issue describing your hardware and the result of the command `arch`.
Architecture: this package is compatible with amd64, i386 and arm, the package will try to detect it with the command uname -m and fail if it can't find it. If that happen please open an issue describing your hardware and the result of the command `uname -m`.
## License
Gogs is published under MIT License

View file

@ -8,17 +8,19 @@ APPNAME="gogs"
VERSION="0.9.71"
# Detect the system architecture to download the right tarball
case $(arch) in
x86_64) ARCHITECTURE="amd64"
;;
i386|i686) ARCHITECTURE="386"
;;
armhf|armel|armv7l) ARCHITECTURE="arm"
;;
*) echo 'Unable to detect your achitecture, please open a bug describing \
your hardware and the result of the command "arch".' && exit 1
;;
esac
# NOTE: `uname -m` is more accurate and universal than `arch`
# See https://en.wikipedia.org/wiki/Uname
if [ -n "$(uname -m | grep 64)" ]; then
ARCHITECTURE="amd64"
elif [ -n "$(uname -m | grep 86)" ]; then
ARCHITECTURE="386"
elif [ -n "$(uname -m | grep arm)" ]; then
ARCHITECTURE="arm"
else
echo 'Unable to detect your achitecture, please open a bug describing \
your hardware and the result of the command "uname -m".'
exit 1
fi
# Remote URL to fetch Gogs tarball
GOGS_BINARY_URL="https://github.com/gogits/gogs/releases/download/v${VERSION}/linux_${ARCHITECTURE}.zip"