Compare commits

..

No commits in common. "882562d9e07ca77148e82b055b07931d5461518c" and "302978c20a8ff02f0b89e46c232fd5684e11c366" have entirely different histories.

View File

@ -167,6 +167,7 @@ function setup_postgresql() {
NEED_PG_INSTALL=true NEED_PG_INSTALL=true
fi fi
else else
msg_info "Setup PostgreSQL $PG_VERSION"
NEED_PG_INSTALL=true NEED_PG_INSTALL=true
fi fi
@ -187,24 +188,29 @@ function setup_postgresql() {
echo "deb https://apt.postgresql.org/pub/repos/apt ${DISTRO}-pgdg main" \ echo "deb https://apt.postgresql.org/pub/repos/apt ${DISTRO}-pgdg main" \
>/etc/apt/sources.list.d/pgdg.list >/etc/apt/sources.list.d/pgdg.list
$STD apt-get update
$STD msg_ok "Repository added" $STD msg_ok "Repository added"
$STD apt-get update
msg_info "Setup PostgreSQL $PG_VERSION" msg_info "Setup PostgreSQL $PG_VERSION"
$STD apt-get install -y "postgresql-${PG_VERSION}" "postgresql-client-${PG_VERSION}" $STD apt-get install -y "postgresql-${PG_VERSION}" "postgresql-client-${PG_VERSION}"
msg_ok "Setup PostgreSQL $PG_VERSION"
if [[ -n "$CURRENT_PG_VERSION" ]]; then if [[ -n "$CURRENT_PG_VERSION" ]]; then
$STD apt-get purge -y "postgresql-${CURRENT_PG_VERSION}" "postgresql-client-${CURRENT_PG_VERSION}" || true $STD apt-get purge -y "postgresql-${CURRENT_PG_VERSION}" "postgresql-client-${CURRENT_PG_VERSION}" || true
fi fi
$STD msg_info "Starting PostgreSQL $PG_VERSION"
systemctl enable -q --now postgresql systemctl enable -q --now postgresql
$STD msg_ok "PostgreSQL $PG_VERSION started"
if [[ -n "$CURRENT_PG_VERSION" ]]; then if [[ -n "$CURRENT_PG_VERSION" ]]; then
$STD msg_info "Restoring dumped data" msg_info "Restoring dumped data"
su - postgres -c "psql < /var/lib/postgresql/backup_$(date +%F)_v${CURRENT_PG_VERSION}.sql" su - postgres -c "psql < /var/lib/postgresql/backup_$(date +%F)_v${CURRENT_PG_VERSION}.sql"
$STD msg_ok "Data restored" msg_ok "Data restored"
fi fi
$STD msg_ok "PostgreSQL $PG_VERSION installed" msg_ok "PostgreSQL $PG_VERSION installed"
fi fi
# Install optional PostgreSQL modules # Install optional PostgreSQL modules
@ -212,13 +218,13 @@ function setup_postgresql() {
IFS=',' read -ra MODULES <<<"$PG_MODULES" IFS=',' read -ra MODULES <<<"$PG_MODULES"
for module in "${MODULES[@]}"; do for module in "${MODULES[@]}"; do
local pkg="postgresql-${PG_VERSION}-${module}" local pkg="postgresql-${PG_VERSION}-${module}"
$STD msg_info "Setup PostgreSQL module/s: $pkg" msg_info "Setup PostgreSQL module/s: $pkg"
$STD apt-get install -y "$pkg" || { $STD apt-get install -y "$pkg" || {
msg_error "Failed to install $pkg" msg_error "Failed to install $pkg"
continue continue
} }
done done
$STD msg_ok "Setup PostgreSQL modules" msg_ok "Setup PostgreSQL modules"
fi fi
} }
@ -1406,7 +1412,7 @@ function setup_gs() {
return return
fi fi
msg_info "Setup Ghostscript $LATEST_VERSION_DOTTED (Patience)" msg_info "Setup Ghostscript $LATEST_VERSION_DOTTED"
curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${LATEST_VERSION}/ghostscript-${LATEST_VERSION_DOTTED}.tar.gz" -o "$TMP_DIR/ghostscript.tar.gz" curl -fsSL "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs${LATEST_VERSION}/ghostscript-${LATEST_VERSION_DOTTED}.tar.gz" -o "$TMP_DIR/ghostscript.tar.gz"
if ! tar -xzf "$TMP_DIR/ghostscript.tar.gz" -C "$TMP_DIR"; then if ! tar -xzf "$TMP_DIR/ghostscript.tar.gz" -C "$TMP_DIR"; then