Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- post_install() {
- echo
- mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
- systemctl enable --now mariadb
- echo
- echo Please wait a while...
- echo
- echo Whenever the prompt \"Enter password:\" appears, if you have already set a password for MariaDB\'s root user enter it, otherwise just press \'enter\'.
- echo
- # Create ZoneMinder's database
- mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
- mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
- # Set local timezone in /etc/php/conf.d/zoneminder.ini
- sed -i 's|UTC|'`timedatectl | grep "Time zone" | tr -s ' ' | cut -f4 -d ' '`'|g' /etc/php/conf.d/zoneminder.ini
- systemctl enable --now php-fpm
- # Configure Nginx with the folder structure used in Debian-based distributions
- sed -i 's|http {|http {\'$'\n include sites-enabled/*.conf;|g' /etc/nginx/nginx.conf
- systemctl enable --now nginx
- systemctl enable --now fcgiwrap.socket
- # Start and enable ZoneMinder
- systemctl enable --now zoneminder
- echo All done!
- echo
- echo -------------
- echo
- echo If this is a fresh installation of either Nginx, MariaDB and/or PHP-FPM, you should take the time to set them up properly. At the very least you should consider running \'mysql_secure_installation\' in order to set a secure password for MariaDB\'s root user \(among other useful things\).
- echo
- echo If this is not a fresh installation of one or more of these applications \(e.g. we\'re already on a LEMP server\), take care to ensure that this install script hasn\'t messed up with any of your existing settings.
- echo
- echo -------------
- echo
- echo You can now go to http://localhost:8095 and start using ZoneMinder.
- echo
- }
- post_upgrade() {
- post_install
- # Don't know if '-f /dev/null' is still needed or not...
- /usr/bin/zmupdate.pl -f /dev/null
- }
- post_remove() {
- echo
- echo
- echo The ZoneMinder database has been left intact. You can either delete \'/var/lib/mysql\' manually or, if you still need MariaDB installed, remove the ZoneMinder database and user by running the following commands:
- echo
- echo mysql -uroot -p -e \"drop database zm\;\"
- echo mysql -uroot -p -e \"drop user \'zmuser\'@localhost\;\"
- echo
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement