--- rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch 2022/07/28 04:20:19 1.17 +++ rpms/smeserver-cacti/contribs10/smeserver-cacti-1.1.19-sme10.patch 2022/07/30 06:15:03 1.24 @@ -9,7 +9,7 @@ diff -Nur --no-dereference smeserver-cac )) { templates2events("/etc/cacti/db.php", $event); -@@ -22,3 +23,35 @@ +@@ -22,3 +23,34 @@ } templates2events("/etc/e-smith/sql/init/80cacti", "post-upgrade"); @@ -35,7 +35,6 @@ diff -Nur --no-dereference smeserver-cac +event_actions($event, +'cacti-conf' => '2', +'cacti-install' => '94', -+'cacti-ldap' => '95' +); + + @@ -497,7 +496,7 @@ diff -Nur --no-dereference smeserver-cac + if (($cacti{'status'} || 'disabled') eq 'enabled'){ + my $max_upload_size = ($cacti{MaxUploadSize} || '4096'); + $max_upload_size .= 'M' if ($max_upload_size =~ m/^\d+$/); -+ my $memory_limit = ($cacti{MemoryLimit} || '5555500M'); ++ my $memory_limit = ($cacti{MemoryLimit} || '500M'); + $memory_limit .= 'M' if ($memory_limit =~ m/^\d+$/); + my $open_basedir= $cacti{PHPBaseDir} || ''; + $open_basedir = "/tmp/:/share/:/var/log/cacti:/etc/cacti/db.php:/usr/share/cacti:/var/lib/cacti:/var/log/cacti.log:/var/lib/php/cacti:/home/e-smith/files/cacti:/dev/urandom:/proc/meminfo:$open_basedir"; @@ -584,10 +583,10 @@ diff -Nur --no-dereference smeserver-cac +# move to cli dir +cd /usr/share/cacti/cli + -+#install, we put away, it seems that inside the event it just do not work -+/usr/bin/php74 install_cacti.php --accept-eula --install & -+pids=$! ; wait $pid; -+ ++#install, we put away, it fails in the temp event in yum at first, so here is a dirty hack ++/usr/bin/php install_cacti.php & ++pids=$!; sleep 3; kill -9 $pids; ++/usr/bin/php install_cacti.php --accept-eula --install || exit 0 + +#TODO: +#--automationmode @@ -642,3 +641,96 @@ diff -Nur --no-dereference smeserver-cac # set password of admin UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; +diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-install smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-install +--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-install 2022-07-28 00:24:34.405000000 -0400 ++++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-install 2022-07-28 00:26:59.373000000 -0400 +@@ -15,3 +15,39 @@ + # using this to set ldap ? --ldap:dn:... + # do we need a --mode=upgrade and a --mode=install + ++db=$(config getprop cacti DbDatabase || echo 'cacti_sme'); ++user=$(config getprop cacti DbUser || echo 'cacti'); ++pass=$(config getprop cacti DbPassword || echo 'changeme'); ++adminpass=$(config getprop cacti AdminPassword || echo 'changeme'); ++domain=$(config get DomainName) ++DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");") ++ ++# set ldap auth with optional group ++# ldap_group_require 'on' or '': user will enable if needed. ++# then set our admin password ++/usr/bin/mysql <,ou=Users,$DN') ; ++REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; ++REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; ++REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; ++REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ; ++ ++REPLACE INTO ${db}.settings VALUES ('user_template','3'); ++ ++# set password of admin ++UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; ++EOF ++ +diff -Nur --no-dereference smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap +--- smeserver-cacti-1.1.19.old/root/etc/e-smith/events/actions/cacti-ldap 2022-07-28 00:24:34.405000000 -0400 ++++ smeserver-cacti-1.1.19/root/etc/e-smith/events/actions/cacti-ldap 1969-12-31 19:00:00.000000000 -0500 +@@ -1,46 +0,0 @@ +-#!/bin/bash +- +-#use esmith::ConfigDB; +-#use esmith::util; +-#my $cdb = esmith::ConfigDB->open_ro(); +-#my $domain = $cdb->get_value('DomainName'); +-#my $baseDN = esmith::util::ldapBase($cdb->get_value('DomainName')); +-#print $baseDN . "\n"; +- +-db=$(config getprop cacti DbDatabase || echo 'cacti_sme'); +-user=$(config getprop cacti DbUser || echo 'cacti'); +-pass=$(config getprop cacti DbPassword || echo 'changeme'); +-adminpass=$(config getprop cacti AdminPassword || echo 'changeme'); +-domain=$(config get DomainName) +-DN=$(perl -Mesmith::util -e "print esmith::util::ldapBase(\"$domain\");") +- +- +-# set ldap auth with optional group +-#ldap_group_require 'on' or '' +-# then set our admin password +-/usr/bin/mysql <,ou=Users,$DN') ; +-REPLACE INTO ${db}.settings VALUES ('auth_method','3') ; +-REPLACE INTO ${db}.settings VALUES ('cn_full_name','cn') ; +-REPLACE INTO ${db}.settings VALUES ('cn_email','mail') ; +-REPLACE INTO ${db}.settings VALUES ('path_php_binary','/usr/bin/php74') ; +- +-REPLACE INTO ${db}.settings VALUES ('user_template','3'); +- +-# set password of admin +-UPDATE ${db}.user_auth SET email_address='admin@${domain}', must_change_password='',password=md5('$adminpass'), enabled='on' WHERE username='admin' and id='1'; +-EOF +-