From 44cc9898c26d2377ad4e4860a2d6047db16932e5 Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Wed, 20 Jul 2022 14:10:37 +0900 Subject: [PATCH] Fixed deb package creation scripts to work with recent Ubuntu, 20.04 LTS and 22.04 LTS. --- .../unix/DEBIAN/make_deb_package.sh | 6 ++-- pandora_console/DEBIAN/conffiles | 1 - pandora_console/DEBIAN/control | 4 +-- pandora_console/DEBIAN/make_deb_package.sh | 29 ++++++++++--------- pandora_console/DEBIAN/postinst | 15 ++++------ 5 files changed, 26 insertions(+), 29 deletions(-) delete mode 100644 pandora_console/DEBIAN/conffiles diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 7edaec7cbc..7c49411c18 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -61,7 +61,7 @@ chmod 755 -R temp_package/DEBIAN #cp -aRf * temp_package/usr/share/pandora_agent/ #but don't copy recursive the temp_package into temp_package -for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v HP-UX | grep -v SunOS | grep -v temp_package` +for item in `ls | grep -v NT4 | grep -v AIX | grep -v FreeBSD | grep -v NetBSD | grep -v HP-UX | grep -v SunOS | grep -v Darwin | grep -v OpenWRT | grep -v pandorafms.agent_unix | grep -v temp_package` do #if [ \( $item != 'temp_package' \) -a \( $item != 'NT4' \) ] #then @@ -133,9 +133,9 @@ echo "END" echo "Make the package \"Pandorafms agent\"." if [ "$USE_DOCKER_APP" == "1" ]; then - eval $DPKG_DEB --build temp_package + eval $DPKG_DEB --root-owner-group --build temp_package else - dpkg-deb --build temp_package + dpkg-deb --root-owner-group --build temp_package fi mv temp_package.deb pandorafms.agent_unix_$pandora_version.deb diff --git a/pandora_console/DEBIAN/conffiles b/pandora_console/DEBIAN/conffiles deleted file mode 100644 index d3e2621208..0000000000 --- a/pandora_console/DEBIAN/conffiles +++ /dev/null @@ -1 +0,0 @@ -/var/www/pandora_console/include/config.php diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 370c6c7e4c..5c872846e9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -5,6 +5,6 @@ Priority: optional Section: admin Installed-Size: 42112 Maintainer: Artica ST -Homepage: http://pandorafms.org/ -Depends: php | php7.2, php7.2-snmp | php-snmp, php7.2-gd | php-gd, php7.2-mysqlnd | php-mysqlnd, php-db, php7.2-xmlrpc | php-xmlrpc, php-gettext, php7.2-curl | php-curl, graphviz, dbconfig-common, php7.2-ldap | php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php7.2-zip | php-zip +Homepage: https://pandorafms.com/ +Depends: php, php-snmp, php-gd, php-mysqlnd, php-db, php-xmlrpc, php-curl, graphviz, dbconfig-common, php-ldap, mysql-client | virtual-mysql-client, php-xmlrpc, php-zip, php-mbstring Description: Pandora FMS is an Open Source monitoring tool. It monitor your systems and applications, and allows you to control the status of any element of them. The web console is the graphical user interface (GUI) to manage the pool and to generate reports and graphs from the Pandora FMS monitoring process. diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index e1b8a2cea1..f805d8c833 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -1,6 +1,6 @@ #!/bin/bash -#Pandora FMS- http:#pandorafms.com +#Pandora FMS - https://pandorafms.com # ================================================== # Copyright (c) 2005-2021 Artica Soluciones Tecnologicas # Please see http:#pandorafms.org for full contribution list @@ -94,17 +94,19 @@ echo "Make a \"temp_package\" temporary dir for job." mkdir -p temp_package if [ $package_pandora -eq 1 ] then - mkdir -p temp_package/var/www/pandora_console + mkdir -p temp_package/var/www/html/pandora_console + mkdir -p temp_package/var/log/pandora mkdir -p temp_package/etc/logrotate.d + mkdir -p temp_package/etc/init.d echo "Make directory system tree for package." - cp -R $(ls | grep -v temp_package | grep -v DEBIAN ) temp_package/var/www/pandora_console + cp -R $(ls | grep -v temp_package | grep -v DEBIAN | grep -v pandorafms.console_$pandora_version.deb) temp_package/var/www/html/pandora_console cp -R DEBIAN temp_package cp -aRf pandora_console_logrotate_ubuntu temp_package/etc/logrotate.d/pandora_console - find temp_package/var/www/pandora_console -name ".svn" | xargs rm -Rf - rm -Rf temp_package/var/www/pandora_console/pandora_console.spec + cp -aRf pandora_websocket_engine temp_package/etc/init.d/ + find temp_package/var/www/html/pandora_console -name ".svn" | xargs rm -Rf + rm -Rf temp_package/var/www/html/pandora_console/pandora_console.spec chmod 755 -R temp_package/DEBIAN - touch temp_package/var/www/pandora_console/include/config.php echo "Remove the SVN files and other temp files." @@ -128,30 +130,31 @@ then echo "END" echo "Calculate md5sum for md5sums package control file." - for item in `find temp_package` + FILES=`find temp_package` + while read item do echo -n "." - if [ ! -d $item ] + if [ ! -d "$item" ] then - echo $item | grep "DEBIAN" > /dev/null + echo "$item" | grep "DEBIAN" > /dev/null #last command success if [ $? -eq 1 ] then - md5=`md5sum $item | cut -d" " -f1` + md5=`md5sum "$item" | cut -d" " -f1` #delete "temp_package" in the path final_path=${item#temp_package} echo $md5" "$final_path >> temp_package/DEBIAN/md5sums fi fi - done + done < <(echo "$FILES") echo "END" echo "Make the package \"Pandorafms console\"." if [ "$USE_DOCKER_APP" == "1" ]; then - eval $DPKG_DEB --build temp_package + eval $DPKG_DEB --root-owner-group --build temp_package else - dpkg-deb --build temp_package + dpkg-deb --root-owner-group --build temp_package fi mv temp_package.deb pandorafms.console_$pandora_version.deb fi diff --git a/pandora_console/DEBIAN/postinst b/pandora_console/DEBIAN/postinst index a899c6bf0a..4b871d9187 100755 --- a/pandora_console/DEBIAN/postinst +++ b/pandora_console/DEBIAN/postinst @@ -1,20 +1,15 @@ #!/bin/bash -echo Change the user and group to /var/www/pandora_console. -chmod -R u+rwX,g+rX,g-w,o-rwx /var/www/pandora_console -chgrp www-data /var/www/pandora_console -R -chown www-data /var/www/pandora_console -R -if [ -d /var/www/html ]; then mv /var/www/pandora_console /var/www/html/; fi - +echo Change the user and group to /var/www/html/pandora_console. +chmod -R u+rwX,g+rX,g-w,o-rwx /var/www/html/pandora_console +chgrp www-data /var/www/html/pandora_console -R +chown www-data /var/www/html/pandora_console -R + if [ -f /etc/init.d/apache2 ]; then echo Restart the apache. /etc/init.d/apache2 restart fi -# Install pandora_websocket_engine service. -cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/ -chmod +x /etc/init.d/pandora_websocket_engine - echo "You can now start the Pandora FMS Websocket service by executing" echo " /etc/init.d/pandora_websocket_engine start"