Add version in usage, improve usage

pull/1/head v0.2.0
Thomas Orozco 10 years ago
parent c35496874c
commit c666a4f718
  1. 2
      Dockerfile
  2. 5
      config.mk
  3. 2
      ddist.sh
  4. 12
      tini.c

@ -1,6 +1,8 @@
FROM ubuntu
RUN apt-get update && apt-get install --no-install-recommends -y build-essential gdb && rm -rf /var/lib/apt/lists/*
RUN apt-get update
RUN apt-get install --no-install-recommends -y git
ADD . /tini
RUN cd /tini && make clean && make

@ -1,10 +1,11 @@
VERSION = 0.1.0
VERSION=0.2.0
GIT_REV=$(shell git log -n 1 --date=local --pretty=format:"%h")
# paths
PREFIX=/usr/local
CC = cc
LD = $(CC)
CPPFLAGS=-D_FORTIFY_SOURCE=2
CPPFLAGS=-D_FORTIFY_SOURCE=2 -DTINI_VERSION="\"$(VERSION) - $(GIT_REV)\""
CFLAGS=-std=gnu99 -Wextra -Wall -pedantic -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-s

@ -13,6 +13,6 @@ NAME="${IMG}-dist"
BIN="tini"
docker build -t "${IMG}" .
docker run -it --name="${NAME}" --entrypoint="true" "${IMG}" true
docker run -it --name="${NAME}" "${IMG}" true "-h"
docker cp "${NAME}:/tini/${BIN}" "${DIST_DIR}"
docker rm "${NAME}"

@ -1,4 +1,6 @@
/* See LICENSE file for copyright and license details. */
#define _GNU_SOURCE
#include <sys/types.h>
#include <sys/wait.h>
@ -11,6 +13,9 @@
#include <unistd.h>
#include <stdbool.h>
#ifndef TINI_VERSION
#define TINI_VERSION "???"
#endif
#define PRINT_FATAL(...) fprintf(stderr, "[FATAL] "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n");
#define PRINT_WARNING(...) if (verbosity > 0) { fprintf(stderr, "[WARN ] "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); }
@ -51,7 +56,12 @@ int spawn(const sigset_t* const child_sigset_ptr, char (*argv[]), int* const chi
void print_usage(char* const name, FILE* const file) {
fprintf(file, "Usage: %s [-h | program arg1 arg2]\n", name);
fprintf(file, "%s (version %s)\n", basename(name), TINI_VERSION);
fprintf(file, "Usage: %s [OPTIONS] PROGRAM -- [ARGS]\n\n", basename(name));
fprintf(file, "Execute a program under the supervision of a valid init process (%s)\n\n", basename(name));
fprintf(file, " -h: Show this help message and exit.\n");
fprintf(file, " -v: Generate more verbose output. Repeat up to 4 times.\n");
fprintf(file, "\n");
}

Loading…
Cancel
Save