Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎲🎲 GNU Backgammon β€” PostgreSQL Database Setup ⚑

⚑ RAW INTERFACE // postsonde
Automated, interactive setup script to fix the broken database connection in GNU Backgammon (gnubg) on Debian, MX Linux, and Ubuntu.

Menu Demo


🧠 Why This Script Exists

If you try to store match statistics in GNU Backgammon on modern Debian-based systems (Debian 12/13, MX Linux, Ubuntu), you usually hit a wall:

  1. SQLite is missing from the database dropdown menu.
  2. Selecting MySQL or PostgreSQL throws:
    Database connection test failed, installation problem!
  3. Even if you install postgresql and python3-psycopg2 manually, gnubg still fails because its internal script expects the legacy PyGreSQL (pgdb) driver (python3-pygresql) and often fails to save credentials properly in ~/.gnubg/gnubgautorc.

This script automates the entire setup in seconds so anyone can start tracking match statistics right away.


✨ Features

  • Dependency Auto-Check: Installs gnubg, postgresql, and python3-pygresql (uses nala if available, falls back to apt).
  • Init-System Safe: Works on both systemd (Debian/Ubuntu) and SysVinit (MX Linux default).
  • Interactive Credential TUI: Prompts for your database username and hidden password, then provisions the PostgreSQL superuser role safely.
  • Auto-Configures gnubg: Backs up your existing ~/.gnubg/gnubgautorc and injects the exact PythonPostgre settings gnubg expects.
  • Clean Management Flags: Includes --status, --backup, and --uninstall (removes only the database layer while keeping gnubg, themes, and .sgf files untouched).

πŸš€ Quick Start

Make sure GNU Backgammon is closed, open your terminal, and run:

Option A: One-Liner (No Download Needed)

bash <(curl -fsSL https://githubusercontent.com/postsonde/postsonde-gnubg-postgres/postsonde-gnubg-postgres.sh)

(Uses bash <(...) so interactive username and password prompts work properly.)

Option B: Download & Run Locally (for --status, --backup, --uninstall)

curl -fsSLO https://raw.githubusercontent.com/postsonde/postsonde-gnubg-postgres/main/postsonde-gnubg-postgres.sh
chmod +x postsonde-gnubg-postgres.sh
./postsonde-gnubg-postgres.sh

Final Step Inside GNU Backgammon

  1. Launch GNU Backgammon (gnubg).
  2. Go to Settings β†’ Options β†’ Database.
  3. Verify that PostgreSQL (Python) and your username/password are pre-filled, then click Login.
    (GNU Backgammon will automatically create the gnubg database and all required tables.)
  4. Click OK to close the options window.
  5. Important: In the top menu bar, click Settings β†’ Save settings so gnubg remembers your setup permanently.

πŸ› οΈ CLI Options & Maintenance

USAGE: ./postsonde-gnubg-postgres.sh [OPTION]

OPTIONS:
  (no option)       Interactive setup: deps, PostgreSQL role & gnubgautorc.
  -s, --status      Check packages, PostgreSQL daemon, DB & config.
  -b, --backup      Export 'gnubg' PostgreSQL database to an .sql dump.
  -u, --uninstall   Remove DB, role, config & DB pkgs (keeps gnubg & .sgf).
  -h, --help        Show this help message and exit.

Examples

  • Check if everything is running properly:
    ./postsonde-gnubg-postgres.sh --status
  • Export all your match statistics to an .sql file:
    ./postsonde-gnubg-postgres.sh --backup
  • Cleanly remove the database setup (without deleting gnubg or your saved matches):
    ./postsonde-gnubg-postgres.sh --uninstall

🎲🎲 Daily Cheat Sheet: Saving Matches & Stats

  • Save a match as a file (.sgf):
    Go to File β†’ Save (Ctrl + S).
  • Add a match to your PostgreSQL statistics database:
    1. Go to Analyse β†’ Analyse match or session
    2. Go to Analyse β†’ Add match or session to database

πŸ“œ License

GNU General Public License v3.0 (GNU GPLv3) πŸ„― All Lights returned postsonde


[Status: Active | postsonde.github.io | License: GNU GPLv3 | Simulated Gemini/Web Hybrid]