1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jackett_ynh.git synced 2024-09-03 19:26:28 +02:00

Merge pull request #4 from YunoHost-Apps/architectures

Improve architecture detection
This commit is contained in:
Navan Chauhan 2021-05-26 11:21:08 +05:30 committed by GitHub
commit 9bfe8d694a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 7 deletions

View file

@ -4,15 +4,26 @@
# COMMON VARIABLES
#=================================================
architecture=$(dpkg --print-architecture)
if [ $architecture = "amd64" ]; then
architecture="x64"
fi
# Supported architectures
supported_architectures=("arm" "arm64" "x64")
#=================================================
# PERSONAL HELPERS
#=================================================
get_architecture() {
architecture=$(dpkg --print-architecture)
if [ $architecture = "amd64" ]; then
architecture="x64"
elif [[ $architecture = arm* ]] && [[ $(getconf LONG_BIT) = 32 ]]; then
architecture="arm"
elif [[ $architecture = arm* ]] && [[ $(getconf LONG_BIT) = 64 ]]; then
architecture="arm64"
elif [[ $(echo ${supported_architectures[@]} | grep -ow "$architecture" | wc -w) = 0 ]]; then
ynh_die --message="Unsupported architecture $architecture"
fi
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -70,6 +70,8 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
ynh_script_progression --message="Setting up source files..."
get_architecture
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --source_id="app.$architecture"

View file

@ -114,8 +114,10 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
get_architecture
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$final_path" --source_id="app.$architecture"
fi
# FIXME: this should be managed by the core in the future