Merge pull request #50 from buanet/dev

moving changes to different architectures
This commit is contained in:
Andre
2019-11-27 21:50:05 +01:00
committed by GitHub
9 changed files with 155 additions and 85 deletions

View File

@@ -4,23 +4,27 @@ MAINTAINER Andre Germann <https://buanet.de>
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# Install prerequisites # Install prerequisites (as listed in iobroker installer.sh)
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
acl \ acl \
apt-utils \ apt-utils \
build-essential \ build-essential \
curl \ curl \
git \ git \
gnupg2 \ gnupg2 \
libcap2-bin \ gosu \
libpam0g-dev \ libavahi-compat-libdnssd-dev \
libudev-dev \ libcap2-bin \
locales \ libpam0g-dev \
procps \ libudev-dev \
python \ locales \
gosu \ pkg-config \
unzip \ procps \
wget \ python \
python-dev \
sudo \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install node10 # Install node10
@@ -56,14 +60,14 @@ RUN apt-get update \
# Install node-gyp # Install node-gyp
WORKDIR /opt/iobroker/ WORKDIR /opt/iobroker/
RUN npm config set unsafe-perm true # To fix "Error: could not get uid/gid"
RUN npm install -g node-gyp RUN npm install -g node-gyp
# Backup initial ioBroker-folder # Backup initial ioBroker-folder
RUN tar -cf /opt/initial_iobroker.tar /opt/iobroker RUN tar -cf /opt/initial_iobroker.tar /opt/iobroker
# Setting up iobroker-user # Setting up iobroker-user (shell and home directory)
RUN chsh -s /bin/bash iobroker RUN chsh -s /bin/bash iobroker \
&& usermod --home /opt/iobroker iobroker
# Setting up ENVs # Setting up ENVs
ENV DEBIAN_FRONTEND="teletype" \ ENV DEBIAN_FRONTEND="teletype" \
@@ -71,14 +75,13 @@ ENV DEBIAN_FRONTEND="teletype" \
LANGUAGE="de_DE:de" \ LANGUAGE="de_DE:de" \
LC_ALL="de_DE.UTF-8" \ LC_ALL="de_DE.UTF-8" \
TZ="Europe/Berlin" \ TZ="Europe/Berlin" \
PACKAGES="nano" \ PACKAGES="vi" \
ADMINPORT=8081 \
SETUID=1000 \
SETGID=1000 \
AVAHI="false" \ AVAHI="false" \
SETUID=1000 \ ZWAVE="false" \
SETGID=1000 \ USBDEVICES="none"
ZWAVE="false"
# Setting up EXPOSE for Admin
EXPOSE 8081/tcp
# Run startup-script # Run startup-script
ENTRYPOINT ["/opt/scripts/iobroker_startup.sh"] ENTRYPOINT ["/opt/scripts/iobroker_startup.sh"]

View File

