From d178b820ae03a97857cee1e176220a585e1e40bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Mon, 11 Oct 2021 10:56:47 +0200 Subject: [PATCH 1/5] Improve RPM directory handling to facilitate upgrades an package reinstalls. --- packaging/buildrpm.sh | 2 ++ packaging/rpm/SPECS/stackable-agent.spec | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packaging/buildrpm.sh b/packaging/buildrpm.sh index 00d427ae..48785efd 100755 --- a/packaging/buildrpm.sh +++ b/packaging/buildrpm.sh @@ -61,6 +61,8 @@ mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/opt/stackable/${PACKAGE_NAME # Create config directory and copy config file template over mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME} cp packaging/config/agent.conf target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME} +mkdir target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME}/secret +mkdir target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/var/lib/stackable/${PACKAGE_NAME} # The packaging source directory does not contain the version yet, as this will need to be replaced for every # execution. Instead the directory name contains the marker "VERSION" which we now replace with the actual version. diff --git a/packaging/rpm/SPECS/stackable-agent.spec b/packaging/rpm/SPECS/stackable-agent.spec index 6c277914..6302e7f6 100644 --- a/packaging/rpm/SPECS/stackable-agent.spec +++ b/packaging/rpm/SPECS/stackable-agent.spec @@ -33,11 +33,11 @@ cp -a * %{buildroot} %post systemctl daemon-reload -mkdir -p /opt/stackable/packages -mkdir -p %{_vardir} -mkdir -p /var/log/stackable/servicelogs -mkdir -p %{_confdir} -mkdir -m 700 %{_confdir}/secret +#mkdir -p /opt/stackable/packages +#mkdir -p %{_vardir} +#mkdir -p /var/log/stackable/servicelogs +#mkdir -p %{_confdir} +#mkdir -m 700 %{_confdir}/secret %preun if [ $1 == 0 ]; then #uninstall @@ -59,4 +59,6 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{_bindir}/* %{_servicedir}/%{name}.service -%{_confdir}/agent.conf \ No newline at end of file +%config %{_confdir}/agent.conf +%dir %attr(700, root, root) %{_confdir}/secret +%dir %{_vardir} \ No newline at end of file From 5c4ce994df0effe032833483c95a616b10d3212d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Mon, 11 Oct 2021 11:15:47 +0200 Subject: [PATCH 2/5] Fix directory creation --- packaging/buildrpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/buildrpm.sh b/packaging/buildrpm.sh index 48785efd..3885de6f 100755 --- a/packaging/buildrpm.sh +++ b/packaging/buildrpm.sh @@ -62,7 +62,7 @@ mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/opt/stackable/${PACKAGE_NAME mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME} cp packaging/config/agent.conf target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME} mkdir target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME}/secret -mkdir target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/var/lib/stackable/${PACKAGE_NAME} +mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/var/lib/stackable/${PACKAGE_NAME} # The packaging source directory does not contain the version yet, as this will need to be replaced for every # execution. Instead the directory name contains the marker "VERSION" which we now replace with the actual version. From b7cb270473883f8407e7a30530df46a5929104bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Mon, 11 Oct 2021 20:32:41 +0200 Subject: [PATCH 3/5] Removed commented out lines --- packaging/rpm/SPECS/stackable-agent.spec | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packaging/rpm/SPECS/stackable-agent.spec b/packaging/rpm/SPECS/stackable-agent.spec index 6302e7f6..df962c97 100644 --- a/packaging/rpm/SPECS/stackable-agent.spec +++ b/packaging/rpm/SPECS/stackable-agent.spec @@ -33,11 +33,6 @@ cp -a * %{buildroot} %post systemctl daemon-reload -#mkdir -p /opt/stackable/packages -#mkdir -p %{_vardir} -#mkdir -p /var/log/stackable/servicelogs -#mkdir -p %{_confdir} -#mkdir -m 700 %{_confdir}/secret %preun if [ $1 == 0 ]; then #uninstall From 17ab674284c64c0e07bce4679b79d902a25dd4a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Mon, 11 Oct 2021 20:39:50 +0200 Subject: [PATCH 4/5] Added directories that were missing. --- packaging/buildrpm.sh | 2 ++ packaging/rpm/SPECS/stackable-agent.spec | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/buildrpm.sh b/packaging/buildrpm.sh index 3885de6f..0d2de9e5 100755 --- a/packaging/buildrpm.sh +++ b/packaging/buildrpm.sh @@ -63,6 +63,8 @@ mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME cp packaging/config/agent.conf target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME} mkdir target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/etc/stackable/${PACKAGE_NAME}/secret mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/var/lib/stackable/${PACKAGE_NAME} +mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/var/log/stackable/servicelogs +mkdir -p target/rpm/SOURCES/${PACKAGE_NAME}-VERSION/opt/stackable/packages # The packaging source directory does not contain the version yet, as this will need to be replaced for every # execution. Instead the directory name contains the marker "VERSION" which we now replace with the actual version. diff --git a/packaging/rpm/SPECS/stackable-agent.spec b/packaging/rpm/SPECS/stackable-agent.spec index df962c97..f42a0112 100644 --- a/packaging/rpm/SPECS/stackable-agent.spec +++ b/packaging/rpm/SPECS/stackable-agent.spec @@ -56,4 +56,6 @@ rm -rf %{buildroot} %{_servicedir}/%{name}.service %config %{_confdir}/agent.conf %dir %attr(700, root, root) %{_confdir}/secret -%dir %{_vardir} \ No newline at end of file +%dir %{_vardir} +%dir /var/log/stackable/servicelogs +%dir /opt/stackable/packages \ No newline at end of file From 98856a7eda7278384556bae74abdb7bbe5a52492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Mon, 11 Oct 2021 20:45:34 +0200 Subject: [PATCH 5/5] Empty directories were not removed. --- packaging/rpm/SPECS/stackable-agent.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packaging/rpm/SPECS/stackable-agent.spec b/packaging/rpm/SPECS/stackable-agent.spec index f42a0112..af1c4e60 100644 --- a/packaging/rpm/SPECS/stackable-agent.spec +++ b/packaging/rpm/SPECS/stackable-agent.spec @@ -52,8 +52,10 @@ rm -rf %{buildroot} %files %defattr(-,root,root,-) +%{_bindir} %{_bindir}/* %{_servicedir}/%{name}.service +%dir %{_confdir} %config %{_confdir}/agent.conf %dir %attr(700, root, root) %{_confdir}/secret %dir %{_vardir}