2020-03-12 10:22:23 -05:00
#!/bin/bash
# Exit when any command fails
set -e
# Debugging shizz
2021-05-04 08:12:13 -05:00
trap 'ERRCODE=$? && if [ ${ERRCODE} -ne 0 ]; then echo "The command \"${BASH_COMMAND}\" failed in \"${FUNCNAME}\" with exit code ${ERRCODE}."; fi' EXIT
2020-03-12 10:22:23 -05:00
OS_ARCH = $( dpkg-architecture -qDEB_HOST_ARCH)
2022-02-14 05:56:27 -06:00
# Stop creating pyc files.
export PYTHONDONTWRITEBYTECODE = 1
2020-03-12 10:22:23 -05:00
# Common Linux build functions
source pkg/linux/build-functions.sh
# Assemble the "standard" installation footprint
2022-08-10 05:34:40 -05:00
_setup_env " $0 " "debian"
2020-03-12 10:22:23 -05:00
_cleanup "deb"
_setup_dirs
2020-03-18 07:51:11 -05:00
_create_python_virtualenv "debian"
2020-03-12 10:22:23 -05:00
_build_runtime
2020-03-18 07:51:11 -05:00
_build_docs "debian"
2020-03-12 10:22:23 -05:00
_copy_code
2023-08-03 05:38:59 -05:00
_generate_sbom
2020-03-12 10:22:23 -05:00
#
# Server package
#
# Create the Debian packaging stuffs for the server
echo "Creating the server package..."
mkdir " ${ SERVERROOT } /DEBIAN "
2023-04-04 07:58:26 -05:00
echo "Creating preinst script..."
cat << EOF > "${SE RVERROOT} /DEBIAN/preinst"
#!/bin/sh
rm -rf /usr/pgadmin4/venv
2023-04-06 08:45:01 -05:00
if [ -d /usr/pgadmin4/web ] ; then
2023-04-11 00:12:19 -05:00
cd /usr/pgadmin4/web && rm -rf \$ ( ls -A -I config_local.py)
2023-04-06 08:45:01 -05:00
fi
2023-04-04 07:58:26 -05:00
EOF
2023-04-04 08:25:38 -05:00
chmod 755 " ${ SERVERROOT } /DEBIAN/preinst "
2020-03-12 10:22:23 -05:00
cat << EOF > "${SE RVERROOT} /DEBIAN/control"
Package: ${ APP_NAME } -server
Version: ${ APP_LONG_VERSION }
Architecture: ${ OS_ARCH }
2021-11-29 07:47:11 -06:00
Section: database
2022-03-03 06:22:52 -06:00
Priority: optional
2024-04-25 04:32:50 -05:00
Depends: ${ PYTHON_BINARY } , libpq5 ( >= 11.0) , libgssapi-krb5-2, python-dbus | python3-dbus
2022-10-17 04:02:45 -05:00
Recommends: postgresql-client | postgresql-client-15 | postgresql-client-14 | postgresql-client-13 | postgresql-client-12 | postgresql-client-11 | postgresql-client-10
2020-03-12 10:22:23 -05:00
Maintainer: pgAdmin Development Team <pgadmin-hackers@postgresql.org>
Description: The core server package for pgAdmin. pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
EOF
# Build the Debian package for the server
2024-06-10 08:15:44 -05:00
fakeroot /bin/bash
chmod -R u+rwX,go+rX,go-w " ${ SERVERROOT } "
dpkg-deb --build " ${ SERVERROOT } " " ${ DISTROOT } / ${ APP_NAME } -server_ ${ APP_LONG_VERSION } _ ${ OS_ARCH } .deb "
exit
2020-03-12 10:22:23 -05:00
#
# Desktop package
#
# Create the Debian packaging stuffs for the desktop
echo "Creating the desktop package..."
mkdir " ${ DESKTOPROOT } /DEBIAN "
cat << EOF > "${DE SKTOPROOT} /DEBIAN/control"
Package: ${ APP_NAME } -desktop
Version: ${ APP_LONG_VERSION }
Architecture: ${ OS_ARCH }
2021-11-29 07:47:11 -06:00
Section: database
2022-03-03 06:22:52 -06:00
Priority: optional
2024-04-25 04:32:50 -05:00
Depends: ${ APP_NAME } -server ( = ${ APP_LONG_VERSION } ) , libatomic1, xdg-utils, python-dbus | python3-dbus
2020-03-12 10:22:23 -05:00
Maintainer: pgAdmin Development Team <pgadmin-hackers@postgresql.org>
Description: The desktop user interface for pgAdmin. pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
EOF
2023-08-11 04:42:26 -05:00
# Build the Debian package for the desktop
2024-06-10 08:15:44 -05:00
fakeroot /bin/bash
chmod -R u+rwX,go+rX,go-w " ${ DESKTOPROOT } "
dpkg-deb --build " ${ DESKTOPROOT } " " ${ DISTROOT } / ${ APP_NAME } -desktop_ ${ APP_LONG_VERSION } _ ${ OS_ARCH } .deb "
exit
2020-03-12 10:22:23 -05:00
#
# Web package
#
# Create the Debian packaging stuffs for the web
echo "Creating the web package..."
mkdir " ${ WEBROOT } /DEBIAN "
2021-03-29 04:35:50 -05:00
cat << EOF > "${WE BROOT} /DEBIAN/conffiles"
/etc/apache2/conf-available/pgadmin4.conf
EOF
2020-03-12 10:22:23 -05:00
cat << EOF > "${WE BROOT} /DEBIAN/control"
Package: ${ APP_NAME } -web
Version: ${ APP_LONG_VERSION }
Architecture: all
2021-11-29 07:47:11 -06:00
Section: database
2022-03-03 06:22:52 -06:00
Priority: optional
2021-02-19 04:08:25 -06:00
Depends: ${ APP_NAME } -server ( = ${ APP_LONG_VERSION } ) , apache2, libapache2-mod-wsgi-py3
2020-03-12 10:22:23 -05:00
Maintainer: pgAdmin Development Team <pgadmin-hackers@postgresql.org>
Description: The web interface for pgAdmin, hosted under Apache HTTPD. pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
EOF
mkdir -p " ${ WEBROOT } /etc/apache2/conf-available "
cp " ${ SOURCEDIR } /pkg/debian/pgadmin4.conf " " ${ WEBROOT } /etc/apache2/conf-available "
# Build the Debian package for the web
2024-06-10 08:15:44 -05:00
fakeroot /bin/bash
chmod -R u+rwX,go+rX,go-w " ${ WEBROOT } "
dpkg-deb --build " ${ WEBROOT } " " ${ DISTROOT } / ${ APP_NAME } -web_ ${ APP_LONG_VERSION } _all.deb "
exit
2020-03-12 10:22:23 -05:00
#
# Meta package
#
# Create the Debian packaging stuffs for the meta package
echo "Creating the meta package..."
mkdir " ${ METAROOT } /DEBIAN "
cat << EOF > "${ME TAROOT} /DEBIAN/control"
Package: ${ APP_NAME }
Version: ${ APP_LONG_VERSION }
Architecture: all
2021-11-29 07:47:11 -06:00
Section: database
2022-03-03 06:22:52 -06:00
Priority: optional
2021-02-19 04:08:25 -06:00
Depends: ${ APP_NAME } -server ( = ${ APP_LONG_VERSION } ) , ${ APP_NAME } -desktop ( = ${ APP_LONG_VERSION } ) , ${ APP_NAME } -web ( = ${ APP_LONG_VERSION } )
2020-03-12 10:22:23 -05:00
Maintainer: pgAdmin Development Team <pgadmin-hackers@postgresql.org>
Description: Installs all required components to run pgAdmin in desktop and web modes. pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
EOF
# Build the Debian meta package
2020-03-20 07:26:10 -05:00
fakeroot dpkg-deb --build " ${ METAROOT } " " ${ DISTROOT } / ${ APP_NAME } _ ${ APP_LONG_VERSION } _all.deb "
2020-06-02 07:23:12 -05:00
# Get the libpq package
2022-08-10 05:34:40 -05:00
pushd " ${ DISTROOT } " 1> /dev/null
2022-12-22 05:21:21 -06:00
apt-get download libpq5 libpq-dev
2020-06-02 07:23:12 -05:00
popd 1> /dev/null
echo " Completed. DEBs created in ${ DISTROOT } . "