Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*~
*.sw[op]
.DS_Store
15 changes: 12 additions & 3 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ admindoc = "https://rspamd.com/doc"
code = "https://github.com/rspamd/rspamd"

[integration]
yunohost = '>= 12.0'
yunohost = '>= 12.1.17'
helpers_version = "2.1"
architectures = ["amd64", "arm64"]
multi_instance = false

Expand All @@ -33,14 +34,22 @@ ram.runtime = "50M"

[resources]

[resources.sources.main]
[resources.sources.trixie]
amd64.url = "https://rspamd.com/apt-stable/pool/main/r/rspamd/rspamd_3.14.2-1~e6f401a~trixie_amd64.deb"
amd64.sha256 = "000e1e4887fff31c5b01af98c6645082ebcbbb7c245af4c33c58f368f87ded07"
arm64.url = "https://rspamd.com/apt-stable/pool/main/r/rspamd/rspamd_3.14.2-1~e6f401a~trixie_arm64.deb"
arm64.sha256 = "7b9e4dd724496d18b542a9e0d76a66434aa32fa83d93b56fb83df56e6ad8fbdb"
extract = false
rename = "rspamd.deb"

[resources.sources.bookworm]
amd64.url = "https://rspamd.com/apt-stable/pool/main/r/rspamd/rspamd_3.14.2-1~e6f401a~bookworm_amd64.deb"
amd64.sha256 = "1e1729775bf566089ec2bb8a0c8c187c71b5f1a5330b4a9a07ca9ff2abe2395f"
arm64.url = "https://rspamd.com/apt-stable/pool/main/r/rspamd/rspamd_3.14.2-1~e6f401a~bookworm_arm64.deb"
arm64.sha256 = "45bfadabbb052564b9abc14e5ed30a92795344aff525e86b6f7fd850ddf8d6d9"
extract = false
rename = "rspamd.deb"

[resources.permissions]

[resources.apt]
Expand Down
16 changes: 8 additions & 8 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

source /usr/share/yunohost/helpers

#=================================================
# BACKUP SYSTEM CONFIGURATION
#=================================================

ynh_print_info --message="Declaring files to be backed up..."

ynh_backup --src_path="/usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd"
ynh_backup --src_path="/etc/dovecot/global_script/rspamd.sieve"
ynh_backup --src_path="/etc/dovecot/yunohost.d/post-ext.d/antispam.conf"
ynh_backup "/usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd"
ynh_backup "/etc/dovecot/global_script/rspamd.sieve"
ynh_backup "/etc/dovecot/yunohost.d/post-ext.d/antispam.conf"

ynh_backup --src_path="/etc/rspamd"
ynh_backup "/etc/rspamd"

ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"

#=================================================
# END OF SCRIPT
#=================================================

ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
28 changes: 18 additions & 10 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,47 @@ source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up rspamd..."
ynh_script_progression "Setting up $app..."

tmp_dir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmp_dir"
dpkg -i $tmp_dir/rspamd.deb
tmp_dir=$(mktemp -d)

if [[ $YNH_DEBIAN_VERSION == "bookworm" ]]; then
ynh_setup_source --dest_dir="$tmp_dir" --source_id="bookworm"
dpkg -i $tmp_dir/rspamd.deb
elif [[ $YNH_DEBIAN_VERSION == "trixie" ]]; then
ynh_setup_source --dest_dir="$tmp_dir" --source_id="trixie"
dpkg -i $tmp_dir/rspamd.deb
fi

#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..."
ynh_script_progression "Adding system configurations related to $app..."

cp ../conf/redis.conf /etc/rspamd/local.d/redis.conf
ynh_systemd_action --service_name=rspamd --action="restart"
ynh_systemctl --service=rspamd --action="restart"

# Add postfix configuration hook and regen postfix conf
cp ../conf/postfix_regenconf_hook /usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
ynh_systemctl --service=postfix --action="restart"

# Add dovecot conf
cp ../conf/dovecot_sieve.conf /etc/dovecot/global_script/rspamd.sieve
sievec /etc/dovecot/global_script/rspamd.sieve
chown -R vmail:mail /etc/dovecot/global_script

cp ../conf/dovecot_antispam.conf /etc/dovecot/yunohost.d/post-ext.d/antispam.conf
ynh_systemd_action --service_name=dovecot --action="restart"
ynh_systemctl --service=dovecot --action="restart"

# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#ynh_config_add_logrotate

# Integrate rspamd in YunoHost service list
yunohost service add $app --description="Spam filtering system"

#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

ynh_script_progression "Installation of $app completed"
16 changes: 8 additions & 8 deletions scripts/remove
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression "Removing system configurations related to $app..."

