1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/icecoder_ynh.git synced 2024-09-03 19:26:10 +02:00
icecoder_ynh/scripts/install
2022-03-28 08:19:49 +02:00

64 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app_id=$YNH_APP_ARG_APP_ID
sub_folder=$YNH_APP_ARG_SUB_FOLDER
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
final_path=$(ynh_app_setting_get --app=$app_id --key=final_path)$sub_folder/icecoder
test -e "$(ynh_app_setting_get --app=$app_id --key=final_path)" || ynh_die --message="You don't have installed $app_id before installing this app"
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=app_id --value=$app_id
ynh_app_setting_set --app=$app --key=sub_folder --value=$sub_folder
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
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"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app_id:www-data "$final_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"