INSTRUCTIONS TO BUILD THE DEBIAN / UBUNTU PACKAGE
BastionGuard – using the "change cmake" CMakeLists.txt
=====================================================

This procedure explains how to properly build the .deb package
without executing privileged actions (chmod, chown, systemctl,
udevadm, sysctl, network downloads, etc.) during build/install.

--------------------------------------------------------------------
1) REPLACE THE CMakeLists.txt FILE
--------------------------------------------------------------------

Enter the main BastionGuard source directory
(where the original CMakeLists.txt is located):

    cd BastionGuard

Create a backup of the original CMake file:

    cp -a CMakeLists.txt CMakeLists.txt.upstream

Replace the CMakeLists.txt with the Debian/Ubuntu-friendly one
located in the "change cmake" directory:

    cp -a "debian/change_cmake/CMakeLists.txt" ./CMakeLists.txt

Optional verification:

    head -n 20 CMakeLists.txt

--------------------------------------------------------------------
2) CLEAN THE BUILD ENVIRONMENT
--------------------------------------------------------------------

Remove any previous build artifacts:

    rm -rf build build_debian debian/tmp

--------------------------------------------------------------------
3) BUILD THE DEBIAN PACKAGE
--------------------------------------------------------------------

From the project root (where the debian/ directory exists):

    dpkg-buildpackage -us -uc

Or, alternatively:

    debuild -us -uc

--------------------------------------------------------------------
4) RESULT
--------------------------------------------------------------------

The generated .deb packages will appear in the parent directory,
for example:

    ../bastionguard_<version>_amd64.deb

--------------------------------------------------------------------
IMPORTANT NOTES
--------------------------------------------------------------------

- This CMake file is intended ONLY for Debian/Ubuntu packaging.
- All privileged actions are disabled in CMake and MUST be handled
  by the following maintainer scripts:
      debian/postinst
      debian/prerm
      debian/postrm
- The original upstream CMake file is preserved as:
      CMakeLists.txt.upstream
- To restore the upstream build behavior:

      mv CMakeLists.txt.upstream CMakeLists.txt

--------------------------------------------------------------------
END
--------------------------------------------------------------------
