debian/ubuntu packages

pull/2/head
elinamorits 8 years ago
parent 58c75eb0d2
commit 86a214574d

@ -1,3 +1,7 @@
#
# Building:
#
all: build
git-secret: src/_utils/* src/commands/* src/main.sh
@ -9,6 +13,10 @@ clean:
build: git-secret
#
# Testing:
#
install-test:
git clone https://github.com/sstephenson/bats.git vendor/bats
@ -19,16 +27,24 @@ test:
rm -rf temp; mkdir temp; cd temp; \
bats "../tests";
install-man:
gem install ronn
#
# Manuals:
#
install-ronn:
@if [ ! `gem list ronn -i` == "true" ]; then gem install ronn; fi
build-man:
@if [ ! `gem list ronn -i` == "true" ]; then make install-man; fi
@make install-ronn
ronn --roff man/man1/*.ronn
build-gh-pages:
@/usr/bin/env bash utils/gh-branch.sh
#
# Development:
#
install-hooks:
@# pre-commit:
@ln -fs "${PWD}/utils/pre-commit.sh" "${PWD}/.git/hooks/pre-commit"
@ -38,3 +54,16 @@ install-hooks:
@chmod +x "${PWD}/.git/hooks/post-commit"
develop: clean build install-hooks
#
# Packaging:
#
install-fpm:
@if [ ! `gem list fpm -i` == "true" ]; then gem install fpm; fi
build-deb: clean build
@make install-fpm
@chmod +x "${PWD}/utils/build-deb.sh"
@"./utils/build-deb.sh"

@ -25,7 +25,7 @@ This project is still under development. Current objectives:
## Testing
For testing this project uses [`bats`](1). You can install it by running `make install-test`.
To run tests call: `make test`. It will download and install `bats` into `vandor/bats` if it's not installed yet.
To run tests call: `make test`. It will download and install `bats` into `vendor/bats` if it's not installed yet.
[1]: https://github.com/sstephenson/bats

@ -9,7 +9,7 @@
There's a known problem in server configuration and deploying, when you have to store your private data such as: database passwords, application secret-keys, OAuth secret keys and so on, outside of the git repository. Even if this repository is private, it is a security risk to just publish them into the world wide web. What are the drawbacks of storing them separately?
1. These files are not version controlled. Filenames change, locations change, passwords change from time to time, some new information appears, other is removed. And you can not tell for sure which version of the configuration file was used with each commit.
2. When building the automated deploment system there will be one extra step: download and place these secret-configuration files where they need to be. So you have to maintain an extra secure server, where everything is stored.
2. When building the automated deployment system there will be one extra step: download and place these secret-configuration files where they need to be. So you have to maintain an extra secure server, where everything is stored.
### How does `git-secret` solve these problems?

@ -1,5 +1,7 @@
#!/usr/bin/env bash
GITSECRET_VERSION="0.1.0"
# Global variables:
WORKING_DIRECTORY="$PWD"

@ -29,19 +29,29 @@ function _incorrect_usage {
}
function _init_script {
# checking for proper set-up:
_check_setup
function _show_version {
echo "$GITSECRET_VERSION"
exit 0
}
function _init_script {
if [[ $# == 0 ]]; then
_incorrect_usage "no input parameters provided." 126
fi
if [[ $1 == "--version" ]]; then
_show_version
fi
# checking for proper set-up:
_check_setup
# load dependencies:
# for f in ${0%/*}/src/*/*; do [[ -f "$f" ]] && . "$f"; done
# routing the input command:
if [[ $(_function_exists "$1") == 0 ]] && [[ ! $1 == _* ]]; then
if [[ $(_function_exists $1) == 0 ]] && [[ ! $1 == _* ]]; then
$1 "${@:2}"
else
_incorrect_usage "command $1 not found." 126

@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -e
# Initializing and settings:
READ_PEM=0744
EXEC_PEM=0755
SCRIPT_NAME="git-secret"
SCRIPT_DESCRIPTION="A bash-tool to store your private data inside a git repository."
SCRIPT_VERSION=$(bash ${PWD}/git-secret --version)
: ${SCRIPT_EPOCH:=0}
: ${SCRIPT_ITERATION:=1}
if [[ -z "$SCRIPT_BUILD_DIR" ]]; then
SCRIPT_BUILD_DIR="${HOME}/debbuild-${SCRIPT_NAME}"
fi
SCRIPT_DEST_DIR="${SCRIPT_BUILD_DIR}/installroot"
# Preparing the files
rm -rf "$SCRIPT_BUILD_DIR"
mkdir -p "$SCRIPT_DEST_DIR"
# Coping the files inside the build folder:
install -b -m "$EXEC_PEM" "git-secret" "${SCRIPT_DEST_DIR}/git-secret"
install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/man/man1"
for file in man/man1/* ; do
if [[ "$file" == *.ronn ]]; then
continue
fi
install -b -m "$READ_PEM" "$file" "${SCRIPT_DEST_DIR}/${file}"
done
# Building .deb package:
cd "$SCRIPT_DEST_DIR" && fpm -s dir -t deb \
-a all \
-n "$SCRIPT_NAME" \
-d git \
-d gpg \
--epoch "$SCRIPT_EPOCH" \
--version "$SCRIPT_VERSION" \
--iteration "$SCRIPT_ITERATION" \
--description="$SCRIPT_DESCRIPTION" \
-C "$SCRIPT_DEST_DIR" \
.

@ -4,7 +4,14 @@ set -e
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
if [[ $BRANCH_NAME == 'master' ]]; then
if [[ "$BRANCH_NAME" == 'master' ]]; then
# Build new web documentation:
make build-gh-pages
# create new release:
NEWEST_TAG=$(git describe --abbrev=0 --tags)
SCRIPT_VERSION=$(git secret --version)
if [[ "$NEWEST_TAG" != "$SCRIPT_VERSION" ]]; then
git tag -a "$SCRIPT_VERSION" -m "version $SCRIPT_VERSION"
fi
fi

Loading…
Cancel
Save