if ynh_exec_warn_less yunohost service status $app >/dev/null; then
if ynh_hide_warnings yunohost service status $app >/dev/null; then
yunohost service remove $app
fi

dpkg -r rspamd || true

# Remove postfix conf tweak
ynh_secure_remove /usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd
ynh_safe_rm /usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
ynh_systemctl --service=postfix --action="restart"

# Remove dovecot conf
ynh_secure_remove /etc/dovecot/global_script/rspamd.sieve
ynh_secure_remove /etc/dovecot/yunohost.d/post-ext.d/antispam.conf
ynh_systemd_action --service_name=dovecot --action="restart"
ynh_safe_rm /etc/dovecot/global_script/rspamd.sieve
ynh_safe_rm /etc/dovecot/yunohost.d/post-ext.d/antispam.conf
ynh_systemctl --service=dovecot --action="restart"

ynh_remove_logrotate
ynh_config_remove_logrotate

#=================================================
# END OF SCRIPT
#=================================================

ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression "Removal of $app completed"
16 changes: 8 additions & 8 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression "Restoring system configurations related to $app..."

ynh_restore_file --origin_path="/usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd"
ynh_restore "/usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd"
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
ynh_systemctl --service=postfix --action="restart"

ynh_restore_file --origin_path="/etc/dovecot/global_script/rspamd.sieve"
ynh_restore_file --origin_path="/etc/dovecot/yunohost.d/post-ext.d/antispam.conf"
ynh_restore "/etc/dovecot/global_script/rspamd.sieve"
ynh_restore "/etc/dovecot/yunohost.d/post-ext.d/antispam.conf"
sievec /etc/dovecot/global_script/rspamd.sieve
chown -R vmail:mail /etc/dovecot/global_script
ynh_systemd_action --service_name=dovecot --action="restart"
ynh_systemctl --service=dovecot --action="restart"

ynh_restore_file --origin_path="/etc/rspamd"
ynh_restore "/etc/rspamd"

ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore "/etc/logrotate.d/$app"

# Integrate rspamd in YunoHost service list
yunohost service add $app --description="Spam filtering system"
Expand All @@ -28,4 +28,4 @@ yunohost service add $app --description="Spam filtering system"
# END OF SCRIPT
#=================================================

ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression "Restoration completed for $app"
29 changes: 18 additions & 11 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,41 @@ source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up rspamd..."
ynh_script_progression "Setting up $app..."

tmp_dir=$(mktemp -d)
ynh_setup_source --dest_dir="$tmp_dir"
dpkg -i $tmp_dir/rspamd.deb
tmp_dir=$(mktemp -d)

if [[ $YNH_DEBIAN_VERSION == "bookworm" ]]; then
ynh_setup_source --dest_dir="$tmp_dir" --source_id="bookworm"
dpkg -i $tmp_dir/rspamd.deb
elif [[ $YNH_DEBIAN_VERSION == "trixie" ]]; then
ynh_setup_source --dest_dir="$tmp_dir" --source_id="trixie"
dpkg -i $tmp_dir/rspamd.deb
fi

#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..."
ynh_script_progression "Adding system configurations related to $app..."

cp ../conf/redis.conf /etc/rspamd/local.d/redis.conf
ynh_systemd_action --service_name=rspamd --action="restart"
ynh_systemctl --service=rspamd --action="restart"

# Add postfix configuration hook and regen postfix conf
cp -R ../conf/postfix_regenconf_hook /usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd
cp ../conf/postfix_regenconf_hook /usr/share/yunohost/hooks/conf_regen/99-postfix_rspamd
yunohost tools regen-conf postfix
ynh_systemd_action --service_name=postfix --action="restart"
ynh_systemctl --service=postfix --action="restart"

# Add dovecot conf
cp ../conf/dovecot_sieve.conf /etc/dovecot/global_script/rspamd.sieve
sievec /etc/dovecot/global_script/rspamd.sieve
chown -R vmail:mail /etc/dovecot/global_script

cp ../conf/dovecot_antispam.conf /etc/dovecot/yunohost.d/post-ext.d/antispam.conf
ynh_systemd_action --service_name=dovecot --action="restart"
ynh_systemctl --service=dovecot --action="restart"

# Use logrotate to manage application logfile(s)
ynh_use_logrotate
ynh_config_add_logrotate

# Integrate rspamd in YunoHost service list
yunohost service add $app --description="Spam filtering system"
Expand All @@ -41,4 +48,4 @@ yunohost service add $app --description="Spam filtering system"
# END OF SCRIPT
#=================================================

ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression "Upgrade of $app completed"