Add Snikket custom steps

TODO:
- Apply patches
- Handle the rest of the tasks
This commit is contained in:
Norbi Peti 2024-05-22 23:20:14 +02:00
parent 28b4676bbf
commit 2464193a1c
4 changed files with 103 additions and 15 deletions

View file

@ -36,6 +36,9 @@ ram.runtime = "50M"
[resources.sources.prosody]
url = "https://hg.prosody.im/trunk/archive/41a587613a0e.tar.gz"
sha256 = "701ce4761b1979614712ac9c9c13cb700415469a8e11ed9e3140fd6795bbcdcd"
[resources.sources.prosody-modules]
url = "https://hg.prosody.im/prosody-modules/archive/095030677ae6.tar.gz"
sha256 = "8c2a51ef72cbe86a3b2a8e5c4d8656ee1d167f153223b481b5e8c4c5ed85f11d"
[resources.system_user]
@ -55,7 +58,7 @@ ram.runtime = "50M"
[resources.permissions]
[resources.apt]
packages = "libicu-dev, libidn11-dev, libssl-dev, openssl, txt2man"
packages = "libicu-dev, libidn11-dev, libssl-dev, openssl, txt2man, lua-luaossl, lua-readline, dns-root-data, lua-dbi-sqlite3"
packages_from_raw_bash = """
if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then
echo "lua5.2, lua5.2-expat, lua5.2-socket, lua5.2-sec, lua5.2-unbound, liblua5.2-dev, lua-busted";

View file

@ -26,13 +26,14 @@ fi
ynh_script_progression --message="Setting up source files..."
builddir="$(mktemp -d)"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$builddir" --source_id=prosody
snikketdir="$(mktemp -d)"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$snikketdir"
moddir="$(mktemp -d)"
ynh_setup_source --dest_dir="$moddir" --source_id=prosody-modules
#=================================================
# SPECIFIC SETUP
#=================================================
@ -43,9 +44,13 @@ ynh_script_progression --message="Building Prosody..."
update-alternatives --set lua-interpreter /usr/bin/lua${luaversion}
pushd "$builddir"
./configure --prefix=/usr
./configure --sysconfdir="/etc/$app" --datadir="/var/lib/$app"
make
make install
# Install Prosody-Migrator
pushd "tools/migration"
make install
popd
popd
ynh_secure_remove --file="$builddir"
@ -53,17 +58,18 @@ ynh_secure_remove --file="$builddir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_script_progression --message="Adding Prosody configuration..."
config_path=/etc/$app
ynh_app_setting_set --app=$app --key=config_path --value=$config_path
mkdir -p $config_path
mkdir -p $config_path/{certs,conf.avail,conf.d}
mkdir -p $config_path/firewall
ynh_add_config --template="../conf/prosody.cfg.lua" --destination="$config_path/prosody.cfg.lua"
ynh_add_config --template="../conf/example.com.cfg.lua" --destination="$config_path/conf.avail/example.com.cfg.lua"
#ynh_add_config --template="../conf/localhost.cfg.lua" --destination="$config_path/conf.avail/localhost.cfg.lua"
#ln -s $config_path/conf.avail/localhost.cfg.lua $config_path/conf.d/
ynh_add_config --template="$snikketdir/ansible/files/prosody.cfg.lua" --destination="$config_path/prosody.cfg.lua"
ynh_add_config --template="$snikketdir/ansible/files/restricted_users.pfw" --destination="$config_path/restricted_users.pfw"
# Add Prosody-Migrator config
ynh_add_config --template="$snikketdir/ansible/files/migrator.cfg.lua" --destination="$config_path/migrator.cfg.lua"
chown root:root "$config_path"
chmod 755 "$config_path"
@ -77,6 +83,20 @@ chmod 754 "$config_path/conf.avail"
chown root:$app "$config_path/certs"
chmod 750 "$config_path/certs"
#=================================================
# SETUP MODULES
#=================================================
ynh_script_progression --message="Intalling modules..."
mkdir -p "/etc/$app/modules"
while read module
do
cp -r "$moddir/$module" "/etc/$app/modules/$module"
done < "../sources/prosody-modules.txt"
while read module
do
cp -r "$snikketdir/snikket-modules/$module" "/etc/$app/modules/$module"
done < "../sources/snikket-modules.txt"
#=================================================
# SETUP SYSTEMD
#=================================================

View file

@ -0,0 +1,56 @@
mod_cloud_notify
mod_cloud_notify_extensions
mod_cloud_notify_encrypted
mod_cloud_notify_priority_tag
mod_cloud_notify_filters
mod_block_registrations
mod_conversejs
mod_migrate_http_upload
mod_lastlog2
mod_limit_auth
mod_password_policy
mod_vcard_muc
mod_email
mod_http_altconnect
mod_firewall
mod_admin_notify
mod_http_oauth2
mod_http_admin_api
mod_rest
mod_groups_migration
mod_invites_api
mod_invites_groups
mod_invites_page
mod_invites_register_api
mod_invites_tracking
mod_groups_internal
mod_groups_muc_bookmarks
mod_muc_defaults
mod_muc_local_only
mod_muc_offline_delivery
mod_http_host_status_check
mod_measure_process
mod_spam_reporting
mod_watch_spam_reports
mod_isolate_host
mod_muc_auto_reserve_nicks
mod_measure_active_users
mod_measure_lua
mod_measure_malloc
mod_http_xep227
mod_portcheck
mod_sasl2
mod_sasl2_bind2
mod_sasl2_sm
mod_sasl2_fast
mod_client_management
mod_audit
mod_audit_auth
mod_audit_status
mod_audit_user_accounts
mod_password_policy
mod_s2s_status
mod_sasl_ssdp
mod_privilege
mod_admin_blocklist
mod_muc_moderation

View file

@ -0,0 +1,9 @@
mod_update_check
mod_update_notify
mod_invites_default_group
mod_invites_bootstrap
mod_snikket_client_id
mod_snikket_ios_preserve_push
mod_snikket_restricted_users
mod_snikket_deprecate_general_muc
mod_migrate_snikket_roles