File tree Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Expand file tree Collapse file tree 1 file changed +42
-2
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ check_orioledb_enabled () {
4
+ local pg_conf=" /etc/postgresql/postgresql.conf"
5
+ if [ ! -f " $pg_conf " ]; then
6
+ return 0
7
+ fi
8
+ grep " ^shared_preload_libraries" " $pg_conf " | grep -c " orioledb" || return 0
9
+ }
10
+
11
+ get_shared_buffers () {
12
+ local opt_conf=" /etc/postgresql-custom/generated-optimizations.conf"
13
+ if [ ! -f " $opt_conf " ]; then
14
+ return 0
15
+ fi
16
+ grep " ^shared_buffers = " " $opt_conf " | cut -d " =" -f2 | tr -d ' ' || return 0
17
+ }
18
+
19
+ update_orioledb_buffers () {
20
+ local pg_conf=" /etc/postgresql/postgresql.conf"
21
+ local value=" $1 "
22
+ if grep -q " ^orioledb.main_buffers = " " $pg_conf " ; then
23
+ sed -i " s/^orioledb.main_buffers = .*/orioledb.main_buffers = $value /" " $pg_conf "
24
+ else
25
+ echo " orioledb.main_buffers = $value " >> " $pg_conf "
26
+ fi
27
+ }
28
+
29
+ main () {
30
+ local has_orioledb=$( check_orioledb_enabled)
31
+ if [ " $has_orioledb " -lt 1 ]; then
32
+ return 0
33
+ fi
34
+ local shared_buffers_value=$( get_shared_buffers)
35
+ if [ ! -z " $shared_buffers_value " ]; then
36
+ update_orioledb_buffers " $shared_buffers_value "
37
+ fi
38
+ }
39
+
40
+ # Initial locale setup
3
41
if [ $( cat /etc/locale.gen | grep -c en_US.UTF-8) -eq 0 ]; then
4
- echo " en_US.UTF-8 UTF-8" >> /etc/locale.gen
42
+ echo " en_US.UTF-8 UTF-8" >> /etc/locale.gen
5
43
fi
6
44
7
45
if [ $( locale -a | grep -c en_US.utf8) -eq 0 ]; then
8
- locale-gen
46
+ locale-gen
9
47
fi
48
+
49
+ main
You can’t perform that action at this time.
0 commit comments