@@ -2,10 +2,12 @@
# Reading ENV # Reading ENV
packages=$PACKAGES packages=$PACKAGES
avahi=$AVAHI adminport=$ADMINPORT
uid=$SETUID uid=$SETUID
gid=$SETGID gid=$SETGID
zwave=$ZWAVE zwave=$ZWAVE
avahi=$AVAHI
usbdevices=$USBDEVICES
# Getting date and time for logging # Getting date and time for logging
dati=`date '+%Y-%m-%d %H:%M:%S'` dati=`date '+%Y-%m-%d %H:%M:%S'`
@@ -34,8 +36,10 @@ echo -n "----- " && echo -n "$(printf "%-10s %-23s" node: $(node -
echo -n "----- " && echo -n "$(printf "%-10s %-23s" npm: $(npm -v))" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" npm: $(npm -v))" && echo " -----"
echo "----- -----" echo "----- -----"
echo "----- ENV -----" echo "----- ENV -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" AVAHI: $AVAHI)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" PACKAGES: $PACKAGES)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" PACKAGES: $PACKAGES)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" ADMINPORT: $ADMINPORT)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" AVAHI: $AVAHI)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" ZWAVE: $ZWAVE)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETGID: $SETGID)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETGID: $SETGID)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETUID: $SETUID)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETUID: $SETUID)" && echo " -----"
echo "$(printf -- '-%.0s' {1..60})" echo "$(printf -- '-%.0s' {1..60})"
@@ -125,8 +129,8 @@ if [ -f /opt/iobroker/.install_host ]
then then
echo "Looks like this is a new and empty installation of ioBroker." echo "Looks like this is a new and empty installation of ioBroker."
echo "Hostname needs to be updated to " $(hostname)"..." echo "Hostname needs to be updated to " $(hostname)"..."
sh /opt/iobroker/iobroker host $(cat /opt/iobroker/.install_host) sh /opt/iobroker/iobroker host $(cat /opt/iobroker/.install_host)
rm -f /opt/iobroker/.install_host rm -f /opt/iobroker/.install_host
echo 'Done.' echo 'Done.'
echo ' ' echo ' '
fi fi
@@ -141,7 +145,17 @@ echo "Some adapters have special requirements which can be activated by the use
echo "For more information take a look at readme.md" echo "For more information take a look at readme.md"
echo ' ' echo ' '
# Checking for and setting up avahi-daemon # Checking ENV for Adminport
if [ "$adminport" != "8081" ]
then
echo "Adminport is set by ENV."
echo "Setting Adminport to" $adminport"..."
iobroker set admin.0 --port $adminport
echo 'Done.'
echo ' '
fi
# Checking for enabled avahi-daemon
if [ "$avahi" = "true" ] if [ "$avahi" = "true" ]
then then
echo "Avahi-daemon is activated by ENV." echo "Avahi-daemon is activated by ENV."
@@ -151,15 +165,33 @@ then
echo ' ' echo ' '
fi fi
# Checking for enabled zwave-support
if [ "$zwave" = "true" ] if [ "$zwave" = "true" ]
then then
echo "ZWave is activated by ENV." echo "Z-Wave is activated by ENV."
chmod 764 /opt/scripts/setup_zwave.sh chmod 764 /opt/scripts/setup_zwave.sh
sh /opt/scripts/setup_zwave.sh sh /opt/scripts/setup_zwave.sh
echo "Done." echo "Done."
echo ' ' echo ' '
fi fi
# checking enabled usb-devices
if [ "$usbdevices" != "none" ]
then
echo "Usb-device-support is activated by ENV."
IFS=';' read -ra devicearray <<< "$usbdevices"
for i in "${devicearray[@]}"
do
echo "Setting permissions for" $i"..."
chown root:dialout $i
chmod g+rw $i
done
echo "Done."
echo ' '
fi
sleep 5 sleep 5
# Starting ioBroker # Starting ioBroker

View File

@@ -2,7 +2,7 @@
echo "Checking avahi-daemon installation state..." echo "Checking avahi-daemon installation state..."
if [ -f /usr/sbin/avahi-daemon ] if [ -e /usr/sbin/avahi-daemon ] && [ -e /var/run/dbus ]
then then
echo "Avahi is already installed..." echo "Avahi is already installed..."
else else

View File

@@ -2,7 +2,7 @@
echo "Checking openzwave installation state..." echo "Checking openzwave installation state..."
if [ -f /usr/local/lib64 ] if [ -e /usr/local/lib64 ]
then then
echo "Openzwave is already installed..." echo "Openzwave is already installed..."
else else

View File

