mirror of
https://github.com/YunoHost-Apps/timeoff_ynh.git
synced 2024-09-03 20:35:59 +02:00
Fix
This commit is contained in:
parent
75e3200800
commit
b2606b154f
5 changed files with 14 additions and 78 deletions
|
@ -24,7 +24,6 @@ app=$YNH_APP_INSTANCE_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)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
|
|
|
@ -80,16 +80,6 @@ ynh_script_progression --message="Configuring system user..."
|
|||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Creating a MySQL database..."
|
||||
|
||||
# db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
# db_user=$db_name
|
||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
# ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -102,21 +92,6 @@ ynh_setup_source --dest_dir=$final_path
|
|||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
#chmod -R +x "$final_path/bin"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
||||
mkdir -p $datadir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -146,7 +121,7 @@ ynh_script_progression --message="Installing TimeOff..."
|
|||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install
|
||||
ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install 2>/dev/null
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -41,14 +41,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Removing the MySQL database..."
|
||||
|
||||
# # Remove a database if it exists, along with the associated user
|
||||
# ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -84,8 +76,9 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE THE LOGROTATE CONFIG
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
|
||||
ynh_remove_logrotate # Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -26,8 +26,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -74,31 +72,6 @@ ynh_script_progression --message="Reinstalling dependencies..."
|
|||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORE
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND LOGROTATE
|
||||
#=================================================
|
||||
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/timeoff.log
|
||||
install_log=/var/log/$app/installation.log
|
||||
touch $install_log
|
||||
chown $app -R /var/log/$app
|
||||
chown admin -R $install_log
|
||||
|
||||
# Restore logrotate configuration
|
||||
ynh_restore_file "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..."
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -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)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -80,7 +79,7 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path" --feep="$final_path/config/app.json $final_path/config/db.json"
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config/app.json $final_path/config/db.json"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -109,27 +108,24 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading the lounge..."
|
||||
ynh_script_progression --message="Upgrading the TimeOff..."
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_npm cache clean
|
||||
ynh_exec_warn_less $ynh_npm update
|
||||
ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install 2>/dev/null
|
||||
ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run-script db-update 2>/dev/null
|
||||
popd
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modifying a config file..."
|
||||
# ynh_script_progression --message="Modifying a config file..."
|
||||
|
||||
ynh_add_config --template="../conf/app.json" --destination="$final_path/config/app.json"
|
||||
ynh_add_config --template="../conf/db.json" --destination="$final_path/config/db.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_use_logrotate --non-append
|
||||
# ynh_add_config --template="../conf/app.json" --destination="$final_path/config/app.json"
|
||||
# ynh_add_config --template="../conf/db.json" --destination="$final_path/config/db.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -146,7 +142,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Client Web IRC" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Manage employee absences" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
Loading…
Add table
Reference in a new issue