1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/simple-torrent_ynh.git synced 2024-09-03 20:26:18 +02:00

fix linter (#72)

This commit is contained in:
Éric Gaspar 2022-10-02 21:14:43 +02:00 committed by GitHub
parent 8e1d5077e8
commit 4704fee2a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 39 deletions

View file

@ -15,24 +15,3 @@
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
# Check the architecture
#
# example: architecture=$(ynh_detect_arch)
#
# usage: ynh_detect_arch
#
# Requires YunoHost version 2.2.4 or higher.
ynh_detect_arch() {
local architecture
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 86)" ]; then
architecture="i386"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="x86_64"
else
architecture="unknown"
fi
echo $architecture
}

View file

@ -23,7 +23,6 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
architecture=$(ynh_detect_arch)
app=$YNH_APP_INSTANCE_NAME
@ -32,11 +31,11 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
# Check machine architecture (in particular, we don't support ARM 32bit machines)
if [ $architecture == "unknown" ]
then
ynh_die --message="Sorry, this app cannot be installed on a 32-bit ARM machine."
fi
# Stop if architecture is 32-bit ARM
case $YNH_ARCH in
arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by $app. Aborting.";;
*) ;;
esac
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -86,11 +85,11 @@ ynh_script_progression --message="Setting up source files..." --weight=4
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="$architecture"
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH
pushd "$final_path"
gzip --decompress $(ynh_detect_arch).gz
mv $(ynh_detect_arch) $app
gzip --decompress $YNH_ARCH.gz
mv $YNH_ARCH $app
popd
chmod 750 "$final_path"

View file

@ -21,7 +21,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
peer_port=$(ynh_app_setting_get --app=$app --key=peer_port)
architecture=$(ynh_detect_arch)
#=================================================
# CHECK VERSION
@ -48,11 +47,10 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Check machine architecture (in particular, we don't support ARM 32bit machines)
if [ $architecture == "unknown" ]
then
ynh_die --message="Sorry, this app cannot be installed on a 32-bit ARM machine."
fi
case $YNH_ARCH in
arm|armhf) ynh_die --message="Sorry, your architecture $YNH_ARCH is not supported by $app. Aborting.";;
*) ;;
esac
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
@ -87,11 +85,11 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir=$final_path --source_id="$architecture" --keep="config.yml"
ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH --keep="config.yml"
pushd "$final_path"
gzip --decompress $(ynh_detect_arch).gz
mv $(ynh_detect_arch) $app
gzip --decompress $YNH_ARCH.gz
mv $YNH_ARCH $app
popd
fi