diff --git a/bin/postgresql b/bin/postgresql new file mode 100644 index 0000000..5b3c341 --- /dev/null +++ b/bin/postgresql @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +export PGVER="${PGVER:-13}" +export PGBASE="${PGBASE:-/var/lib/postgresql}" +export PGDATA="${PGDATA:-$PGBASE/$PGVER/data}" +export PGLANG="${PGLANG:-en_US.utf8}" + +case $1 in + stop) pg_ctl stop -D "${PGDATA}" ;; + reload) pg_ctl reload -D "${PGDATA}" ;; + *) + pid=/tmp/postgresql.pid + log=${PGDATA}/postgresql.log + + if test ! -f "${PGDATA}/PG_VERSION" ; then + /usr/bin/initdb --locale "${PGLANG}" -E UTF8 -D "${PGDATA}" + + echo "host all all samenet trust" >> "${PGDATA}/pg_hba.conf" + + echo "listen_addresses = '*'" >> "${PGDATA}/postgresql.conf" + echo "external_pid_file = '${pid}'" >> "${PGDATA}/postgresql.conf" + fi + + rm -f "${pid}" + daemonize -c "${PGDATA}" -o "${log}" -a -e "${log}" /usr/bin/postgres + ;; +esac diff --git a/haini.sh b/haini.sh index d2ff0f2..bb0bcfd 100755 --- a/haini.sh +++ b/haini.sh @@ -34,6 +34,7 @@ correr() { RAILS_ENV="${RAILS_ENV:-development}" \ JEKYLL_ENV="${JEKYLL_ENV:-development}" \ EDITOR="nano" \ + PAGER="less -niSFX" \ bwrap \ --unshare-user-try \ --unshare-ipc \ @@ -74,6 +75,9 @@ crear_entorno() { # Descargar y extraer Alpine test -f "$ENTORNO/etc/os-release" || ${download} "${ALPINE_URL}" | tar xz --directory "$ENTORNO" + # Configurar los repositorios de Sutty + grep -q sutty "$ENTORNO/etc/apk/repositories" || echo "https://alpine.sutty.nl/alpine/v${ALPINE%\.*}/sutty" >> "$ENTORNO/etc/apk/repositories" + test -f "$ENTORNO/etc/apk/keys/alpine@sutty.nl-5ea884cd.rsa.pub" || wget https://alpine.sutty.nl/alpine/sutty.pub -O "$ENTORNO/etc/apk/keys/alpine@sutty.nl-5ea884cd.rsa.pub" # Instalar las dependencias solo si cambiaron if test "$ENTORNO/etc/apk/world" -ot "$DIR/packages"; then @@ -95,6 +99,11 @@ crear_entorno() { # Resaltado de sintaxis en nano grep -q "^include " "$ENTORNO/etc/nanorc" || echo "include \"/usr/share/nano/*.nanorc\"" >> "$ENTORNO/etc/nanorc" + + # Instalar scripts + for script in "$DIR/bin/"*; do + install -m 755 "$script" "$ENTORNO/usr/local/bin/${script##*/}" + done } crear_entorno diff --git a/packages b/packages index cd624b2..34fc026 100644 --- a/packages +++ b/packages @@ -1,4 +1,5 @@ bash +daemonize ffmpeg file git @@ -13,6 +14,8 @@ nano-syntax ncurses-terminfo nginx nodejs +postgresql +postgresql-contrib postgresql-libs py3-brotli py3-cffi