mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
use new helpers and fix install
This commit is contained in:
parent
d69542cba8
commit
bc6f2f88fa
2 changed files with 47 additions and 30 deletions
|
@ -1,12 +1,24 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Exit on command errors and treat unset variables as an error
|
#=================================================
|
||||||
set -eu
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
# Load common variables and helpers
|
source _common.sh
|
||||||
. ./_common.sh
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# Retrieve arguments
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
|
#=================================================
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path=${YNH_APP_ARG_PATH%/}
|
path=${YNH_APP_ARG_PATH%/}
|
||||||
admin_user=$YNH_APP_ARG_ADMIN
|
admin_user=$YNH_APP_ARG_ADMIN
|
||||||
|
@ -17,29 +29,18 @@ db_name=$app
|
||||||
|
|
||||||
FINAL_PATH="/var/www/$app"
|
FINAL_PATH="/var/www/$app"
|
||||||
|
|
||||||
# Source app helpers
|
# Normalize the url path syntax
|
||||||
. /usr/share/yunohost/helpers
|
path=$(ynh_normalize_url_path $path)
|
||||||
|
|
||||||
# if path do not begin with / add a / at the begining
|
|
||||||
if [ "${path:0:1}" != "/" ]; then
|
|
||||||
path="/$path"
|
|
||||||
fi
|
|
||||||
# if path do not end with / add a / at the end
|
|
||||||
if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then
|
|
||||||
path="${path:0:${#path}-1}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# keep domain for later
|
|
||||||
ynh_app_setting_set $app domain $domain
|
|
||||||
|
|
||||||
# Check user parameter if not empty
|
# Check user parameter if not empty
|
||||||
if [[ $admin_user != '' ]]; then
|
if [[ $admin_user != '' ]]; then
|
||||||
ynh_user_exists $admin_user || ynh_die "Wrong user"
|
ynh_user_exists $admin_user || ynh_die "Wrong user"
|
||||||
ynh_app_setting_set $app admin_user $admin_user
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check web path availability
|
||||||
sudo yunohost app register-url $app $domain $path
|
ynh_webpath_available $domain $path
|
||||||
|
# Register (book) web path
|
||||||
|
ynh_webpath_register $app $domain $path
|
||||||
|
|
||||||
#install php dependencies
|
#install php dependencies
|
||||||
install_freshrss_dependencies
|
install_freshrss_dependencies
|
||||||
|
@ -49,9 +50,13 @@ deskey=$(ynh_string_random)
|
||||||
db_pwd=$(ynh_string_random)
|
db_pwd=$(ynh_string_random)
|
||||||
app_salt=$(ynh_string_random)
|
app_salt=$(ynh_string_random)
|
||||||
|
|
||||||
|
# keep settings for later
|
||||||
|
ynh_app_setting_set $app domain $domain
|
||||||
|
ynh_app_setting_set $app admin_user $admin_user
|
||||||
|
ynh_app_setting_set "$app" mysqlpwd "$db_pwd"
|
||||||
|
|
||||||
# Initialize database and store mysql password for upgrade
|
# Initialize database and store mysql password for upgrade
|
||||||
ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd"
|
ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd"
|
||||||
ynh_app_setting_set "$app" mysqlpwd "$db_pwd"
|
|
||||||
|
|
||||||
# Copy files to the right place
|
# Copy files to the right place
|
||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
db_user=$app
|
db_user=$app
|
||||||
db_name=$app
|
db_name=$app
|
||||||
|
|
||||||
|
|
||||||
# Source app helpers
|
|
||||||
. /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
# retrieve useful param
|
# retrieve useful param
|
||||||
domain=$(ynh_app_setting_get $app domain)
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
path=$(ynh_app_setting_get $app path)
|
path=$(ynh_app_setting_get $app path)
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check web path availability
|
||||||
sudo yunohost app register-url $app $domain $path
|
ynh_webpath_available $domain $path
|
||||||
|
# Register (book) web path
|
||||||
|
ynh_webpath_register $app $domain $path
|
||||||
|
|
||||||
db_pass=$(ynh_app_setting_get $app mysqlpwd)
|
db_pass=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue