mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Use = intead of space for helper args to avoid issue with parameter
This commit is contained in:
parent
236ec092d5
commit
f7c3546bc8
7 changed files with 44 additions and 44 deletions
|
@ -90,9 +90,9 @@ set_permission() {
|
|||
|
||||
clean_url_in_db_config() {
|
||||
sql_request='DELETE FROM `constance_config` WHERE `constance_key`= "SERVICE_URL"'
|
||||
ynh_mysql_execute_as_root --sql "$sql_request" --database seahubdb
|
||||
ynh_mysql_execute_as_root --sql="$sql_request" --database=seahubdb
|
||||
sql_request='DELETE FROM `constance_config` WHERE `constance_key`= "FILE_SERVER_ROOT"'
|
||||
ynh_mysql_execute_as_root --sql "$sql_request" --database seahubdb
|
||||
ynh_mysql_execute_as_root --sql="$sql_request" --database=seahubdb
|
||||
}
|
||||
|
||||
ensure_vars_set() {
|
||||
|
|
|
@ -23,23 +23,23 @@ fi
|
|||
|
||||
# # Backup app files
|
||||
ynh_print_info --message="Backing up code..."
|
||||
ynh_backup --src_path "$install_dir"
|
||||
ynh_backup --src_path="$install_dir"
|
||||
ynh_print_info --message="Backing up user data..."
|
||||
ynh_backup --src_path="$data_dir" --dest_path="data" --is_big=1
|
||||
ynh_print_info --message="Backing up configuration..."
|
||||
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/${app}.conf"
|
||||
ynh_backup --src_path /etc/systemd/system/seafile.service
|
||||
ynh_backup --src_path /etc/systemd/system/seahub.service
|
||||
ynh_backup --src_path /etc/fail2ban/jail.d/"$app".conf
|
||||
ynh_backup --src_path /etc/fail2ban/filter.d/"$app".conf
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/${app}.conf"
|
||||
ynh_backup --src_path=/etc/systemd/system/seafile.service
|
||||
ynh_backup --src_path=/etc/systemd/system/seahub.service
|
||||
ynh_backup --src_path=/etc/fail2ban/jail.d/"$app".conf
|
||||
ynh_backup --src_path=/etc/fail2ban/filter.d/"$app".conf
|
||||
|
||||
# Backup logs
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
|
||||
# Backup mysql
|
||||
ynh_print_info --message="Backing up database"
|
||||
ynh_mysql_dump_db --database "$db_name" > "${YNH_CWD}"/seafiledb.dmp
|
||||
ynh_mysql_dump_db --database ccnetdb > "${YNH_CWD}"/ccnetdb.dmp
|
||||
ynh_mysql_dump_db --database seahubdb > "${YNH_CWD}"/seahubdb.dmp
|
||||
ynh_mysql_dump_db --database="$db_name" > "${YNH_CWD}"/seafiledb.dmp
|
||||
ynh_mysql_dump_db --database=ccnetdb > "${YNH_CWD}"/ccnetdb.dmp
|
||||
ynh_mysql_dump_db --database=seahubdb > "${YNH_CWD}"/seahubdb.dmp
|
||||
|
||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -35,8 +35,8 @@ ynh_change_url_nginx_config
|
|||
ynh_script_progression --message="Stoping services..."
|
||||
|
||||
# Stop service before any change
|
||||
ynh_systemd_action --service_name seafile --action stop
|
||||
ynh_systemd_action --service_name seahub --action stop
|
||||
ynh_systemd_action --service_name=seafile --action=stop
|
||||
ynh_systemd_action --service_name=seahub --action=stop
|
||||
sleep 2
|
||||
pkill -f seafile-controller || true
|
||||
pkill -f seaf-server || true
|
||||
|
@ -63,8 +63,8 @@ sleep 2
|
|||
|
||||
# Reload services
|
||||
ynh_script_progression --message="Starting services..."
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
ynh_systemd_action --service_name=seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name=seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time=--last
|
||||
|
|
|
@ -43,14 +43,14 @@ install_dependance
|
|||
# init databases
|
||||
ynh_script_progression --message="Configuring MySQL database..."
|
||||
db_user=seafile
|
||||
ynh_''mysql_setup_db --db_user "$db_user" --db_name ccnetdb --db_pwd "$db_pwd"
|
||||
ynh_''mysql_setup_db --db_user "$db_user" --db_name seahubdb --db_pwd "$db_pwd"
|
||||
ynh_''mysql_setup_db --db_user="$db_user" --db_name=ccnetdb --db_pwd="$db_pwd"
|
||||
ynh_''mysql_setup_db --db_user="$db_user" --db_name=seahubdb --db_pwd="$db_pwd"
|
||||
|
||||
ynh_script_progression --message="Configuring application..." --weight=3
|
||||
|
||||
# Run install script
|
||||
set_permission
|
||||
ynh_replace_special_string --match_string 'seafile_config.seafile_dir = seafile_config.validate_seafile_dir(seafile_dir)' \
|
||||
ynh_replace_special_string --match_string='seafile_config.seafile_dir = seafile_config.validate_seafile_dir(seafile_dir)' \
|
||||
--replace_string 'seafile_config.seafile_dir = seafile_dir' \
|
||||
--target_file "$install_dir/seafile-server-$seafile_version/setup-seafile-mysql.py"
|
||||
sudo -u "$app" bash "$install_dir/seafile-server-$seafile_version/setup-seafile-mysql.sh" auto \
|
||||
|
@ -68,7 +68,7 @@ sudo -u "$app" bash "$install_dir/seafile-server-$seafile_version/setup-seafile-
|
|||
|
||||
# Retrive values from auto generated config file
|
||||
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' "$install_dir"/conf/seahub_settings.py | cut -d'"' -f2)
|
||||
ynh_app_setting_set --app "$app" --key seahub_secret_key --value "$seahub_secret_key"
|
||||
ynh_app_setting_set --app="$app" --key=seahub_secret_key --value="$seahub_secret_key"
|
||||
|
||||
# Update seafile config files
|
||||
ynh_add_jinja_config --template=seahub_settings.py --destination="$install_dir"/conf/seahub_settings.py
|
||||
|
@ -80,10 +80,10 @@ ynh_add_config --template=seafevents.conf --destination="$install_dir"/conf/seaf
|
|||
|
||||
# Configure admin info
|
||||
# It will be used the first start
|
||||
admin_email=$(ynh_user_get_info --username "$admin" --key 'mail')
|
||||
admin_email=$(ynh_user_get_info --username="$admin" --key='mail')
|
||||
cp ../conf/create_admin.json $install_dir/conf/admin.txt
|
||||
ynh_replace_string --match_string __ADMIN__ --replace_string "$admin_email" --target_file $install_dir/conf/admin.txt
|
||||
ynh_replace_special_string --match_string __PASSWORD__ --replace_string "$admin_password" --target_file $install_dir/conf/admin.txt
|
||||
ynh_replace_string --match_string=__ADMIN__ --replace_string="$admin_email" --target_file=$install_dir/conf/admin.txt
|
||||
ynh_replace_special_string --match_string=__PASSWORD__ --replace_string="$admin_password" --target_file=$install_dir/conf/admin.txt
|
||||
|
||||
# Use symlink to store data
|
||||
if [ -e "$install_dir"/seafile-data ]; then
|
||||
|
@ -103,12 +103,12 @@ ln -s "$data_dir"/seahub-data "$install_dir"/seahub-data
|
|||
ln -s /var/log/"$app" "$install_dir"/logs
|
||||
|
||||
# Fix local warning
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string ${LANG:-'en_US.UTF-8'} --target_file "$install_dir/seafile-server-$seafile_version/seahub.sh"
|
||||
ynh_replace_string --match_string=en_US.UTF-8 --replace_string=${LANG:-'en_US.UTF-8'} --target_file="$install_dir/seafile-server-$seafile_version/seahub.sh"
|
||||
|
||||
# Add Seafile Server to startup
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
ynh_add_systemd_config --service seafile --template seafile.service
|
||||
ynh_add_systemd_config --service seahub --template seahub.service
|
||||
ynh_add_systemd_config --service=seafile --template=seafile.service
|
||||
ynh_add_systemd_config --service=seahub --template=seahub.service
|
||||
|
||||
# register yunohost service
|
||||
yunohost service add seafile --description 'Main service for seafile server.'
|
||||
|
@ -138,9 +138,9 @@ set_permission
|
|||
sleep 3
|
||||
|
||||
ynh_script_progression --message="Starting seafile services..."
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name=seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
sleep 2
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
ynh_systemd_action --service_name=seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -20,8 +20,8 @@ seafile_version=$(ynh_app_upstream_version)
|
|||
ynh_script_progression --message="Stoping services..."
|
||||
|
||||
# Stop all services
|
||||
ynh_systemd_action --service_name seafile --action stop
|
||||
ynh_systemd_action --service_name seahub --action stop
|
||||
ynh_systemd_action --service_name=seafile --action=stop
|
||||
ynh_systemd_action --service_name=seahub --action=stop
|
||||
|
||||
# Force to kill all process in case of a process is not stoped cleanly
|
||||
pkill -f seafile-controller || true
|
||||
|
@ -45,8 +45,8 @@ $db_helper --db_name seahubdb --db_user seafile
|
|||
|
||||
# Remove systemd service
|
||||
ynh_script_progression --message="Removing systemd units..."
|
||||
ynh_remove_systemd_config --service seafile
|
||||
ynh_remove_systemd_config --service seahub
|
||||
ynh_remove_systemd_config --service=seafile
|
||||
ynh_remove_systemd_config --service=seahub
|
||||
|
||||
# Remove nginx config
|
||||
ynh_script_progression --message="Removing nginx configuration..."
|
||||
|
|
|
@ -42,7 +42,7 @@ su -c "mysql -u ${app} -p$db_pwd seahubdb < ${YNH_CWD}/seahubdb.dmp"
|
|||
# Add logrotate
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
mkdir -p /var/log/"$app"
|
||||
ynh_use_logrotate --logfile "$install_dir"/logs
|
||||
ynh_use_logrotate --logfile="$install_dir"/logs
|
||||
|
||||
# Set all permissions
|
||||
ynh_script_progression --message="Protecting directory..."
|
||||
|
@ -72,8 +72,8 @@ sleep 5
|
|||
|
||||
# Restart service
|
||||
ynh_script_progression --message="Starting seafile services..." --weight=3
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
ynh_systemd_action --service_name=seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name=seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
|
@ -24,8 +24,8 @@ install_pkg_conf
|
|||
|
||||
ynh_script_progression --message="Stoping services..."
|
||||
|
||||
ynh_systemd_action --service_name seafile --action stop
|
||||
ynh_systemd_action --service_name seahub --action stop
|
||||
ynh_systemd_action --service_name=seafile --action=stop
|
||||
ynh_systemd_action --service_name=seahub --action=stop
|
||||
sleep 5
|
||||
pkill -f seafile-controller || true
|
||||
pkill -f seaf-server || true
|
||||
|
@ -48,7 +48,7 @@ fi
|
|||
# Set missing settings
|
||||
if [ -z "${seahub_secret_key:-}" ]; then
|
||||
seahub_secret_key=$(grep -P 'SECRET_KEY\s*=\s*".+"' "$install_dir"/conf/seahub_settings.py | cut -d'"' -f2)
|
||||
ynh_app_setting_set --app "$app" --key seahub_secret_key --value "$seahub_secret_key"
|
||||
ynh_app_setting_set --app="$app" --key=seahub_secret_key --value="$seahub_secret_key"
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -176,7 +176,7 @@ ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.c
|
|||
ynh_add_config --template=seafevents.conf --destination="$install_dir"/conf/seafevents.conf
|
||||
|
||||
# Fix local warning
|
||||
ynh_replace_string --match_string en_US.UTF-8 --replace_string "${LANG:-'en_US.UTF-8'}" --target_file "$install_dir/seafile-server-$seafile_version/seahub.sh"
|
||||
ynh_replace_string --match_string=en_US.UTF-8 --replace_string="${LANG:-'en_US.UTF-8'}" --target_file="$install_dir/seafile-server-$seafile_version/seahub.sh"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -187,8 +187,8 @@ ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
|||
|
||||
# Add Seafile Server to startup
|
||||
ynh_script_progression --message="Updating systemd units..."
|
||||
ynh_add_systemd_config --service seafile --template seafile.service
|
||||
ynh_add_systemd_config --service seahub --template seahub.service
|
||||
ynh_add_systemd_config --service=seafile --template=seafile.service
|
||||
ynh_add_systemd_config --service=seahub --template=seahub.service
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -216,9 +216,9 @@ yunohost service add seahub --description 'Seafile server web interface.'
|
|||
# restart seafile server
|
||||
ynh_script_progression --message="Starting seafile services..." --weight=3
|
||||
sleep 5
|
||||
ynh_systemd_action --service_name memcached.service -p "systemd"
|
||||
ynh_systemd_action --service_name seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name seahub -l "Started Seafile hub." -p "systemd"
|
||||
ynh_systemd_action --service_name=memcached.service -p "systemd"
|
||||
ynh_systemd_action --service_name=seafile -l "spawned seaf-server, pid " -p /var/log/seafile/controller.log
|
||||
ynh_systemd_action --service_name=seahub -l "Started Seafile hub." -p "systemd"
|
||||
sleep 2
|
||||
|
||||
# remove old version files
|
||||
|
|
Loading…
Reference in a new issue