#!/bin/bash # move to cli dir cd /usr/share/cacti/cli #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 #--automationrange with LAN if server-gateway; or only interface if server only #--lang (using an array between cacti option and system language) # 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