@@ -6,25 +6,25 @@ ENV DEBIAN_FRONTEND noninteractive
# Install prerequisites (as listed in iobroker installer.sh) # Install prerequisites (as listed in iobroker installer.sh)
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
acl \ acl \
apt-utils \ apt-utils \
build-essential \ build-essential \
curl \ curl \
git \ git \
gnupg2 \ gnupg2 \
gosu \ gosu \
libavahi-compat-libdnssd-dev \ libavahi-compat-libdnssd-dev \
libcap2-bin \ libcap2-bin \
libpam0g-dev \ libpam0g-dev \
libudev-dev \ libudev-dev \
locales \ locales \
pkg-config \ pkg-config \
procps \ procps \
python \ python \
python-dev \ python-dev \
sudo \ sudo \
unzip \ unzip \
wget \ wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install node10 # Install node10

View File

@@ -4,26 +4,30 @@ MAINTAINER Andre Germann <https://buanet.de>
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# Install prerequisites # Install prerequisites (as listed in iobroker installer.sh)
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
acl \ acl \
apt-utils \ apt-utils \
build-essential \ build-essential \
curl \ curl \
git \ git \
gnupg2 \ gnupg2 \
libcap2-bin \ gosu \
libpam0g-dev \ libavahi-compat-libdnssd-dev \
libudev-dev \ libcap2-bin \
locales \ libpam0g-dev \
procps \ libudev-dev \
python \ locales \
gosu \ pkg-config \
unzip \ procps \
wget \ python \
python-dev \
sudo \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install node8 # Install node10
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get update && apt-get install -y \ && apt-get update && apt-get install -y \
nodejs \ nodejs \
@@ -56,14 +60,14 @@ RUN apt-get update \
# Install node-gyp # Install node-gyp
WORKDIR /opt/iobroker/ WORKDIR /opt/iobroker/
RUN npm config set unsafe-perm true # To fix "Error: could not get uid/gid"
RUN npm install -g node-gyp RUN npm install -g node-gyp
# Backup initial ioBroker-folder # Backup initial ioBroker-folder
RUN tar -cf /opt/initial_iobroker.tar /opt/iobroker RUN tar -cf /opt/initial_iobroker.tar /opt/iobroker
# Setting up iobroker-user # Setting up iobroker-user (shell and home directory)
RUN chsh -s /bin/bash iobroker RUN chsh -s /bin/bash iobroker \
&& usermod --home /opt/iobroker iobroker
# Setting up ENVs # Setting up ENVs
ENV DEBIAN_FRONTEND="teletype" \ ENV DEBIAN_FRONTEND="teletype" \
@@ -71,14 +75,13 @@ ENV DEBIAN_FRONTEND="teletype" \
LANGUAGE="de_DE:de" \ LANGUAGE="de_DE:de" \
LC_ALL="de_DE.UTF-8" \ LC_ALL="de_DE.UTF-8" \
TZ="Europe/Berlin" \ TZ="Europe/Berlin" \
PACKAGES="nano" \ PACKAGES="vi" \
ADMINPORT=8081 \
SETUID=1000 \
SETGID=1000 \
AVAHI="false" \ AVAHI="false" \
SETUID=1000 \ ZWAVE="false" \
SETGID=1000 \ USBDEVICES="none"
ZWAVE="false"
# Setting up EXPOSE for Admin
EXPOSE 8081/tcp
# Run startup-script # Run startup-script
ENTRYPOINT ["/opt/scripts/iobroker_startup.sh"] ENTRYPOINT ["/opt/scripts/iobroker_startup.sh"]

View File

