mirror of https://github.com/sobolevn/git-secret
commit
3550e2a9c3
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Initializing and settings:
|
||||||
|
READ_PEM=0644
|
||||||
|
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 -D -T -b -m "$EXEC_PEM" -T "git-secret" "${SCRIPT_DEST_DIR}/usr/bin/git-secret"
|
||||||
|
install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/usr/share/man/man1"
|
||||||
|
install -m "$READ_PEM" -d "${SCRIPT_DEST_DIR}/usr/share/man/man7"
|
||||||
|
for file in man/man1/* ; do
|
||||||
|
if [[ "$file" == *.ronn ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
install -D -T -b -m "$READ_PEM" -T "$file" "${SCRIPT_DEST_DIR}/usr/share/${file}"
|
||||||
|
done
|
||||||
|
install -D -T -b -m "$READ_PEM" -T "man/man7/git-secret.7" \
|
||||||
|
"${SCRIPT_DEST_DIR}/usr/share/man/man7/git-secret.7"
|
||||||
|
|
||||||
|
# Building .deb package:
|
||||||
|
cd "$SCRIPT_DEST_DIR" && fpm -s dir -t deb \
|
||||||
|
-a all \
|
||||||
|
-n "$SCRIPT_NAME" \
|
||||||
|
--epoch "$SCRIPT_EPOCH" \
|
||||||
|
--version "$SCRIPT_VERSION" \
|
||||||
|
--iteration "$SCRIPT_ITERATION" \
|
||||||
|
--description="$SCRIPT_DESCRIPTION" \
|
||||||
|
-C "$SCRIPT_DEST_DIR" \
|
||||||
|
.
|
@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Credit goes to:
|
||||||
|
# https://github.com/sstephenson/bats/blob/master/install.sh
|
||||||
|
resolve_link() {
|
||||||
|
$(type -p greadlink readlink | head -1) "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
abs_dirname() {
|
||||||
|
local cwd="$(pwd)"
|
||||||
|
local path="$1"
|
||||||
|
|
||||||
|
while [ -n "$path" ]; do
|
||||||
|
cd "${path%/*}"
|
||||||
|
local name="${path##*/}"
|
||||||
|
path="$(resolve_link "$name" || true)"
|
||||||
|
done
|
||||||
|
|
||||||
|
pwd
|
||||||
|
cd "$cwd"
|
||||||
|
}
|
||||||
|
|
||||||
|
PREFIX="$1"
|
||||||
|
if [ -z "$PREFIX" ]; then
|
||||||
|
echo "usage: $0 <prefix>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_ROOT="$(dirname $(abs_dirname "$0"))"
|
||||||
|
|
||||||
|
mkdir -p "$PREFIX"/bin "$PREFIX"/share/man/man1 "$PREFIX"/share/man/man7
|
||||||
|
cp "$SCRIPT_ROOT"/git-secret "$PREFIX"/bin/git-secret
|
||||||
|
cp -R "$SCRIPT_ROOT"/man/man1/* "$PREFIX"/share/man/man1
|
||||||
|
cp "$SCRIPT_ROOT"/man/man7/git-secret.7 "$PREFIX"/share/man/man7/git-secret.7
|
||||||
|
|
||||||
|
echo "Installed git-secret to $PREFIX/bin/git-secret"
|
Loading…
Reference in New Issue