Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #10

Merged
merged 3 commits into from
Nov 28, 2017
Merged

Dev #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v1.5.5 - 11/28/17
Improved init.d script to create PID folder and set permissions as needed as well
as well as improve configuration for daemon owner and group.

v1.5.4 - 07/05/17
Fixed a termination issue while debug logging.
Updated configure scripts to use SSL_CTX_new instead of SSL_library_init to support OpenSSL 1.1
Expand Down
20 changes: 10 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for ser2sock 1.4.4.
# Generated by GNU Autoconf 2.69 for ser2sock 1.5.5.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ser2sock'
PACKAGE_TARNAME='ser2sock'
PACKAGE_VERSION='1.4.4'
PACKAGE_STRING='ser2sock 1.4.4'
PACKAGE_VERSION='1.5.5'
PACKAGE_STRING='ser2sock 1.5.5'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL=''

Expand Down Expand Up @@ -1264,7 +1264,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures ser2sock 1.4.4 to adapt to many kinds of systems.
\`configure' configures ser2sock 1.5.5 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1330,7 +1330,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of ser2sock 1.4.4:";;
short | recursive ) echo "Configuration of ser2sock 1.5.5:";;
esac
cat <<\_ACEOF

Expand Down Expand Up @@ -1425,7 +1425,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
ser2sock configure 1.4.4
ser2sock configure 1.5.5
generated by GNU Autoconf 2.69

Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1848,7 +1848,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by ser2sock $as_me 1.4.4, which was
It was created by ser2sock $as_me 1.5.5, which was
generated by GNU Autoconf 2.69. Invocation command line was

$ $0 $@
Expand Down Expand Up @@ -2664,7 +2664,7 @@ fi

# Define the identity of the package.
PACKAGE='ser2sock'
VERSION='1.4.4'
VERSION='1.5.5'


cat >>confdefs.h <<_ACEOF
Expand Down Expand Up @@ -5106,7 +5106,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by ser2sock $as_me 1.4.4, which was
This file was extended by ser2sock $as_me 1.5.5, which was
generated by GNU Autoconf 2.69. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -5172,7 +5172,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
ser2sock config.status 1.4.4
ser2sock config.status 1.5.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(ser2sock, 1.5.4, [email protected])
AC_INIT(ser2sock, 1.5.5, [email protected])
AC_CONFIG_SRCDIR([ser2sock.c])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([config.h])
Expand Down
27 changes: 24 additions & 3 deletions init/ser2sock
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ PROGRAM_NAME="ser2sock"
# Use the name of this script as the SCRIPT_NAME
SCRIPT_NAME=${0##*/}

# Uncoment next line to set user to run daemon as. Best to be a real user like "pi:pi".
#RUN_AS="root:root"

CONF_FILE="/etc/ser2sock/${SCRIPT_NAME}.conf"
EXECUTABLE="/usr/local/bin/${PROGRAM_NAME}"
PID_FILE="/var/run/${SCRIPT_NAME}.pid"

#EXTRA_START_ARGS="--chuid pi:pi"
PID_FILE="/var/run/${PROGRAM_NAME}/${SCRIPT_NAME}.pid"
EXTRA_START_ARGS=""
DAEMON_ARGS="-d -f ${CONF_FILE} -P ${PID_FILE}"
RETVAL=0
Expand All @@ -45,6 +46,26 @@ GREEN=$(tput setaf 2)
RED=$(tput setaf 1)
NORMAL=$(tput sgr0)

# PID folder sanity check. /var/run may be a tmp file system so we need to check.
if [ ! -d /var/run/${PROGRAM_NAME} ]; then
mkdir /var/run/${PROGRAM_NAME} 2>/dev/null
if [ $? -ne 0 ]; then
echo $"${BOLD}${RED}Failed to create PID folder '/var/run/${PROGRAM_NAME}/'"
exit 1
fi
fi

# Are we running as a specific user? If so then we need the correct permissions.
if [ -n "${RUN_AS}" ]; then
EXTRA_START_ARGS+=" --chuid ${RUN_AS}"
# Set permissions to pid folder for the user
chown ${RUN_AS} /var/run/${PROGRAM_NAME} 2>/dev/null
if [ $? -ne 0 ]; then
echo $"${BOLD}${RED}Failed to set PID folder '/var/run/${PROGRAM_NAME}/' owner to '${RUN_AS}'"
exit 1
fi
fi

start() {
echo
echo $"Starting instantiation ${BOLD}${SCRIPT_NAME}${NORMAL} of ${BOLD}${PROGRAM_NAME}${NORMAL}..."
Expand Down
2 changes: 1 addition & 1 deletion ser2sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#include <openssl/err.h>
#endif

#define SER2SOCK_VERSION "V1.5.2"
#define SER2SOCK_VERSION "V1.5.5"
#define TRUE 1
#define FALSE 0

Expand Down