openhab / openhab1-addons

Add-ons for openHAB 1.x
Eclipse Public License 2.0
3.43k stars 1.7k forks source link

Installing openhab2 snapshot from repository on raspberry pi fails #4711

Closed mihalski closed 7 years ago

mihalski commented 7 years ago

Hi,

I am having a look at openhab due to it's zwave support and homebridge bindings (thus allowing motion sensor integration with homekit). Having followed the instructions on installing openhab2 on a raspbeery pi I encountered the following error:

pi@homepi:~ $ sudo apt-get install openhab2-online
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  openhab2-online
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/48.7 MB of archives.
After this operation, 54.8 MB of additional disk space will be used.
(Reading database ... 37653 files and directories currently installed.)
Preparing to unpack .../openhab2-online_2.0.0~20161017033125_all.deb ...
dpkg: error processing archive /var/cache/apt/archives/openhab2-online_2.0.0~20161017033125_all.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/openhab2-online_2.0.0~20161017033125_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It appears that there is a problem with the pre-installation script, but I am unable to identify it. Here is what is currently in the script:

#!/bin/sh

set -e

UD_CACHE=/var/lib/openhab2/cache
UD_TMP=/var/lib/openhab2/tmp

removeCache(){
    [ -d ${UD_CACHE} ] && rm -rf ${UD_CACHE}
    [ -d ${UD_TMP} ] && rm -rf ${UD_TMP}
}

case "$1" in
        install)
        removeCache
                OH_USER=openhab
                OH_GROUP=openhab
                if [ x"${USER_AND_GROUP}" != x ]; then
                        OH_USER=`echo ${USER_AND_GROUP} | cut -d ":" -f 1`
                        OH_GROUP=`echo ${USER_AND_GROUP} | cut -d ":" -f 2`
                fi
                if ! getent group "$OH_GROUP" > /dev/null 2>&1 ; then
                        addgroup --system "$OH_GROUP" --quiet
                fi
                if ! getent passwd "$OH_USER" > /dev/null 2>&1 ; then
                        adduser --quiet --system --ingroup "$OH_GROUP" --no-create-home \
                        --disabled-password --shell /bin/false \
                        --gecos "openhab2 runtime user" --home /var/lib/openhab2 "$OH_USER"
                fi
                ;;
esac

I am running a current version of raspbian on a raspberry pi 3 with all the latest updates and have followed the instructions as stated above.

Regards, Michal

watou commented 7 years ago

Please re-open this issue in this repo and flag @theoweiss as he is probably the person to have a look at it. (This repo is only for the 1.x addons.)