* Code Cleanup (#158) * print coverage report * create sonar-project property file * install all py dependencies in one step * code cleanup * reduce cognitive complexity * do not build on *.yml changes * optimise versionstring handling (#159) - Reading the version string from the image updates it even if the image is re-pulled without re-deployment * fix linter warning * exclude *.pyi filese * ignore some rules for tests * cleanup (#160) * Sonar qube 3 (#163) fix SonarQube warnings in modbus.py * Sonar qube 3 (#164) * fix SonarQube warnings * Sonar qube 3 (#165) * cleanup * Add support for TSUN Titan inverter Fixes #161 * fix SonarQube warnings * fix error * rename field "config" * SonarQube reads flake8 output * don't stop on flake8 errors * flake8 scan only app/src for SonarQube * update flake8 run * ignore flake8 C901 * cleanup * fix linter warnings * ignore changed *.yml files * read sensor list solarman data packets * catch 'No route to' error and log only in debug mode * fix unit tests * add sensor_list configuration * adapt unit tests * fix SonarQube warnings * Sonar qube 3 (#166) * add unittests for mqtt.py * add mock * move test requirements into a file * fix unit tests * fix formating * initial version * fix SonarQube warning
30 lines
885 B
Bash
30 lines
885 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
user="$(id -u)"
|
|
export VERSION=$(cat /proxy-version.txt)
|
|
|
|
echo "######################################################"
|
|
echo "# prepare: '$SERVICE_NAME' Version:$VERSION"
|
|
echo "# for running with UserID:$UID, GroupID:$GID"
|
|
echo "# Image built: $(cat /build-date.txt) "
|
|
echo "#"
|
|
|
|
if [ "$user" = '0' ]; then
|
|
mkdir -p /home/$SERVICE_NAME/log /home/$SERVICE_NAME/config
|
|
|
|
if ! id $SERVICE_NAME &> /dev/null; then
|
|
echo "# create user"
|
|
addgroup --gid $GID $SERVICE_NAME 2> /dev/null
|
|
adduser -G $SERVICE_NAME -s /bin/false -D -H -g "" -u $UID $SERVICE_NAME
|
|
chown -R $SERVICE_NAME:$SERVICE_NAME /home/$SERVICE_NAME || true
|
|
rm -fr /usr/sbin/addgroup /usr/sbin/adduser /bin/chown
|
|
fi
|
|
echo "######################################################"
|
|
echo "#"
|
|
|
|
exec su-exec $SERVICE_NAME "$@"
|
|
else
|
|
exec "$@"
|
|
fi
|