smeserver-freepbx/createlinks

101 lines
4.5 KiB
Plaintext
Raw Normal View History

#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
# force default php to php56
safe_symlink("/usr/bin/php74", "root/usr/sbin/php");
safe_symlink("/usr/bin/php74", "root/usr/local/sbin/php");
#safe_symlink("../daemontools" , 'root/etc/rc.d/init.d/supervise/httpd-fpbx');
#safe_symlink("/var/service/httpd-fpbx" , 'root/service/httpd-fpbx');
# Panel links
panel_link("freepbx", 'manager');
#panel_link("fop", 'manager');
# Events links
my $event = 'freepbx-update';
templates2events("/etc/asterisk/asterisk.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/asterisk/cdr_mysql.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/asterisk/manager.conf", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/logrotate.d/asterisk", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/odbc.ini", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/httpd/conf/httpd.conf", $event);
templates2events("/etc/httpd/fpbx-conf/httpd.conf", qw(freepbx-update bootstrap-console-save conf-userpanel));
templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", qw(freepbx-update bootstrap-console-save));
templates2events("/etc/opt/remi/php74/php-fpm.d/www.conf", $event);
templates2events("/opt/remi/php56/root/etc/php-fpm.d/www.conf", $event);
event_link("freepbx-checkinstall", $event, "10");
event_link("freepbx-checkinstall-backup", $event, "11");
event_link("freepbx-amportal.conf", $event, "91");
event_link("freepbx-clean-crontab", $event, "40");
event_link("freepbx-cron", $event, "40");
event_link("freepbx-dump-astdb", "pre-backup", "30");
event_link("freepbx-backup", "pre-backup", "31");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php56-php-fpm");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php74-php-fpm");
safe_symlink("sigusr1", "root/etc/e-smith/events/logrotate/services2adjust/httpd-fpbx");
safe_symlink("sigusr1", "root/etc/e-smith/events/conf-userpanel/services2adjust/httpd-fpbx");
# Create empty files
#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_access_log");
#safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/fpbx_error_log");
#safe_touch("root/var/service/httpd-fpbx/down");
# Create empty directories
system("/bin/mkdir -p root/var/service/httpd-fpbx/supervise");
system("/bin/mkdir -p root/var/service/httpd-fpbx/log/supervise");
system("/bin/mkdir -p root/var/log/httpd-fpbx");
## systemd install/update
$event = 'smeserver-freepbx-update';
templates2events("/etc/asterisk/asterisk.conf", $event);
templates2events("/etc/asterisk/cdr_mysql.conf", $event);
templates2events("/etc/asterisk/manager.conf", $event);
templates2events("/etc/logrotate.d/asterisk", $event);
templates2events("/etc/logrotate.d/vsftpd", $event);
templates2events("/etc/httpd/conf/httpd.conf", $event);
templates2events("/etc/httpd/fpbx-conf/httpd.conf", $event);
templates2events("/etc/e-smith/sql/init/30freepbx_mysql_create_database", $event);
templates2events("/etc/opt/remi/php74/php-fpm.d/www.conf", $event);
templates2events("/opt/remi/php56/root/etc/php-fpm.d/www.conf", $event);
templates2events("/etc/odbc.ini", $event);
event_link("freepbx-checkinstall", $event, "10");
event_link("freepbx-checkinstall-backup", $event, "11");
event_link("freepbx-amportal.conf", $event, "91");
event_link("freepbx-clean-crontab", $event, "40");
event_link("freepbx-cron", $event, "40");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-fpbx");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php56-php-fpm");
safe_symlink("reload-or-restart", "root/etc/e-smith/events/$event/services2adjust/php74-php-fpm");
#action needed in case we have a systemd unit
event_link("systemd-default", $event, "88");
event_link("systemd-reload", $event, "89");
use esmith::Build::Backup qw(:all);
backup_includes("smeserver-freepbx", qw(
/opt/freepbx
/var/lib/asterisk/
/etc/asterisk
/var/spool/asterisk/
/var/log/asterisk
/usr/sbin/amportal
/usr/sbin/fwconsole
));