@@ -2,10 +2,12 @@
# Reading ENV # Reading ENV
packages=$PACKAGES packages=$PACKAGES
avahi=$AVAHI adminport=$ADMINPORT
uid=$SETUID uid=$SETUID
gid=$SETGID gid=$SETGID
zwave=$ZWAVE zwave=$ZWAVE
avahi=$AVAHI
usbdevices=$USBDEVICES
# Getting date and time for logging # Getting date and time for logging
dati=`date '+%Y-%m-%d %H:%M:%S'` dati=`date '+%Y-%m-%d %H:%M:%S'`
@@ -34,8 +36,10 @@ echo -n "----- " && echo -n "$(printf "%-10s %-23s" node: $(node -
echo -n "----- " && echo -n "$(printf "%-10s %-23s" npm: $(npm -v))" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" npm: $(npm -v))" && echo " -----"
echo "----- -----" echo "----- -----"
echo "----- ENV -----" echo "----- ENV -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" AVAHI: $AVAHI)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" PACKAGES: $PACKAGES)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" PACKAGES: $PACKAGES)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" ADMINPORT: $ADMINPORT)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" AVAHI: $AVAHI)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" ZWAVE: $ZWAVE)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETGID: $SETGID)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETGID: $SETGID)" && echo " -----"
echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETUID: $SETUID)" && echo " -----" echo -n "----- " && echo -n "$(printf "%-10s %-23s" SETUID: $SETUID)" && echo " -----"
echo "$(printf -- '-%.0s' {1..60})" echo "$(printf -- '-%.0s' {1..60})"
@@ -125,8 +129,8 @@ if [ -f /opt/iobroker/.install_host ]
then then
echo "Looks like this is a new and empty installation of ioBroker." echo "Looks like this is a new and empty installation of ioBroker."
echo "Hostname needs to be updated to " $(hostname)"..." echo "Hostname needs to be updated to " $(hostname)"..."
sh /opt/iobroker/iobroker host $(cat /opt/iobroker/.install_host) sh /opt/iobroker/iobroker host $(cat /opt/iobroker/.install_host)
rm -f /opt/iobroker/.install_host rm -f /opt/iobroker/.install_host
echo 'Done.' echo 'Done.'
echo ' ' echo ' '
fi fi
@@ -141,7 +145,17 @@ echo "Some adapters have special requirements which can be activated by the use
echo "For more information take a look at readme.md" echo "For more information take a look at readme.md"
echo ' ' echo ' '
# Checking for and setting up avahi-daemon # Checking ENV for Adminport
if [ "$adminport" != "8081" ]
then
echo "Adminport is set by ENV."
echo "Setting Adminport to" $adminport"..."
iobroker set admin.0 --port $adminport
echo 'Done.'
echo ' '
fi
# Checking for enabled avahi-daemon
if [ "$avahi" = "true" ] if [ "$avahi" = "true" ]
then then
echo "Avahi-daemon is activated by ENV." echo "Avahi-daemon is activated by ENV."
@@ -151,15 +165,33 @@ then
echo ' ' echo ' '
fi fi
# Checking for enabled zwave-support
if [ "$zwave" = "true" ] if [ "$zwave" = "true" ]
then then
echo "ZWave is activated by ENV." echo "Z-Wave is activated by ENV."
chmod 764 /opt/scripts/setup_zwave.sh chmod 764 /opt/scripts/setup_zwave.sh
sh /opt/scripts/setup_zwave.sh sh /opt/scripts/setup_zwave.sh
echo "Done." echo "Done."
echo ' ' echo ' '
fi fi
# checking enabled usb-devices
if [ "$usbdevices" != "none" ]
then
echo "Usb-device-support is activated by ENV."
IFS=';' read -ra devicearray <<< "$usbdevices"
for i in "${devicearray[@]}"
do
echo "Setting permissions for" $i"..."
chown root:dialout $i
chmod g+rw $i
done
echo "Done."
echo ' '
fi
sleep 5 sleep 5
# Starting ioBroker # Starting ioBroker

View File

@@ -2,7 +2,7 @@
echo "Checking avahi-daemon installation state..." echo "Checking avahi-daemon installation state..."
if [ -f /usr/sbin/avahi-daemon ] if [ -e /usr/sbin/avahi-daemon ] && [ -e /var/run/dbus ]
then then
echo "Avahi is already installed..." echo "Avahi is already installed..."
else else

View File

@@ -2,7 +2,7 @@
echo "Checking openzwave installation state..." echo "Checking openzwave installation state..."
if [ -f /usr/local/lib64 ] if [ -e /usr/local/lib64 ]
then then
echo "Openzwave is already installed..." echo "Openzwave is already installed..."
else else