postgresql.güncellendi

This commit is contained in:
milisbir 2018-09-25 13:22:54 +03:00
parent e2142c3d1c
commit 60e3a8aa53
6 changed files with 157 additions and 9 deletions

View File

@ -0,0 +1,49 @@
#!/bin/sh
# This script verifies that the postgresql data directory has been correctly
# initialized. We do not want to automatically initdb it, because that has
# a risk of catastrophic failure (ie, overwriting a valuable database) in
# corner cases, such as a remotely mounted database on a volume that's a
# bit slow to mount. But we can at least emit a message advising newbies
# what to do.
PGDATA="$1"
if [ -z "$PGDATA" ]
then
echo "Usage: $0 database-path"
exit 1
fi
# PGMAJORVERSION is major version
PGMAJORVERSION=10
# PREVMAJORVERSION is the previous major version
PREVMAJORVERSION=9.6
# Check for the PGDATA structure
if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]
then
# Check version of existing PGDATA
if [ x`cat "$PGDATA/PG_VERSION"` = x"$PGMAJORVERSION" ]
then
: A-OK
elif [ x`cat "$PGDATA/PG_VERSION"` = x"$PREVMAJORVERSION" ]
then
echo $"An old version of the database format was found."
echo $"type postgresql_db_yukselt.sh"
exit 1
else
echo $"An old version of the database format was found."
echo $"You need to dump and reload before using PostgreSQL $PGMAJORVERSION."
echo $"See http://www.postgresql.org/docs/$PGMAJORVERSION/static/upgrading.html"
exit 1
fi
else
# No existing PGDATA! Warn the user to initdb it.
echo $"\"$PGDATA\" is missing or empty. Use a command like"
echo $" su - postgres -c \"initdb --locale en_US.UTF-8 -D '$PGDATA'\""
echo $"with relevant options, to initialize the database cluster."
exit 1
fi
exit 0

View File

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/sh
pg_dumpall > /srv/pgsql/yedek/yedek-9.6.3 su - postgres -c 'mkdir -p /srv/pgsql/yedek'
su - postgres -c 'pg_dumpall > /srv/pgsql/yedek/yedek-9.6.3'

View File

@ -0,0 +1,9 @@
/var/log/postgresql {
daily
rotate 7
copytruncate
delaycompress
compress
notifempty
missingok
}

View File

@ -0,0 +1,3 @@
auth required pam_unix.so
account required pam_unix.so
session required pam_unix.so

View File

@ -0,0 +1,44 @@
#!/bin/sh
PGDATA="$1"
PGBACKUP="$2"
if [ -z "$PGDATA" ]
then
echo "Usage: $0 database-path backup-sql"
exit 1
fi
if [ -z "$PGBACKUP" ]
then
echo "Usage: $0 database-path backup-sql"
echo "Usage example:$0 /srv/pgsql/data /srv/pgsql/yedek/yedek-9.6.3"
exit 1
fi
if [ ! -f "$PGBACKUP" ]
then
echo "$PGBACKUP not found"
echo "Usage example:$0 /srv/pgsql/data /srv/pgsql/yedek/yedek-9.6.3"
exit 1
fi
# servis durdurulur.
servis postgresql stop
# eski yedeğe alınır.
_ustdizin=$(dirname $PGDATA)
mv ${_ustdizin}/data ${_ustdizin}/eskidata
# yeni dizin ve izinleri atanır.
mkdir ${_ustdizin}/data
chown postgres:postgres ${_ustdizin}/data
# yeni vt oluşturulur.
su - postgres -c '/usr/bin/initdb -E UTF8 -D /srv/pgsql/data'
servis postgresql start
sleep 3
su - postgres -c "psql -f $PGBACKUP"

View File

@ -1,26 +1,68 @@
# Tanım: Gelişmiş nesne-ilişkisel veritabanı yönetim sistemi (ORDBMS). # Tanım: Gelişmiş nesne-ilişkisel veritabanı yönetim sistemi (ORDBMS).
# URL: http://www.postgresql.org/docs # URL: http://www.postgresql.org/docs
# Paketçi: milisarge # Paketçi: milisarge
# Gerekler: # Gerekler: python3
# Grup: sistem # Grup: sistem
isim=postgresql isim=postgresql
surum=9.6.3 surum=10.5
devir=1 devir=1
kaynak=(https://ftp.postgresql.org/pub/source/v$surum/postgresql-$surum.tar.bz2) kaynak=(https://ftp.postgresql.org/pub/source/v$surum/postgresql-$surum.tar.bz2
postgresql.logrotate
postgresql.pam
postgresql-check-db-dir
postgresql_db_yukselt)
derle() { derle() {
cd $isim-$surum cd $isim-$surum
sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h && sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h &&
./configure --prefix=/usr \ ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--includedir=/usr/include \
--datarootdir=/usr/share \
--datadir=/usr/share/postgresql \
--with-openssl \
--with-tcl \
--with-perl \
--with-pam \
--with-python \
--with-libxml \
--with-libxslt \
--enable-thread-safety \ --enable-thread-safety \
--with-openssl --with-system-tzdata=/usr/share/zoneinfo \
--enable-nls \
--disable-rpath
make make
make DESTDIR=$PKG install make DESTDIR=$PKG install
cd doc/src/sgml
make DESTDIR=$PKG install-man PG_EXTENSIONS=${PG_EXTENSIONS:-"adminpack pgcrypto ltree xml2 postgres_fdw file_fdw hstore citext"}
rm -rf $PKG/usr/share/doc
if [ "x$PG_EXTENSIONS" = "xALL" ];then
cd $SRC/$isim-$surum/contrib
make all
make install-strip DESTDIR=$PKG
else
for ext in $PG_EXTENSIONS; do
cd $SRC/$isim-$surum/contrib/$ext
make
make install-strip DESTDIR=$PKG
done
fi
# logrotate betiği
mkdir -p $PKG/etc/logrotate.d
cat $SRC/$isim.logrotate > $PKG/etc/logrotate.d/$isim
mkdir -p "${PKG}/etc/pam.d"
install -Dm 755 "${SRC}/postgresql-check-db-dir" -t "${PKG}/usr/bin"
install -Dm 755 "${SRC}/postgresql_db_yukselt" -t "${PKG}/usr/bin"
install -Dm 644 "${SRC}/postgresql.pam" "${PKG}/etc/pam.d/postgresql"
cd /sources/milis.git/ayarlar/servisler cd /sources/milis.git/ayarlar/servisler
make DESTDIR=$PKG kur-$isim make DESTDIR=$PKG kur-$isim
rm -rf $PKG/usr/share/doc
rm -rf $PKG/etc/sysconfig
} }