Skip to content

Commit

Permalink
Normalization from example_ynh
Browse files Browse the repository at this point in the history
  • Loading branch information
maniackcrudelis committed May 9, 2019
1 parent 5f6bc6f commit db7a6ca
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 404 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ this package:

#### Supported architectures

* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ampache%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/ampache/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ampache%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ampache/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/ampache%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/ampache/)
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ampache%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/ampache/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ampache%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ampache/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/ampache%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/ampache/)

## Limitations

Expand Down Expand Up @@ -85,6 +85,7 @@ In fact, it can disrupt external Ampache clients like Subsonic.

* Report a bug: https://github.com/YunoHost-Apps/ampache_ynh/issues
* Ampache website: http://ampache.org/
* Ampache repository: https://github.com/ampache/ampache
* YunoHost website: https://yunohost.org/

---
Expand Down
10 changes: 0 additions & 10 deletions check_process
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,7 @@
incorrect_path=1
change_url=0
;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# https://github.com/YunoHost-Apps/ampache_ynh/blob/a8c53c080e1f42f1b876e60fd47fdae2d8b5bcd9/conf/ampache.cfg.php#L111-L116
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options
Email=aymhce@gmail.com
Notification=none
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"multi_instance": true,
"requirements": {
"yunohost": ">= 3.2.0"
"yunohost": ">= 3.5.0"
},
"services" : [
"nginx",
Expand Down
22 changes: 13 additions & 9 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,48 @@

# Execute a command with Composer
#
# usage: ynh_composer_exec [--workdir=$final_path] --commands="commands"
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands"
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=wc
declare -Ar args_array=( [w]=workdir= [c]=commands= )
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"

COMPOSER_HOME="$workdir/.composer" \
php "$workdir/composer.phar" $commands \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}

# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--workdir=$final_path]
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=w
declare -Ar args_array=( [w]=workdir= )
local legacy_args=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
local phpversion
local workdir
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}"

curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php -- --quiet --install-dir="$workdir" \
php${phpversion} -- --quiet --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."

# update dependencies to create composer.lock
ynh_composer_exec --workdir="$workdir" --commands="install --no-dev" \
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
|| ynh_die "Unable to update core dependencies with Composer."
}

Expand Down
213 changes: 0 additions & 213 deletions scripts/_getopts_fix.sh

This file was deleted.

27 changes: 13 additions & 14 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,46 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=2

app=$YNH_APP_INSTANCE_NAME

final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
db_name=$(ynh_app_setting_get $app db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)

#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info "Backing up the main app directory..."
ynh_script_progression --message="Backing up the main app directory..."

ynh_backup "$final_path"
ynh_backup --src_path="$final_path"

#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_script_progression --message="Backing up nginx web server configuration..."

ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"

#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info "Backing up php-fpm configuration..."
ynh_script_progression --message="Backing up php-fpm configuration..."

ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"

#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info "Backing up the MySQL database..."
ynh_script_progression --message="Backing up the MySQL database..."

ynh_mysql_dump_db "$db_name" > db.sql
ynh_mysql_dump_db --database="$db_name" > db.sql

#=================================================
# END OF SCRIPT
#=================================================

ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
Loading

0 comments on commit db7a6ca

Please sign in to comment.