mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Upgrade to 1.1.7
This commit is contained in:
parent
3e89263c93
commit
b1a46b14a7
14 changed files with 109 additions and 447 deletions
|
@ -25,7 +25,7 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post
|
|||
- Tootdon (Android + iOS)
|
||||
- Tootle (iOS)
|
||||
|
||||
**Shipped version:** 1.1.6
|
||||
**Shipped version:** 1.1.7
|
||||
|
||||
## Important points to read before installing
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78966/artifacts/download
|
||||
SOURCE_SUM=62486afa30cfe06e5b5d0b36165315c2e1f6aa11c47bccf56e95c442ea804619
|
||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84826/artifacts/download
|
||||
SOURCE_SUM=aeb527340dbecc5056cd3aca459ed0a0f3b41808afc492e61f998032e5c3d874
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=pleroma-v1.1.6-arm.zip
|
||||
SOURCE_FILENAME=pleroma-v1.1.7-arm.zip
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78968/artifacts/download
|
||||
SOURCE_SUM=59b652f0a437b57cbaa915ac62d7cc5d4f4077e1c9f30e5ea9437463d982c3dd
|
||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84828/artifacts/download
|
||||
SOURCE_SUM=74032e08b6f89321eb5545ff77fb0b1f142cba49c691d69316963d296d16b727
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=pleroma-v1.1.6-arm64.zip
|
||||
SOURCE_FILENAME=pleroma-v1.1.7-arm64.zip
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/78964/artifacts/download
|
||||
SOURCE_SUM=9d19b8865e1ad6c916d08d644da58b76255f15d730d6c6a54e783d8558c9eeca
|
||||
SOURCE_URL=https://git.pleroma.social/pleroma/pleroma/-/jobs/84824/artifacts/download
|
||||
SOURCE_SUM=6cd69e80894af966bb88505dae572e197c96da02ba980357a606bcc948a78e36
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=zip
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=pleroma-v1.1.6-x86-64.zip
|
||||
SOURCE_FILENAME=pleroma-v1.1.7-x86-64.zip
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Pleroma is an OStatus-compatible social networking server written in Elixir, compatible with GNU Social and Mastodon",
|
||||
"fr": "Pleroma est un réseau social écrit en Elixir, compatible avec OStatus, GNU Social et Mastodon"
|
||||
},
|
||||
"version": "1.1.6~ynh1",
|
||||
"version": "1.1.7~ynh1",
|
||||
"url": "https://git.pleroma.social/pleroma/pleroma",
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": [
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="curl unzip libncurses5 postgresql postgresql-contrib"
|
||||
extra_pkg_dependencies="elixir erlang-dev erlang-tools erlang-parsetools erlang-eldap erlang-xmerl"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -29,7 +30,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)
|
||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
||||
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
|
@ -38,7 +38,7 @@ cache=$(ynh_app_setting_get --app=$app --key=cache)
|
|||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
|
@ -69,11 +69,11 @@ ynh_psql_dump_db --database="$db_name" > db.sql
|
|||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
# BACKUP CONFIG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up logrotate configuration..."
|
||||
ynh_print_info --message="Backing up configuration file..."
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
ynh_backup --src_path="/etc/$app/config.exs"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
|
@ -87,7 +87,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Running Pleroma.Web.Endpoint"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -57,7 +57,7 @@ fi
|
|||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source ynh_detect_arch__2
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -16,7 +15,6 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
read -p "key"
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
|
@ -81,7 +79,7 @@ ynh_app_setting_set --app=$app --key=signing_salt --value="$signing_salt"
|
|||
#=================================================
|
||||
ynh_print_info --message="Configuring firewall..."
|
||||
|
||||
# Find a free port
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
|
@ -92,9 +90,6 @@ ynh_print_info --message="Installing dependencies..."
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#lsb_name="$(lsb_release --codename --short)"
|
||||
#ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian $lsb_name contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc'
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -144,7 +139,7 @@ fi
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring system user ..."
|
||||
ynh_print_info --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
@ -157,7 +152,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
ynh_print_info --message="Create the data directory..."
|
||||
|
||||
# Define app's data directory
|
||||
datadir="/home/yunohost.app/${app}/storage"
|
||||
datadir="/home/yunohost.app/${app}"
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
|
@ -179,33 +174,6 @@ chown -R $app /etc/$app
|
|||
|
||||
config="/etc/$app/config.exs"
|
||||
|
||||
#cp -f ../conf/generated_config.exs $config
|
||||
|
||||
# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
#ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$config"
|
||||
#ynh_replace_string --match_string="__SIGNING_SALT__" --replace_string="$signing_salt" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
# ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$config"
|
||||
|
||||
#if [ $cache -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$config"
|
||||
#else
|
||||
# ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$config"
|
||||
#fi
|
||||
|
||||
# Set registrations open/closed
|
||||
#if [ $registration -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$config"
|
||||
#else
|
||||
# ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$config"
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
|
@ -222,7 +190,6 @@ ynh_add_systemd_config
|
|||
chown -R "$app":"$app" "$final_path"
|
||||
|
||||
pushd $final_path/$app
|
||||
#ynh_replace_string --match_string="_dir" --replace_string="" --target_file="/var/www/pleroma/pleroma/releases/1.1.2-2-g59d447d5-release-1-1-2/releases.exs"
|
||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \
|
||||
--output $config \
|
||||
--output-psql /tmp/setup_db.psql \
|
||||
|
@ -248,11 +215,6 @@ pushd $final_path/$app
|
|||
|
||||
# Add user
|
||||
su pleroma -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y"
|
||||
|
||||
#Generate key pair
|
||||
#sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs"
|
||||
#su pleroma -s $SHELL -lc "PLEROMA_CONFIG_PATH=$config $final_path/$app/bin/pleroma_ctl gen keypair" >> "$config"
|
||||
#ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$config"
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -272,26 +234,17 @@ ynh_store_file_checksum --file="$config"
|
|||
chown -R "$app":"$app" "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info --message="Configuring log rotation..."
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
#yunohost service add $app --log "/var/log/$app/APP.log"
|
||||
# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added
|
||||
yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log"
|
||||
yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="restart" --log_path=systemd --line_match="Started $app social network."
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -21,16 +21,16 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
if yunohost service status $app >/dev/null 2>&1
|
||||
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_print_info --message="Removing $app service..."
|
||||
yunohost service remove $app
|
||||
|
@ -77,14 +77,6 @@ ynh_print_info --message="Removing nginx web server configuration..."
|
|||
ynh_remove_nginx_config
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf"
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info --message="Removing logrotate configuration..."
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
@ -99,14 +91,14 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
# REMOVE DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Remove a directory securely
|
||||
# Remove the config directory securely
|
||||
ynh_secure_remove "/etc/$app/"
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove "/var/log/$app/"
|
||||
# Remove the data directory securely
|
||||
ynh_secure_remove "$datadir/"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source ../settings/scripts/ynh_add_extra_apt_repos__3
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -35,6 +35,7 @@ db_user=$db_name
|
|||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
cache=$(ynh_app_setting_get --app=$app --key=cache)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
|
@ -82,6 +83,29 @@ chown -R "$app":"$app" "$final_path"
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# RECREATE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_print_info --message="Recreate the data directory..."
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
mkdir -p "$datadir/uploads"
|
||||
mkdir -p "$datadir/static"
|
||||
mkdir -p "$datadir/static/emoji"
|
||||
|
||||
# Give permission to the datadir
|
||||
chown -R "$app":"$app" "$datadir"
|
||||
|
||||
ynh_app_setting_set --app=$app --key=datadir --value="$datadir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CONFIG FILE
|
||||
#=================================================
|
||||
ynh_print_info --message="Restoring the config file..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/$app/config.exs"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
|
@ -90,9 +114,6 @@ ynh_print_info --message="Reinstalling dependencies..."
|
|||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#lsb_name="$(lsb_release --codename --short)"
|
||||
#ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian $lsb_name contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc'
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -115,10 +136,10 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|||
systemctl enable $app.service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
yunohost service add $app --description "$app daemon for Pleroma" --log "/var/log/$app/$app.log"
|
||||
yunohost service add $app --description "$app daemon for Pleroma" --log_type "systemd"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -127,12 +148,6 @@ ynh_print_info --message="Starting a systemd service..."
|
|||
|
||||
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Running Pleroma.Web.Endpoint"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_package_version
|
||||
source ynh_detect_arch__2
|
||||
source ynh_add_extra_apt_repos__3
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -90,6 +90,7 @@ fi
|
|||
ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list"
|
||||
apt-key del A14F4FCA
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -105,21 +106,47 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# UPGRADE TO OTP RELEASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading to OTP release..."
|
||||
|
||||
if ynh_version_gt "1.1.1~ynh1" "${previous_version}" ; then
|
||||
# Define app's data directory
|
||||
datadir="/home/yunohost.app/${app}"
|
||||
ynh_app_setting_set --app=$app --key=datadir --value="$datadir"
|
||||
|
||||
# Create app folders
|
||||
mkdir -p "$datadir"
|
||||
mkdir -p "$datadir/uploads"
|
||||
mkdir -p "$datadir/static"
|
||||
mkdir -p "$datadir/static/emoji"
|
||||
|
||||
# Give permission to the datadir
|
||||
chown -R "$app":"$app" "$datadir"
|
||||
|
||||
mv $final_path/$app/uploads/* "$datadir/uploads"
|
||||
mv $final_path/$app/instance/static "$datadir/static"
|
||||
|
||||
ls -d $final_path/$app/priv/static/emoji/*/ | xargs -i sh -c 'mv "{}" "$datadir/static/emoji/$(basename {})"'
|
||||
mv $final_path/$app/priv/static/emoji /var/lib/pleroma/static/emoji
|
||||
|
||||
mkdir -p /etc/$app
|
||||
chown -R $app /etc/$app
|
||||
config="/etc/$app/config.exs"
|
||||
mv $final_path/$app/config/prod.secret.exs /etc/pleroma/config.exs
|
||||
|
||||
rm -r $final_path/$app/*
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped pleroma social network"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -162,9 +189,6 @@ ynh_print_info --message="Upgrading dependencies..."
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#lsb_name="$(lsb_release --codename --short)"
|
||||
#ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions.com/debian $lsb_name contrib" --package="$extra_pkg_dependencies" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc'
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -179,31 +203,9 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/$app/config/prod.secret.exs"
|
||||
cp -f ../conf/generated_config.exs "$final_path/$app/config/prod.secret.exs"
|
||||
config="/etc/$app/config.exs"
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__KEY__" --replace_string="$random_key" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__INSTANCE_NAME__" --replace_string="$name" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__ADMIN_EMAIL__" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
|
||||
if [ $cache -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
else
|
||||
ynh_replace_string --match_string="__MEDIA_CACHE__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
fi
|
||||
|
||||
# Set registrations open/closed
|
||||
if [ $registration -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="__REG__" --replace_string="true" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
else
|
||||
ynh_replace_string --match_string="__REG__" --replace_string="false" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
fi
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
#=================================================
|
||||
# MAKE UPGRADE
|
||||
|
@ -211,13 +213,10 @@ fi
|
|||
|
||||
# Give permission to the final_path
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
pushd $final_path/$app
|
||||
sudo -u "$app" MIX_ENV=prod mix deps.get
|
||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||
|
||||
#Generate key pair
|
||||
sudo -u "$app" MIX_ENV=prod mix web_push.gen.keypair >> "config/prod.secret.exs"
|
||||
ynh_replace_string --match_string="administrator@example.com" --replace_string="$admin_email" --target_file="$final_path/$app/config/prod.secret.exs"
|
||||
pushd $final_path/$app
|
||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl update"
|
||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate"
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
|
@ -225,15 +224,7 @@ popd
|
|||
#=================================================
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/$app/config/prod.secret.exs"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -265,7 +256,7 @@ then
|
|||
fi
|
||||
|
||||
#=================================================
|
||||
# START SERVICE
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Starting a systemd service..."
|
||||
|
||||
|
|
|
@ -1,294 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Pin a repository.
|
||||
#
|
||||
# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append]
|
||||
# | arg: -p, --package - Packages concerned by the pin. Or all, *.
|
||||
# | arg: -i, --pin - Filter for the pin.
|
||||
# | arg: -p, --priority - Priority for the pin
|
||||
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||
# | arg: -a, --append - Do not overwrite existing files.
|
||||
#
|
||||
# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning.
|
||||
#
|
||||
ynh_pin_repo () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=pirna
|
||||
declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append )
|
||||
local package
|
||||
local pin
|
||||
local priority
|
||||
local name
|
||||
local append
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
package="${package:-*}"
|
||||
priority=${priority:-50}
|
||||
name="${name:-$app}"
|
||||
append=${append:-0}
|
||||
|
||||
if [ $append -eq 1 ]
|
||||
then
|
||||
append="tee -a"
|
||||
else
|
||||
append="tee"
|
||||
fi
|
||||
|
||||
mkdir -p "/etc/apt/preferences.d"
|
||||
echo "Package: $package
|
||||
Pin: $pin
|
||||
Pin-Priority: $priority" \
|
||||
| $append "/etc/apt/preferences.d/$name"
|
||||
}
|
||||
|
||||
# Add a repository.
|
||||
#
|
||||
# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append]
|
||||
# | arg: -u, --uri - Uri of the repository.
|
||||
# | arg: -s, --suite - Suite of the repository.
|
||||
# | arg: -c, --component - Component of the repository.
|
||||
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||
# | arg: -a, --append - Do not overwrite existing files.
|
||||
#
|
||||
# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable
|
||||
# uri suite component
|
||||
# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable
|
||||
#
|
||||
ynh_add_repo () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=uscna
|
||||
declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append )
|
||||
local uri
|
||||
local suite
|
||||
local component
|
||||
local name
|
||||
local append
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
name="${name:-$app}"
|
||||
append=${append:-0}
|
||||
|
||||
if [ $append -eq 1 ]
|
||||
then
|
||||
append="tee -a"
|
||||
else
|
||||
append="tee"
|
||||
fi
|
||||
|
||||
mkdir -p "/etc/apt/sources.list.d"
|
||||
# Add the new repo in sources.list.d
|
||||
echo "deb $uri $suite $component" \
|
||||
| $append "/etc/apt/sources.list.d/$name.list"
|
||||
}
|
||||
|
||||
# Add an extra repository correctly, pin it and get the key.
|
||||
#
|
||||
# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append]
|
||||
# | arg: -r, --repo - Complete url of the extra repository.
|
||||
# | arg: -k, --key - url to get the public key.
|
||||
# | arg: -p, --priority - Priority for the pin
|
||||
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||
# | arg: -a, --append - Do not overwrite existing files.
|
||||
ynh_install_extra_repo () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=rkpna
|
||||
declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append )
|
||||
local repo
|
||||
local key
|
||||
local priority
|
||||
local name
|
||||
local append
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
name="${name:-$app}"
|
||||
append=${append:-0}
|
||||
key=${key:-0}
|
||||
priority=${priority:-}
|
||||
|
||||
if [ $append -eq 1 ]
|
||||
then
|
||||
append="--append"
|
||||
wget_append="tee -a"
|
||||
else
|
||||
append=""
|
||||
wget_append="tee"
|
||||
fi
|
||||
|
||||
# Split the repository into uri, suite and components.
|
||||
# Remove "deb " at the beginning of the repo.
|
||||
repo="${repo#deb }"
|
||||
|
||||
# Get the uri
|
||||
local uri="$(echo "$repo" | awk '{ print $1 }')"
|
||||
|
||||
# Get the suite
|
||||
local suite="$(echo "$repo" | awk '{ print $2 }')"
|
||||
|
||||
# Get the components
|
||||
local component="${repo##$uri $suite }"
|
||||
|
||||
# Add the repository into sources.list.d
|
||||
ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append
|
||||
|
||||
# Pin the new repo with the default priority, so it won't be used for upgrades.
|
||||
# Build $pin from the uri without http and any sub path
|
||||
local pin="${uri#*://}"
|
||||
pin="${pin%%/*}"
|
||||
# Set a priority only if asked
|
||||
if [ -n "$priority" ]
|
||||
then
|
||||
priority="--priority=$priority"
|
||||
fi
|
||||
ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append
|
||||
|
||||
# Get the public key for the repo
|
||||
if [ -n "$key" ]
|
||||
then
|
||||
mkdir -p "/etc/apt/trusted.gpg.d"
|
||||
wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null
|
||||
fi
|
||||
|
||||
# Update the list of package with the new repo
|
||||
ynh_package_update
|
||||
}
|
||||
|
||||
# Remove an extra repository and the assiociated configuration.
|
||||
#
|
||||
# usage: ynh_remove_extra_repo [--name=name]
|
||||
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||
ynh_remove_extra_repo () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=n
|
||||
declare -Ar args_array=( [n]=name= )
|
||||
local name
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
name="${name:-$app}"
|
||||
|
||||
ynh_secure_remove "/etc/apt/sources.list.d/$name.list"
|
||||
ynh_secure_remove "/etc/apt/preferences.d/$name"
|
||||
ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg"
|
||||
ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc"
|
||||
|
||||
# Update the list of package to exclude the old repo
|
||||
ynh_package_update
|
||||
}
|
||||
|
||||
# Install packages from an extra repository properly.
|
||||
#
|
||||
# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name]
|
||||
# | arg: -r, --repo - Complete url of the extra repository.
|
||||
# | arg: -p, --package - The packages to install from this extra repository
|
||||
# | arg: -k, --key - url to get the public key.
|
||||
# | arg: -n, --name - Name for the files for this repo, $app as default value.
|
||||
ynh_install_extra_app_dependencies () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=rpkn
|
||||
declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= )
|
||||
local repo
|
||||
local package
|
||||
local key
|
||||
local name
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
name="${name:-$app}"
|
||||
key=${key:-0}
|
||||
|
||||
# Set a key only if asked
|
||||
if [ -n "$key" ]
|
||||
then
|
||||
key="--key=$key"
|
||||
fi
|
||||
# Add an extra repository for those packages
|
||||
ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name
|
||||
|
||||
# Install requested dependencies from this extra repository.
|
||||
ynh_add_app_dependencies --package="$package"
|
||||
|
||||
# Remove this extra repository after packages are installed
|
||||
ynh_remove_extra_repo --name=$app
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies
|
||||
|
||||
# Define and install dependencies with a equivs control file
|
||||
# This helper can/should only be called once per app
|
||||
#
|
||||
# usage: ynh_install_app_dependencies dep [dep [...]]
|
||||
# | arg: dep - the package name to install in dependence
|
||||
# You can give a choice between some package with this syntax : "dep1|dep2"
|
||||
# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5"
|
||||
# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5)
|
||||
#
|
||||
# Requires YunoHost version 2.6.4 or higher.
|
||||
ynh_install_app_dependencies () {
|
||||
local dependencies=$@
|
||||
dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')"
|
||||
dependencies=${dependencies//|/ | }
|
||||
local manifest_path="../manifest.json"
|
||||
if [ ! -e "$manifest_path" ]; then
|
||||
manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
|
||||
fi
|
||||
|
||||
local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file.
|
||||
if [ ${#version} -eq 0 ]; then
|
||||
version="1.0"
|
||||
fi
|
||||
local dep_app=${app//_/-} # Replace all '_' by '-'
|
||||
|
||||
# Handle specific versions
|
||||
if [[ "$dependencies" =~ [\<=\>] ]]
|
||||
then
|
||||
# Replace version specifications by relationships syntax
|
||||
# https://www.debian.org/doc/debian-policy/ch-relationships.html
|
||||
# Sed clarification
|
||||
# [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice.
|
||||
# [\<=\>] matches < = or >
|
||||
# \+ matches one or more occurence of the previous characters, for >= or >>.
|
||||
# [^,]\+ matches all characters except ','
|
||||
# Ex: package>=1.0 will be replaced by package (>= 1.0)
|
||||
dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')"
|
||||
fi
|
||||
|
||||
cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build
|
||||
Section: misc
|
||||
Priority: optional
|
||||
Package: ${dep_app}-ynh-deps
|
||||
Version: ${version}
|
||||
Depends: ${dependencies}
|
||||
Architecture: all
|
||||
Description: Fake package for $app (YunoHost app) dependencies
|
||||
This meta-package is only responsible of installing its dependencies.
|
||||
EOF
|
||||
ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \
|
||||
|| ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies
|
||||
rm /tmp/${dep_app}-ynh-deps.control
|
||||
ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies"
|
||||
}
|
||||
|
||||
ynh_add_app_dependencies () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=pr
|
||||
declare -Ar args_array=( [p]=package= [r]=replace)
|
||||
local package
|
||||
local replace
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
replace=${replace:-0}
|
||||
|
||||
local current_dependencies=""
|
||||
if [ $replace -eq 0 ]
|
||||
then
|
||||
local dep_app=${app//_/-} # Replace all '_' by '-'
|
||||
if ynh_package_is_installed --package="${dep_app}-ynh-deps"
|
||||
then
|
||||
current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) "
|
||||
fi
|
||||
|
||||
current_dependencies=${current_dependencies// | /|}
|
||||
fi
|
||||
|
||||
ynh_install_app_dependencies "${current_dependencies}${package}"
|
||||
}
|
6
scripts/ynh_package_version
Normal file
6
scripts/ynh_package_version
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
ynh_version_gt ()
|
||||
{
|
||||
dpkg --compare-versions "$1" gt "$2"
|
||||
}
|
Loading…
Add table
Reference in a new issue