Skip to content

Commit 14a289c

Browse files
committed
Database Setup Script Added
1 parent 69e63c6 commit 14a289c

2 files changed

Lines changed: 73 additions & 1 deletion

File tree

scripts/dbsetup

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
3+
if [ -f /etc/os-release ]; then
4+
. /etc/os-release
5+
OS=$NAME
6+
if [ $OS == "Fedora" ]; then
7+
echo "=========================================="
8+
echo "============Welcome User ================="
9+
echo "=========================================="
10+
VER=$VERSION_ID
11+
if [ $VER == 26 ]; then
12+
echo "$OS $VER"
13+
dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-26-x86_64/pgdg-fedora10-10-3.noarch.rpm -y
14+
dnf install postgresql10 postgresql10-server -y
15+
dnf install pgadmin3 phppgadmin -y
16+
/usr/pgsql-10/bin/postgresql-10-setup initdb
17+
18+
# Modification /var/lib/pgsql/10/data/pg_hba.conf Note: User will do manually
19+
echo "==================================================="
20+
echo "==================================================="
21+
echo " Note: Modify /var/lib/pgsql/10/data/pg_hba.conf"
22+
echo "For that please Read instruction from README.md"
23+
echo "==================================================="
24+
echo "==================================================="
25+
26+
systemctl start postgresql-10.service
27+
systemctl enable postgresql-10.service
28+
29+
#Creating Test Database and Create New User
30+
useradd postgres
31+
mkdir /usr/pgsql-10/data
32+
chown postgres:postgres /usr/pgsql-10/data
33+
su - postgres -c "/usr/pgsql-10/bin/initdb /usr/pgsql-10/data/; sleep 2s; /usr/pgsql-10/bin/pg_ctl -D /usr/pgsql-10/data/ -l logfile start"
34+
firewall-cmd --permanent --zone=public --add-service=postgresql
35+
firewall-cmd --permanent --zone=public --add-port=5432/tcp
36+
systemctl restart firewalld.service
37+
systemctl enable firewalld.service
38+
39+
elif [ $VER == 27 ]; then
40+
echo "Version 27"
41+
dnf install https://download.postgresql.org/pub/repos/yum/10/fedora/fedora-27-x86_64/pgdg-fedora10-10-3.noarch.rpm -y
42+
dnf install postgresql10 postgresql10-server -y
43+
dnf install pgadmin3 phpPgAdmin -y
44+
/usr/pgsql-10/bin/postgresql-10-setup initdb
45+
46+
# Modification /var/lib/pgsql/10/data/pg_hba.conf
47+
echo "==================================================="
48+
echo "==================================================="
49+
echo " Note: Modify /var/lib/pgsql/10/data/pg_hba.conf"
50+
echo "For that please Read instruction from README.md"
51+
echo "==================================================="
52+
echo "==================================================="
53+
54+
systemctl start postgresql-10.service
55+
systemctl enable postgresql-10.service
56+
57+
#Creating Test Database and Create New User
58+
59+
useradd postgres
60+
mkdir /usr/pgsql-10/data
61+
chown postgres:postgres /usr/pgsql-10/data
62+
su - postgres -c "/usr/pgsql-10/bin/initdb /usr/pgsql-10/data/; sleep 2s; /usr/pgsql-10/bin/pg_ctl -D /usr/pgsql-10/data/ -l logfile start"
63+
firewall-cmd --permanent --zone=public --add-service=postgresql
64+
firewall-cmd --permanent --zone=public --add-port=5432/tcp
65+
systemctl restart firewalld.service
66+
systemctl enable firewalld.service
67+
fi
68+
fi
69+
fi

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@
2121
keywords="clitool bookmark readit",
2222
url="https://github.com/ganeshhubale/readit",
2323
py_modules=[],
24-
packages=['manager', ],
24+
packages=find_packages(),
2525
namespace_packages=[],
2626

2727
include_package_data=True,
2828
zip_safe=False,
2929

3030
install_requires=install_requires,
31+
scripts=[
32+
'scripts/dbsetup'
33+
],
3134
)
3235

3336

0 commit comments

Comments
 (0)