Created
January 17, 2017 09:34
-
-
Save zinovyev/9d6df720a9569f376c7315199f18a80f to your computer and use it in GitHub Desktop.
pgadmin4 PKGBUILD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Ivan Zinovyev <[email protected]> | |
# based on https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pgadmin4 by Jan Alexander Steffens (heftig) <[email protected]> | |
# To reset settings/access rights remove .pgadmin folder in the home directory of the user who is launching the pgamdin4 script | |
# The service will be abailable at localhost:5050 and can be opened by the browser | |
pkgname=pgadmin4 | |
pkgver="1.1" | |
pkgrel=1 | |
epoch= | |
pkgdesc="pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database." | |
arch=("any") | |
url="https://www.pgadmin.org/download/source4.php" | |
license=("PostgreSQL") | |
groups=() | |
depends=( | |
"qt5-base" | |
"python" | |
"python-pip" | |
"postgresql" | |
"postgresql-libs" | |
"python-virtualenv" | |
"python-virtualenvwrapper" | |
) | |
makedepends=() | |
checkdepends=() | |
optdepends=() | |
provides=() | |
conflicts=() | |
replaces=() | |
backup=() | |
options=() | |
install= | |
changelog= | |
source=("https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v$pkgver/source/$pkgname-$pkgver.tar.gz") | |
noextract=() | |
md5sums=("daf3a710f983f3c243fd0cae265a6c79") | |
validpgpkeys=() | |
build() { | |
# Building the Runtime | |
cd "$pkgname-$pkgver/runtime" | |
qmake CONFIG+=release | |
make | |
# Configuring the Python Environment | |
cd .. | |
python -m venv pgadmin4 | |
source pgadmin4/bin/activate | |
PATH=$PATH:/usr/local/pgsql/bin pip install -r requirements_py3.txt | |
cat > "web/config_local.py" <<END | |
from config import * | |
# Debug mode | |
DEBUG = True | |
# App mode | |
SERVER_MODE = True | |
# Enable the test module | |
MODULE_BLACKLIST.remove('test') | |
# Log | |
CONSOLE_LOG_LEVEL = DEBUG | |
FILE_LOG_LEVEL = DEBUG | |
DEFAULT_SERVER = '127.0.0.1' | |
UPGRADE_CHECK_ENABLED = True | |
# Use a different config DB for each server mode. | |
if SERVER_MODE == False: | |
SQLITE_PATH = os.path.join( | |
DATA_DIR, | |
'pgadmin4-desktop.db' | |
) | |
else: | |
SQLITE_PATH = os.path.join( | |
DATA_DIR, | |
'pgadmin4-server.db' | |
) | |
END | |
echo "" > "web/config_local.py" | |
} | |
package() { | |
cd "$pkgname-$pkgver" | |
DESTDIR="$pkgdir/usr/lib/pgadmin4" | |
mkdir -p "$DESTDIR" | |
cp -r "." "$DESTDIR/" | |
BINDIR="$pkgdir/usr/bin" | |
mkdir -p "$BINDIR" | |
cat > "$BINDIR/pgadmin4" <<END | |
# ! /usr/bin/env bash | |
source /usr/lib/pgadmin4/pgadmin4/bin/activate | |
python /usr/lib/pgadmin4/web/pgAdmin4.py | |
END | |
SYSDIR="$pkgdir/etc/systemd/system" | |
mkdir -p "$SYSDIR" | |
cat > "$SYSDIR/pgadmin4.service" <<END | |
[Unit] | |
Description=pgadmin4 server | |
After=network.target | |
[Service] | |
Type=simple | |
User=root | |
ExecStart=/usr/bin/pgadmin4 | |
Restart=on-abort | |
[Install] | |
WantedBy=multi-user.target | |
END | |
chmod +x "$BINDIR/pgadmin4" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment