Add freetds.install_from_source()

This commit is contained in:
Lance Edgar 2019-09-13 13:19:52 -05:00
parent b9c8a8d104
commit 0430829c02

View file

@ -0,0 +1,52 @@
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
"""
Fabric Library for FreeTDS
"""
from rattail_fabric2 import apt, exists, mkdir
def install_from_source(c, user='rattail'):
"""
Install the FreeTDS library from source.
Per instructions found here:
https://github.com/FreeTDS/freetds/blob/master/INSTALL.GIT
"""
apt.install(
c,
'automake',
'autoconf',
'gettext',
'pkg-config',
)
if not exists(c, '/usr/local/src/freetds'):
mkdir(c, '/usr/local/src/freetds', owner=user, use_sudo=True)
c.sudo('git clone https://github.com/FreeTDS/freetds.git /usr/local/src/freetds', user=user)
if not exists(c, '/usr/local/lib/libtdsodbc.so'):
c.sudo("bash -c 'cd /usr/local/src/freetds; ./autogen.sh'", user=user)
c.sudo("bash -c 'cd /usr/local/src/freetds; make'", user=user)
c.sudo("bash -c 'cd /usr/local/src/freetds; make install'") # as root