mirror of
https://github.com/YunoHost-Apps/retroarch_ynh.git
synced 2024-09-03 20:16:12 +02:00
131 lines
4.9 KiB
Bash
Executable file
131 lines
4.9 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
|
|
|
|
# Backup the current version of the app
|
|
#REMOVEME? ynh_backup_before_upgrade
|
|
#REMOVEME? ynh_clean_setup () {
|
|
# Restore it if the upgrade fails
|
|
#REMOVEME? ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
#REMOVEME? ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|
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="$install_dir"
|
|
#7z archive not handled by ynh and no way to strip component, have to move it manually
|
|
7zr x $install_dir/retroarch.7z -o$install_dir
|
|
#mv not working as target directory is not empty
|
|
cp -R $install_dir/retroarch/* $install_dir/
|
|
#REMOVEME? ynh_secure_remove --file="$install_dir/retroarch.7z"
|
|
#REMOVEME? ynh_secure_remove --file="$install_dir/retroarch"
|
|
touch $install_dir/analytics.js #https://github.com/libretro/RetroArch/issues/4539#issuecomment-473345195
|
|
#Get the indexer as exe so that folder w/ ROMs can be indexed
|
|
chmod +x $install_dir/indexer
|
|
fi
|
|
|
|
# SETUP CRON FILE FOR INDEXER
|
|
|
|
#setup indexer bash script
|
|
ynh_add_config --template="../conf/indexer.sh" --destination="$install_dir/indexer.sh"
|
|
chown www-data: $install_dir/indexer.sh
|
|
chmod 744 $install_dir/indexer.sh
|
|
#setup cron file
|
|
cron_path="/etc/cron.d/$app"
|
|
ynh_add_config --template="../conf/retroarch.cron" --destination="$cron_path"
|
|
chown root: "$cron_path"
|
|
chmod 644 "$cron_path"
|
|
|
|
#=================================================
|
|
#SETTING MULTIMEDIA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up Multimedia directory..." --weight=4
|
|
|
|
ynh_multimedia_build_main_dir
|
|
mkdir -p $install_dir/assets/cores/Game
|
|
ynh_multimedia_addfolder --source_dir="$install_dir/assets/cores/Game" --dest_dir="/share/Game"
|
|
ynh_add_config --template="../conf/README.GAME" --destination="$install_dir/assets/cores/Game/README"
|
|
chmod 666 $install_dir/assets/cores/Game/README
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# UPGRADE DEPENDENCIES
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=20
|
|
|
|
# Define and install dependencies
|
|
#Dependencies are not really required as this is just to unzip the 7z file
|
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
#However, npm IS required to run the coffeescript
|
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
|
ynh_use_nodejs
|
|
ynh_npm install -g coffeescript
|
|
|
|
#=================================================
|
|
# SPECIFIC UPGRADE
|
|
#=================================================
|
|
# Set permissions on app files
|
|
#=================================================
|
|
|
|
chown -R www-data: $install_dir
|
|
# Requested so that multimedia group can see the Game folder : all parent folder should be readable by others
|
|
chmod 751 $install_dir
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
|
|
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|