Merge pull request #47 from krallin/add-license-option

Add license option
pull/49/head
Thomas Orozco 9 years ago committed by GitHub
commit b4824de6ca
  1. 5
      .travis.yml
  2. 12
      CMakeLists.txt
  3. 2
      Dockerfile
  4. 4
      README.md
  5. 9
      ci/run_build.sh
  6. 2
      ddist.sh
  7. 16
      src/tini.c
  8. 1
      tpl/travis.yml.tpl

@ -24,6 +24,7 @@ addons:
- python-virtualenv
- hardening-includes
- gnupg
- vim-common
env:
global:
@ -46,8 +47,8 @@ deploy:
- "./dist/tini.asc"
- "./dist/tini-static"
- "./dist/tini-static.asc"
- "./dist/tini_0.9.0.deb"
- "./dist/tini_0.9.0.rpm"
- "./dist/tini_0.10.0.deb"
- "./dist/tini_0.10.0.rpm"
on:
repo: krallin/tini
tags: true

@ -3,7 +3,7 @@ project (tini C)
# Config
set (tini_VERSION_MAJOR 0)
set (tini_VERSION_MINOR 9)
set (tini_VERSION_MINOR 10)
set (tini_VERSION_PATCH 0)
# Extract git version and dirty-ness
@ -51,6 +51,16 @@ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bsymbolic-functions
# Build
execute_process(
COMMAND xxd -i "LICENSE" "${PROJECT_BINARY_DIR}/tiniLicense.h"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
RESULT_VARIABLE xxd_ret
)
if(NOT "${xxd_ret}" EQUAL 0)
message(SEND_ERROR "xxd on LICENSE failed: ${xxd_ret}")
endif()
configure_file (
"${PROJECT_SOURCE_DIR}/src/tiniConfig.h.in"
"${PROJECT_BINARY_DIR}/tiniConfig.h"

@ -1,7 +1,7 @@
FROM ubuntu:precise
RUN apt-get update \
&& apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake rpm python-dev libcap-dev python-pip python-virtualenv hardening-includes gnupg \
&& apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake rpm python-dev libcap-dev python-pip python-virtualenv hardening-includes gnupg vim-common \
&& rm -rf /var/lib/apt/lists/*
# Pre-install those here for faster local builds.

@ -37,7 +37,7 @@ In Docker, you will want to use an entrypoint so you don't have to remember
to manually invoke Tini:
# Add Tini
ENV TINI_VERSION v0.9.0
ENV TINI_VERSION v0.10.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
@ -63,7 +63,7 @@ The `tini` and `tini-static` binaries are signed using the key `0527A9B7`.
You can verify their signatures using `gpg` (which you may install using
your package manager):
ENV TINI_VERSION v0.9.0
ENV TINI_VERSION v0.10.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0527A9B7 \

@ -2,6 +2,7 @@
# Should be run from the root dir, or SOURCE_DIR should be set.
set -o errexit
set -o nounset
set -o pipefail
# Default compiler
: ${CC:="gcc"}
@ -54,6 +55,9 @@ for tini in "${BUILD_DIR}/tini" "${BUILD_DIR}/tini-static"; do
echo "Smoke test for $tini"
"${tini}" -h
echo "Testing $tini for license"
"${tini}" -l | grep -i "mit license"
echo "Testing $tini with: true"
"${tini}" -vvv true
@ -107,8 +111,9 @@ pip install psutil python-prctl bitmap
# Run tests
python "${SOURCE_DIR}/test/run_inner_tests.py"
# If a signing key is made available, then use it to sign the binaries
if [[ -f "${SOURCE_DIR}/sign.key" ]]; then
# If a signing key and passphrase are made available, then use it to sign the
# binaries
if [[ -n "$GPG_PASSPHRASE" ]] && [[ -f "${SOURCE_DIR}/sign.key" ]]; then
echo "Signing binaries"
GPG_SIGN_HOMEDIR="${BUILD_DIR}/gpg-sign"
GPG_VERIFY_HOMEDIR="${BUILD_DIR}/gpg-verify"

@ -22,5 +22,5 @@ docker run -it --rm \
-e BUILD_DIR=/tmp/tini-build \
-e SOURCE_DIR="${SRC}" \
-e FORCE_SUBREAPER="${FORCE_SUBREAPER}" \
-e GPG_PASSPHRASE="${GPG_PASSPHRASE}" \
-e GPG_PASSPHRASE="${GPG_PASSPHRASE:=}" \
"${IMG}" "${SRC}/ci/run_build.sh"

@ -15,6 +15,7 @@
#include <stdbool.h>
#include "tiniConfig.h"
#include "tiniLicense.h"
#define PRINT_FATAL(...) fprintf(stderr, "[FATAL tini (%i)] ", getpid()); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n");
#define PRINT_WARNING(...) if (verbosity > 0) { fprintf(stderr, "[WARN tini (%i)] ", getpid()); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); }
@ -33,11 +34,11 @@ typedef struct {
#ifdef PR_SET_CHILD_SUBREAPER
#define HAS_SUBREAPER 1
#define OPT_STRING "hsvg"
#define OPT_STRING "hsvgl"
#define SUBREAPER_ENV_VAR "TINI_SUBREAPER"
#else
#define HAS_SUBREAPER 0
#define OPT_STRING "hvg"
#define OPT_STRING "hvgl"
#endif
@ -151,9 +152,14 @@ void print_usage(char* const name, FILE* const file) {
#endif
fprintf(file, " -v: Generate more verbose output. Repeat up to 3 times.\n");
fprintf(file, " -g: Send signals to the child's process group.\n");
fprintf(file, " -l: Show license and exit.\n");
fprintf(file, "\n");
}
void print_license(FILE* const file) {
fwrite(LICENSE, sizeof(char), LICENSE_len, file);
}
int parse_args(const int argc, char* const argv[], char* (**child_args_ptr_ptr)[], int* const parse_fail_exitcode_ptr) {
char* name = argv[0];
@ -162,7 +168,6 @@ int parse_args(const int argc, char* const argv[], char* (**child_args_ptr_ptr)[
while ((c = getopt(argc, argv, OPT_STRING)) != -1) {
switch (c) {
case 'h':
/* TODO - Shouldn't cause exit with -1 ..*/
print_usage(name, stdout);
*parse_fail_exitcode_ptr = 0;
return 1;
@ -179,6 +184,11 @@ int parse_args(const int argc, char* const argv[], char* (**child_args_ptr_ptr)[
kill_process_group++;
break;
case 'l':
print_license(stdout);
*parse_fail_exitcode_ptr = 0;
return 1;
case '?':
print_usage(name, stderr);
return 1;

@ -24,6 +24,7 @@ addons:
- python-virtualenv
- hardening-includes
- gnupg
- vim-common
env:
global:

Loading…
Cancel
Save