tis-postgresql icon

PostgreSQL

Silent install package for PostgreSQL

17.5-3

  • package: tis-postgresql
  • name: PostgreSQL
  • version: 17.5-3
  • categories: System and network
  • maintainer: WAPT TEAM, SEGAT GAETAN, ALLARD THIBAUT
  • target_os: windows
  • impacted_process: postgres,pg_ctl
  • architecture: x64
  • signature_date:
  • size: 353.88 Mo

package           : tis-postgresql
version           : 17.5-3
architecture      : x64
section           : base
priority          : optional
name              : PostgreSQL
categories        : System and network
maintainer        : WAPT TEAM, SEGAT GAETAN, ALLARD THIBAUT
description       : PostgreSQL is a relational and object database management system.
depends           : 
conflicts         : 
maturity          : PROD
locale            : 
target_os         : windows
min_wapt_version  : 2.5
sources           : https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
installed_size    : 
impacted_process  : postgres,pg_ctl
description_fr    : PostgreSQL est un système de gestion de base de données relationnelle et objet.
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 292bca62-e1bb-4d17-b32f-d9e40b4e3a49
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 10
max_os_version    : 
icon_sha256sum    : ced24d01ab0a984121c3ab089f4961f34e141b0ecdcaa120b86f1a460a94fe07
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature_date    : 2025-05-13T13:00:49.000000
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes
signature         : xX7quPSL7mrN3GvkCgtrTk3Ssd540ucZ9pETig70+ws1/DVXgY67QIAYWDc5bXV01+MNyrKSAKq+zqn7Z2HQhx5NdSYVt1QBgFhqvnrL0G9PxFBLn1qeMKg35LS2QGlEw8EC8alZj0Nh5b00KfXJsk0Sp4I8AUmSNiAJ5zdwXYyVhO0isr2WzHJIebBsaLOXnpJlvrKQqBnWo2V+3rffviVVG/B298e+L8VOjdb66OtY+lkkOg5hQBlhSlgXE7U6+floovxll0bnhloxUKT2jwod/x/jyoE3kQ8N/Fe+gXDSa53V3qPfRxxy/BDHMzRG59lO0TglCGAZE2x97TwRyg==

# -*- coding: utf-8 -*-
from setuphelpers import *
import base64
import json

"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_contains = "postgresql-"

def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob("*%s*.exe" % bin_contains)[0]
    app_uninstallkey = "PostgreSQL %s" % package_version.split('.')[0]
    silent_args = "--unattendedmodeui none --mode unattended --enable-components server"

    # Removing old version
    for soft in installed_softwares("PostgreSQL %s" % package_version):
        if Version(soft["version"]) < Version(package_version):
            print("Uninstalling old version: %s" % soft["version"])
            run(uninstall_cmd(soft["key"]))


    # Installing the software
    print("Installing: %s" % bin_name)
    install_exe_if_needed(
        bin_name,
        silentflags=silent_args,
        key=app_uninstallkey,
        min_version=bin_name.replace('postgresql-','').replace('-windows-x64.exe',''),         # version displayed in registry contains "-"
        timeout=600,
    )

    # Adding quiet uninstall string to registry
    uninstallstring = installed_softwares(app_uninstallkey)[0]['uninstall_string']
    register_uninstall(app_uninstallkey,quiet_uninstall_string=f'{uninstallstring} --mode unattended')

# -*- coding: utf-8 -*-
from setuphelpers import *
import os

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""

def update_package():
    package_updated = False
    proxies = get_proxies_from_wapt_console()
    if not proxies:
        proxies = get_proxies()
    app_name = control.name
    url = "https://www.enterprisedb.com/downloads/postgres-postgresql-downloads"

    # Send a GET request to the URL
    response = requests.get(url)
    # Check if the request was successful
    if response.status_code == 200:
        # Find the <tbody> tag
        tbody = bs_find(
                url,
                "tbody",
                user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0",
                proxies=proxies,
                features='html.parser',
                )

        if tbody:
            # Find the first line in the tbody
            first_row = tbody.find('tr')
            if first_row:
                # Find all columns in first row
                columns = first_row.find_all('td')
                # Check if there are at least 5 columns
                if len(columns) >= 5:
                    # Check the contents of the first column
                    version = str(columns[0].text.strip())
                    print("Contenu de la première colonne :", version)
                    # Retrieve the 5th column
                    fifth_column = columns[4]
                    # Find an <a> tag with a href starting with "https"
                    download_url = fifth_column.find('a', href=lambda href: href and href.startswith("https"))
                    if download_url:
                        # Show found link
                        print("Lien trouvé dans la 5ème colonne :", download_url['href'])
                        # We prefer keeping the original binary name because it contains the version displayed in Windows registry
                        bin_name = requests.head(download_url['href']).headers['Location'].split('/')[-1]
                        wget(download_url['href'], bin_name)
                        control.set_software_version(version)
                        control.save_control_to_wapt()
                        package_updated = True
                        print("Software version is up-to-date (%s)" % Version(version))
                    else:
                        print("Aucun lien commençant par 'https' n'a été trouvé dans la 5ème colonne.")
                else:
                    print("Il n'y a pas suffisamment de colonnes dans la première ligne.")
            else:
                print("La première ligne dans <tbody> n'a pas été trouvée.")
        else:
            print("Aucun <tbody> n'a été trouvé sur la page.")
    else:
        print("Erreur lors de la requête :", response.status_code)

    remove_outdated_binaries(version, filename_contains="postgresql-")
    return package_updated

38d056ab130f7bf7c481c12636a4e9959de36561d3dfcbe54c6e3571bc0c1dc3 : WAPT/certificate.crt
19c2c4522934e5856f1e98d7753805113be38d301f70fe65820f1732afa6f189 : WAPT/control
ced24d01ab0a984121c3ab089f4961f34e141b0ecdcaa120b86f1a460a94fe07 : WAPT/icon.png
e78415f9c94d60d725e076f955371a75321ae6b55b9be66e66ba498d08dd0fd7 : luti.json
ce9b26e49afd95a42a0f1d1d9be3ae308900c0f2ae175fa2f6877e037245d257 : postgresql-17.5-1-windows-x64.exe
90f9576799596a9ddf9ae050dcbc5618eb867bf53032e40dc4367638be26b592 : setup.py
eee62b5396c52f3cee22f46cb515d83d0edba17e8cfa6118bb7ab1d7a87c92dc : update_package.py