#!/bin/bash

# Run triggers only on updates
if [ ! -e "/usr/local/vesta/data/users/admin" ]; then
    exit
fi

# Run SUDO trigger
if [ -x "/usr/local/vesta/upd/add_sudo.sh" ]; then
    /usr/local/vesta/upd/add_sudo.sh
fi

# Run Notification trigger
if [ -x "/usr/local/vesta/upd/add_notifications.sh" ]; then
    /usr/local/vesta/upd/add_notifications.sh
fi

# Run session save path trigger
if [ -x "/usr/local/vesta/upd/fix_sessions.sh" ]; then
    /usr/local/vesta/upd/fix_sessions.sh
fi

if [ -x /usr/local/vesta/upd/fix_nginx_auth.sh ]; then
    /usr/local/vesta/upd/fix_nginx_auth.sh
fi

if [ -x /usr/local/vesta/upd/fix_roundcube.sh ]; then
    /usr/local/vesta/upd/fix_roundcube.sh
fi

if [ -x /usr/local/vesta/upd/limit_sudo.sh ]; then
    /usr/local/vesta/upd/limit_sudo.sh
fi

if [ -x /usr/local/vesta/upd/fix_dhcprenew.sh ]; then
    /usr/local/vesta/upd/fix_dhcprenew.sh
fi

exit 0
