-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize
executable file
·48 lines (40 loc) · 1.56 KB
/
customize
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/bash
#
# Put customizations to your image in this file.
PATH=/opt/local/gnu/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/usr/sbin
# Munin plugins
MUNIN_PLUGINS="
"
# Exit if any commands fail
set -o errexit
echo "* Activate munin plugins"
/opt/qutic/bin/munin-node-plugins ${MUNIN_PLUGINS}
echo "* Setup pgsql data-path"
mkdir -p /var/pgsql/data
chown -R postgres:postgres /var/pgsql
mkdir -p /var/log/postgresql
chown postgres:postgres /var/log/postgresql
# allow postgres login
sed -i \
's#postgres:x:907:907:PostgreSQL database administrator:/var/pgsql:/usr/bin/false#postgres:x:907:907:PostgreSQL database administrator:/var/pgsql:/usr/bin/bash#' \
/etc/passwd
# su - postgres -c '/opt/local/bin/initdb -D /var/pgsql/data'
# setup log path
sed -i \
's#/var/log/postgresql.log#/var/log/postgresql/postgresql.log#' \
/opt/local/lib/svc/manifest/postgresql.xml
svccfg import /opt/local/lib/svc/manifest/postgresql.xml
# link config files into config
ln -nfs /var/pgsql/data/pg_hba.conf /opt/local/etc/postgresql/pg_hba.conf
ln -nfs /var/pgsql/data/pg_ident.conf /opt/local/etc/postgresql/pg_ident.conf
ln -nfs /var/pgsql/data/postgresql.conf /opt/local/etc/postgresql/postgresql.conf
echo "* Setup postgresql path"
mkdir -p /var/backups/postgresql
chmod 0750 /var/backups/postgresql
chown postgres:postgres /var/backups/postgresql
echo "0 1 * * * /opt/qutic/bin/psql_backup" > /var/spool/cron/crontabs/postgres
chown root:postgres /var/spool/cron/crontabs/postgres
echo "* Cleaning up"
rm /root/customize
cp /etc/skel/.bashrc /root/.bashrc
sm-prepare-image -y