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
#
# 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
rm -rf /usr/pgadmin4/web
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
2023-03-17 07:17:53 -05:00
Depends: ${ PYTHON_BINARY } , libpq5 ( >= 11.0) , libgssapi-krb5-2
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
2020-03-20 07:26:10 -05:00
fakeroot dpkg-deb --build " ${ SERVERROOT } " " ${ DISTROOT } / ${ APP_NAME } -server_ ${ APP_LONG_VERSION } _ ${ OS_ARCH } .deb "
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
2021-04-02 03:31:17 -05:00
Depends: ${ APP_NAME } -server ( = ${ APP_LONG_VERSION } ) , libatomic1, xdg-utils
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
# Build the Debian package for the server
2020-03-20 07:26:10 -05:00
fakeroot dpkg-deb --build " ${ DESKTOPROOT } " " ${ DISTROOT } / ${ APP_NAME } -desktop_ ${ APP_LONG_VERSION } _ ${ OS_ARCH } .deb "
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
2020-03-20 07:26:10 -05:00
fakeroot dpkg-deb --build " ${ WEBROOT } " " ${ DISTROOT } / ${ APP_NAME } -web_ ${ APP_LONG_VERSION } _all.deb "
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 } . "