Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Updating naming to DBFS in makefile (#2)
Browse files Browse the repository at this point in the history
* make file updates

* adding .txtto license

* fixing case issues

* dmvtool to dbfs updates

* package name update

* read me updates
  • Loading branch information
Raymondd committed Apr 18, 2017
1 parent 102dd68 commit b766dfe
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 92 deletions.
8 changes: 4 additions & 4 deletions .gitignore
@@ -1,11 +1,11 @@
output/
source/*.o
source/dmvtool
debian/dmvtool/
source/dbfs
debian/dbfs/
debian/changelog
debian/control
debian/dmvtool.debhelper.log
debian/dmvtool.substvars
debian/dbfs.debhelper.log
debian/dbfs.substvars
debian/files
debian/debhelper-build-stamp
.obj/
28 changes: 14 additions & 14 deletions Makefile
@@ -1,4 +1,4 @@
TARGET=dmvtool
TARGET=dbfs
TARGET_SRC_DIR=source
TARGET_DIR=output
TARGET_BIN_DIR=$(TARGET_DIR)/bin
Expand All @@ -10,7 +10,7 @@ DESTDIR ?= /
OBJDIR :=.obj

## Common packaging variables
DMVTOOL_PACKAGE_VERSION=$(shell cat version.txt)
DBFS_PACKAGE_VERSION=$(shell cat version.txt)

## Debian packaging variables
DEB_PACKAGE_NAME=$(TARGET)
Expand All @@ -30,14 +30,14 @@ $(TARGET):

install: $(TARGET)
$(AT)mkdir -p $(DESTDIR)/usr/bin/
$(AT)mkdir -p $(DESTDIR)/opt/mssql-dmvtool/
$(AT)mkdir -p $(DESTDIR)/usr/share/doc/dmvtool/
$(AT)mkdir -p $(DESTDIR)/opt/mssql-dbfs/
$(AT)mkdir -p $(DESTDIR)/usr/share/doc/dbfs/

$(AT)cp $(TARGET_SRC_DIR)/$(TARGET) $(DESTDIR)/opt/mssql-dmvtool/
$(AT)ln -sf /opt/mssql-dmvtool/dmvtool $(DESTDIR)/usr/bin/dmvtool
$(AT)cp $(TARGET_SRC_DIR)/$(TARGET) $(DESTDIR)/opt/mssql-dbfs/
$(AT)ln -sf /opt/mssql-dbfs/dbfs $(DESTDIR)/usr/bin/dbfs

$(AT)cp common/LICENSE.TXT $(DESTDIR)/usr/share/doc/dmvtool/
$(AT)cp common/THIRDPARTYNOTICES.TXT $(DESTDIR)/usr/share/doc/dmvtool
$(AT)cp common/LICENSE.TXT $(DESTDIR)/usr/share/doc/dbfs/
$(AT)cp common/THIRDPARTYNOTICES.TXT $(DESTDIR)/usr/share/doc/dbfs

# Need to copy the libc++* libraries when making the RHEL package
#
Expand All @@ -56,7 +56,7 @@ clean:
$(AT)rm -rf $(OBJDIR)
$(AT)rm -rf $(TARGET_DIR)
$(AT)make clean --no-print-directory -C $(TARGET_SRC_DIR)
$(AT)rm -rf debian/dmvtool
$(AT)rm -rf debian/dbfs
$(AT)rm -rf debian/files

package-ubuntu:
Expand All @@ -66,9 +66,9 @@ package-ubuntu:
_package-ubuntu:
@echo [DEBUILD] Building Debian package

$(AT)echo "$(DEB_PACKAGE_NAME) ($(DMVTOOL_PACKAGE_VERSION)) stable; urgency=medium" > debian/changelog
$(AT)echo "$(DEB_PACKAGE_NAME) ($(DBFS_PACKAGE_VERSION)) stable; urgency=medium" > debian/changelog
$(AT)echo "" >> debian/changelog
$(AT)echo " * DMVTool v($(DMVTOOL_PACKAGE_VERSION)) release" >> debian/changelog
$(AT)echo " * dbfs v($(DBFS_PACKAGE_VERSION)) release" >> debian/changelog
$(AT)echo "" >> debian/changelog
$(AT)echo " -- Microsoft Data Platform Group <dpgswdist@microsoft.com> $(shell date +'%a, %d %b %Y %H:%M:%S %z')" >> debian/changelog
$(AT)echo "" >> debian/changelog
Expand All @@ -79,7 +79,7 @@ _package-ubuntu:
$(AT)debuild $(LINTIAN) --preserve-env -b -us -uc 2>&1
$(AT)mkdir -p $(TARGET_DIR)/packages/ubuntu

$(AT)rsync -av ../$(DEB_PACKAGE_NAME)_$(DMVTOOL_PACKAGE_VERSION)_amd64.* $(DROP_DIRECTORY)/packages/ubuntu
$(AT)rsync -av ../$(DEB_PACKAGE_NAME)_$(DBFS_PACKAGE_VERSION)_amd64.* $(DROP_DIRECTORY)/packages/ubuntu

$(AT)rm -f ../$(DEB_PACKAGE_NAME)_*_amd64.*

Expand All @@ -93,6 +93,6 @@ _package-rhel7:
$(AT)mkdir -p $(OBJDIR)/rhel7
$(AT)mkdir -p $(DROP_DIRECTORY)/packages/rhel7

$(AT) cp rhel7/dmvtool.spec.tmpl $(OBJDIR)/rhel7/dmvtool.spec
$(AT)rpmbuild --define "_srcdir $$(pwd)" --define "_topdir $$(realpath $(OBJDIR)/rhel7/rpmbuild)" -bb $(OBJDIR)/rhel7/dmvtool.spec
$(AT) cp rhel7/dbfs.spec.tmpl $(OBJDIR)/rhel7/dbfs.spec
$(AT)rpmbuild --define "_srcdir $$(pwd)" --define "_topdir $$(realpath $(OBJDIR)/rhel7/rpmbuild)" -bb $(OBJDIR)/rhel7/DBFS.spec
$(AT)mv $(OBJDIR)/rhel7/rpmbuild/RPMS/x86_64/* $(DROP_DIRECTORY)/packages/rhel7
107 changes: 51 additions & 56 deletions README.md
Expand Up @@ -15,75 +15,70 @@ The [Microsoft Enterprise and Developer Privacy Statement](https://go.microsoft.
This extension is licensed under the MIT License. Please see the third-party notices file for additional copyright notices and license terms applicable to portions of the software.

# Installation
1. Download and install all of the follow runtime dependencies:


2. Download the .deb release package from this Github.

1. Download the .deb release package from this Github.
3. Run the following command:
dpkg -i release.deb

`dpkg -i <downloaded_package.deb>`
4. You can get any missing dependencies by running:
`apt-get -f install`
or installing them manually

Check if your installation was successfull by running:
dbfs -h

`dbfs -h`

# Usage
Setup:
`dbfs -m <mount-path> -c <conf-file-path> [OPTIONS]`

dbfs -m <mount-path> -c <conf-file-path> [OPTIONS]

Required:
-m/--mount-path : The mount directory for SQL server(s) DMV files
-c/--conf-file : Location of .conf file.

Options:
-d/--dump-path : The dump directory used. Default = "/tmp/sqlserver"
-v/--verbose : Start in verbose mode
-l/--log-file : Path to the log file (only used if in verbose mode)
-f : Run the DMVTool in foreground
-h : Print usage


Configuration file needs to be of the following format:
[server]
hostname=<>
username=<>
password=<>
version=<>

Example:
[server]
hostname=00.000.000.000
username=MyUserName
password=MyPassword
version=16

Password is optional. If it is not provided for a server entry - user will be prompted for the password.
Required:\
-m/--mount-path : The mount directory for SQL server(s) DMV files\
-c/--conf-file : Location of .conf file.\

Optional:\
-d/--dump-path : The dump directory used. Default = "/tmp/sqlserver"\
-v/--verbose : Start in verbose mode\
-l/--log-file : Path to the log file (only used if in verbose mode)\
-f : Run DBFS in foreground\
-h : Print usage

Configuration file needs to be of the following format:\
[server]\
hostname=<>\
username=<>\
password=<>\
version=<>

Example:\
[server]\
hostname=00.000.000.000\
username=MyUserName\
password=MyPassword\
version=16

The password is optional. If it is not provided for a server entry - user will be prompted for the password.
There can be multiple such entries in the configuration file.

# Building
To build the project:
make

To build the project - you will need certain packages.
Use the below command to install all of them:
sudo apt-get install \
freetds-dev \
# Building
Install the following packages:\
sudo apt-get install\
freetds-dev\
freetds-bin\
libunwind-dev \
fuse \
libfuse2 \
libfuse-dev \
libattr1-dev \
libavahi-common-dev \
libunwind-dev\
fuse\
libfuse2\
libfuse-dev\
libattr1-dev\
libavahi-common-dev\
-y


To build the project:
Run `make` from root

To build the ubuntu package:
make package-ubuntu
Run `make package-ubuntu` from root

# Issues
Please let us know of any issues you may have by filing an issue on this Github.

In the rare event of a program crash, the fuse module will need to be manually un-mounted.
- use command:: fusermount -u <mount_directory>
In the rare event of a program crash, the fuse module will need to be manually un-mounted.\
- use command: `fusermount -u <mount_directory>`\
- The 'mount_directory' should be same as the one passed at program startup.
File renamed without changes.
8 changes: 4 additions & 4 deletions debian/control.tmpl
@@ -1,4 +1,4 @@
Source: dmvtool
Source: dbfs
Section: misc
Priority: extra
Build-Depends: debhelper (>=9),
Expand All @@ -11,11 +11,11 @@ Build-Depends: debhelper (>=9),
libavahi-common-dev
Maintainer: Microsoft Data Platform Group <dpgswdist@microsoft.com>

Package: dmvtool
Package: dbfs
Section: misc
Priority: extra
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: DMVTool 0.2
This package contains the DMVTool which can be used to fetch certain DMV from SQL Servers using FUSE filesystem
Description: dbfs 0.1.5
This package contains the DBFS tool which can be used to fetch certain DMV from SQL Servers using FUSE filesystem

2 changes: 1 addition & 1 deletion debian/rules
Expand Up @@ -3,7 +3,7 @@
override_dh_usrlocal:

override_dh_auto_install:
make -e -j install DESTDIR=$$(pwd)/debian/dmvtool
make -e -j install DESTDIR=$$(pwd)/debian/dbfs

%:
dh $@
6 changes: 3 additions & 3 deletions rhel7/dmvtool.spec.tmpl
@@ -1,4 +1,4 @@
Name: dmvtool
Name: dbfs
Version: 0.1.5
Release: 0
Summary: Microsoft DBFS 0.1.5
Expand All @@ -20,6 +20,6 @@ make install DESTDIR=%{buildroot}
%files
%defattr(-, root, root)
/usr/bin/*
/opt/mssql-dmvtool/*
/usr/share/doc/dmvtool/*
/opt/mssql-dbfs/*
/usr/share/doc/dbfs/*
/usr/lib64/*
2 changes: 1 addition & 1 deletion source/Makefile
Expand Up @@ -4,7 +4,7 @@ include common.mk

SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.cpp=.o)
TARGET=dmvtool
TARGET=dbfs
OBJDIR :=.obj

all: $(TARGET)
Expand Down
18 changes: 9 additions & 9 deletions source/main.cpp
Expand Up @@ -29,7 +29,7 @@ std::unordered_map<std::string, class ServerInfo*> g_ServerInfoMap;
//
bool g_UseLogFile;

// Global variable used to track if DMVTool needs to be started in foreground
// Global variable used to track if DBFS needs to be started in foreground
//
bool g_RunInForeground;

Expand All @@ -55,7 +55,7 @@ PrintUsageAndExit(
" -d/--dump-path : The dump directory used. Default = \"/tmp/sqlserver\" [OPTIONAL]\n"
" -v/--verbose : Start in verbose mode [OPTIONAL]\n"
" -l/--log-file : Path to the log file (only used if in verbose mode) [OPTIONAL]\n"
" -f : Run the DMVTool in foreground [OPTIONAL]\n"
" -f : Run DBFS in foreground [OPTIONAL]\n"
" -h : Print usage"
"\n", command);
exit(-EINVAL);
Expand Down Expand Up @@ -448,19 +448,19 @@ QueryUserForPassword(
string servername,
string& password)
{
termios oldt;
termios oldt;
termios newt;
int result;
int status = false;

// Hide user input from terminal
//
result = tcgetattr(STDIN_FILENO, &oldt);

if (!result)
{
newt = oldt;
newt.c_lflag &= ~ECHO;
result = tcgetattr(STDIN_FILENO, &oldt);

if (!result)
{
newt = oldt;
newt.c_lflag &= ~ECHO;
result = tcsetattr(STDIN_FILENO, TCSANOW, &newt);
}

Expand Down

0 comments on commit b766dfe

Please sign in to comment.