+ SEARCH=python3 + FOUND= + INSTALLED= + CONFIG_FILE=/etc/myDevices/AppSettings.ini + PLATFORM=raspberrypi + args=("$@") + reboot_args='-code 5wsfpv2scu -v' + ELEMENTS=3 + declare -a ASK_TO_REBOOT + ASK_TO_REBOOT=0 + VERSION=2.0.0.238 + TARGET_KEY=Version + UPDATE=0 + EXPAND_FILE_SYSTEM=0 + INVITECODE= + NETWORK_SETTINGS=live_network.ini + ENV=live + nonverbose=-ne + nonverboseend='\r' + installpath=/etc/myDevices + uninstallpath=/etc/myDevices/uninstall + SERVER=https://cayenne.mydevices.com + UPDATE_OBJECT=/cayenne/api/install + DIR=/home/pi/myDevices + cd /home/pi/myDevices + declare echoLog=silentEcho + export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + (( i=0 )) + (( i<3 )) + '[' -code == -code ']' + (( i++ )) + INVITECODE=5wsfpv2scu + '[' 5wsfpv2scu == -update ']' + '[' 5wsfpv2scu == -expandfs ']' + '[' 5wsfpv2scu == -dev ']' + '[' 5wsfpv2scu == -stg ']' + '[' 5wsfpv2scu == -qa2 ']' + '[' 5wsfpv2scu == -qa1 ']' + '[' 5wsfpv2scu == -platform ']' + (( i++ )) + (( i<3 )) + '[' -v == -code ']' + '[' -v == -update ']' + '[' -v == -expandfs ']' + '[' -v == -dev ']' + '[' -v == -stg ']' + '[' -v == -qa2 ']' + '[' -v == -qa1 ']' + '[' -v == -platform ']' + (( i++ )) + (( i<3 )) + [[ 3 > 0 ]] + case "$1" in + shift + [[ 2 > 0 ]] + case "$1" in + shift + [[ 1 > 0 ]] + case "$1" in + echoLog=normalEcho + nonverbose= + nonverboseend= + shift + [[ 0 > 0 ]] + updateProgress 0 0 'Installing myDevices agent' + echo '(0%)' + '[' -n 'Installing myDevices agent' ']' + normalEcho 'Installing myDevices agent' ++ date + echo 'do mei 24 21:51:20 EEST 2018 Installing myDevices agent' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=0&step=0' https://cayenne.mydevices.com/cayenne/api/install + reboot_script=/home/pi/myDevices/reboot_install.sh + reboot_installer='/home/pi/myDevices/reboot_install.sh -code 5wsfpv2scu -v' ++ df -k ++ head -2 ++ tail -1 ++ awk '{print $4}' + availableSize=9940100 + '[' 9940100 -lt 200000 ']' + expandFileSystem + '[' 0 == 0 ']' + return 0 + '[' -f /home/pi/myDevices/reboot_install.sh ']' ++ crontab -l ++ grep -v '@reboot /home/pi/myDevices/reboot_install.sh' ++ crontab - no crontab for root + out= + mkdir /etc/myDevices/ + mkdir -p /etc/myDevices/uninstall + '[' 5wsfpv2scu == '' ']' + '[' 0 == 0 ']' + normalEcho 'Installing system libraries' ++ date + echo 'do mei 24 21:51:21 EEST 2018 Installing system libraries' + dependencies=("python3" "python3-dev" "python3-setuptools" "libiw-dev") + declare -a dependencies + currentProgress=0 + dependency_count=4 + '[' 4 -eq 0 ']' + packagestep=12 + for dependency in "${dependencies[@]}" ++ dpkg-query -W '--showformat=${Status}\n' python3 ++ grep 'install ok installed' + PACKAGE_INSTALLED='install ok installed' + '[' '' == 'install ok installed' ']' + currentProgress=12 + updateProgress 12 1 'Found package: python3' + echo '(12%)' + '[' -n 'Found package: python3' ']' + normalEcho 'Found package: python3' ++ date + echo 'do mei 24 21:51:21 EEST 2018 Found package: python3' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=12&step=1' https://cayenne.mydevices.com/cayenne/api/install + for dependency in "${dependencies[@]}" ++ dpkg-query -W '--showformat=${Status}\n' python3-dev ++ grep 'install ok installed' + PACKAGE_INSTALLED='install ok installed' + '[' '' == 'install ok installed' ']' + currentProgress=24 + updateProgress 24 1 'Found package: python3-dev' + echo '(24%)' + '[' -n 'Found package: python3-dev' ']' + normalEcho 'Found package: python3-dev' ++ date + echo 'do mei 24 21:51:22 EEST 2018 Found package: python3-dev' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=24&step=1' https://cayenne.mydevices.com/cayenne/api/install + for dependency in "${dependencies[@]}" ++ dpkg-query -W '--showformat=${Status}\n' python3-setuptools ++ grep 'install ok installed' + PACKAGE_INSTALLED='install ok installed' + '[' '' == 'install ok installed' ']' + currentProgress=36 + updateProgress 36 1 'Found package: python3-setuptools' + echo '(36%)' + '[' -n 'Found package: python3-setuptools' ']' + normalEcho 'Found package: python3-setuptools' ++ date + echo 'do mei 24 21:51:23 EEST 2018 Found package: python3-setuptools' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=36&step=1' https://cayenne.mydevices.com/cayenne/api/install + for dependency in "${dependencies[@]}" ++ dpkg-query -W '--showformat=${Status}\n' libiw-dev ++ grep 'install ok installed' dpkg-query: geen pakketten gevonden die overeenkomen met libiw-dev + PACKAGE_INSTALLED= + '[' '' == '' ']' + sudo apt-get --yes install libiw-dev + touch /etc/myDevices/uninstall/installed_package + echo libiw-dev + currentProgress=48 + updateProgress 48 1 'Installed package: libiw-dev' + echo '(48%)' + '[' -n 'Installed package: libiw-dev' ']' + normalEcho 'Installed package: libiw-dev' ++ date + echo 'do mei 24 21:51:35 EEST 2018 Installed package: libiw-dev' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=48&step=1' https://cayenne.mydevices.com/cayenne/api/install + '[' -n 5wsfpv2scu ']' + grep -q -i 'InviteCode.*=.*5wsfpv2scu' /etc/myDevices/AppSettings.ini grep: /etc/myDevices/AppSettings.ini: Bestand of map bestaat niet + touch /etc/myDevices/AppSettings.ini + cat + python= + for py in $SEARCH + program=/usr/bin/python3 + '[' -x /usr/bin/python3 ']' + FOUND=' python3' ++ python3 -V + version='Python 3.5.3' ++ python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())' + include=/usr/include/python3.5m + normalEcho 'Found Python 3.5.3' ++ date + echo 'do mei 24 21:51:36 EEST 2018 Found Python 3.5.3' + python=python3 + updateProgress 50 2 'Installing agent files' + echo '(50%)' + '[' -n 'Installing agent files' ']' + normalEcho 'Installing agent files' ++ date + echo 'do mei 24 21:51:36 EEST 2018 Installing agent files' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=50&step=2' https://cayenne.mydevices.com/cayenne/api/install + pgrep systemd + systemctl disable myDevices Failed to disable unit: No such file or directory + rm -rf /etc/systemd/system/myDevices.service + normalEcho 'Installing systemd service' ++ date + echo 'do mei 24 21:51:37 EEST 2018 Installing systemd service' + cp -rf myDevices.service /etc/systemd/system/ + sed -i s/python/python3/g /etc/systemd/system/myDevices.service ++ which mkdir + sed -i 's|\([=-]\)mkdir|\1/bin/mkdir|g' /etc/systemd/system/myDevices.service ++ which chown + sed -i 's|\([=-]\)chown|\1/bin/chown|g' /etc/systemd/system/myDevices.service + '[' live == dev ']' + rm -rf /etc/init.d/myDevices + systemctl enable myDevices Created symlink /etc/systemd/system/multi-user.target.wants/myDevices.service → /etc/systemd/system/myDevices.service. + systemctl daemon-reload + mkdir -p /etc/myDevices/scripts + cp -rf tightvncsetup.sh /etc/myDevices/scripts + rm -rf /usr/bin/myDevices + cp -rf myDevices.sh /usr/bin/myDevices + sed -i s/python/python3/g /usr/bin/myDevices + chmod 0755 /usr/bin/myDevices + cp -rf live_network.ini /etc/myDevices/Network.ini + chmod 0755 /etc/myDevices/Network.ini + cp -rf ca.crt /etc/myDevices/ca.crt cp: kan status van 'ca.crt' niet opvragen: Bestand of map bestaat niet + chmod 0755 /etc/myDevices/ca.crt chmod: kan geen toegang krijgen tot '/etc/myDevices/ca.crt': Bestand of map bestaat niet + cp -rf uninstall.sh /etc/myDevices/uninstall/uninstall.sh + chmod 0755 /etc/myDevices/uninstall/uninstall.sh + cp -rf crontab.sh /etc/myDevices/crontab.sh + chmod 0755 /etc/myDevices/crontab.sh + updateProgress 60 3 'Installing software components' + echo '(60%)' + '[' -n 'Installing software components' ']' + normalEcho 'Installing software components' ++ date + echo 'do mei 24 21:51:38 EEST 2018 Installing software components' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=60&step=3' https://cayenne.mydevices.com/cayenne/api/install + adduser -q --system --disabled-password -shell /bin/bash --group cayenne + usermod -a -G gpio,i2c,spi cayenne + cd Cayenne-Agent + '[' -f /usr/include/python3.5m/Python.h ']' + normalEcho 'Trying to install myDevices for python3 version: Python 3.5.3' ++ date + echo 'do mei 24 21:51:39 EEST 2018 Trying to install myDevices for python3 version: Python 3.5.3' + python3 setup.py install --force --record /etc/myDevices/uninstall/installed_agent zip_safe flag not set; analyzing archive contents... myDevices.utils.__pycache__.logger.cpython-35: module MAY be using inspect.getouterframes warning: no files found matching 'Rakefile' zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents... iwlib.__pycache__.utils.cpython-35: module references __file__ iwlib.__pycache__.iwlist.cpython-35: module references __file__ iwlib.__pycache__.iwconfig.cpython-35: module references __file__ zip_safe flag not set; analyzing archive contents... + '[' 0 -ne 0 ']' + normalEcho 'myDevices installed for Python 3.5.3' ++ date + echo 'do mei 24 21:52:31 EEST 2018 myDevices installed for Python 3.5.3' + INSTALLED=' python3' + cd .. + '[' -z ' python3' ']' + updateProgress 98 4 'Configuring os and agent' + echo '(98%)' + '[' -n 'Configuring os and agent' ']' + normalEcho 'Configuring os and agent' ++ date + echo 'do mei 24 21:52:31 EEST 2018 Configuring os and agent' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=98&step=4' https://cayenne.mydevices.com/cayenne/api/install + SUDOERS_CONFIG=cayenne-sudoers + sed -i 's/python /python3 /g' cayenne-sudoers + visudo -c -q -f cayenne-sudoers + '[' 0 -eq 0 ']' + chown root:root cayenne-sudoers + chmod 440 cayenne-sudoers + cp cayenne-sudoers /etc/sudoers.d/ + mkdir -p /var/run/myDevices + chown --quiet cayenne:cayenne /var/run/myDevices + mkdir -p /var/log/myDevices + chown -R --quiet cayenne:cayenne /var/log/myDevices + chown --quiet cayenne:cayenne /etc/myDevices + chown --quiet cayenne:cayenne /etc/myDevices/AppSettings.ini + chown --quiet cayenne:cayenne '/etc/myDevices/agent.db*' + chown --quiet cayenne:cayenne /etc/myDevices/devices.json + bash tightvncsetup.sh + '[' raspberrypi == raspberrypi ']' + '[' 0 == 0 ']' + CONFIG=/boot/config.txt + BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf + do_spi + DEVICE_TREE=yes + DEFAULT= + '[' -e /boot/config.txt ']' + grep -q '^device_tree=$' /boot/config.txt + CURRENT_SETTING=off + DEFAULT=--defaultno + '[' -e /boot/config.txt ']' + grep -q -E '^(device_tree_param|dtparam)=([^,]*,)*spi(=(on|true|yes|1))?(,.*)?$' /boot/config.txt + CURRENT_SETTING=on + DEFAULT= + '[' yes = yes ']' + SETTING=on + STATUS=enabled + TENSE=is + REBOOT= + '[' on '!=' on ']' + sed /boot/config.txt -i -r -e 's/^((device_tree_param|dtparam)=([^,]*,)*spi)(=[^,]*)?/\1=on/' + grep -q -E '^(device_tree_param|dtparam)=([^,]*,)*spi=[^,]*' /boot/config.txt + CURRENT_STATUS=yes + DEFAULT= + '[' -e /etc/modprobe.d/raspi-blacklist.conf ']' + grep -q '^blacklist[[:space:]]*spi[-_]bcm2708' /etc/modprobe.d/raspi-blacklist.conf + '[' -e /etc/modprobe.d/raspi-blacklist.conf ']' + do_i2c + DEVICE_TREE=yes + DEFAULT= + '[' -e /boot/config.txt ']' + grep -q '^device_tree=$' /boot/config.txt + CURRENT_SETTING=off + DEFAULT=--defaultno + '[' -e /boot/config.txt ']' + grep -q -E '^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?(=(on|true|yes|1))?(,.*)?$' /boot/config.txt + CURRENT_SETTING=on + DEFAULT= + '[' yes = yes ']' + SETTING=on + STATUS=enabled + '[' on '!=' on ']' + sed /boot/config.txt -i -r -e 's/^((device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?)(=[^,]*)?/\1=on/' + grep -q -E '^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?=[^,]*' /boot/config.txt + CURRENT_STATUS=yes + DEFAULT= + '[' -e /etc/modprobe.d/raspi-blacklist.conf ']' + grep -q '^blacklist[[:space:]]*i2c[-_]bcm2708' /etc/modprobe.d/raspi-blacklist.conf + '[' -e /etc/modprobe.d/raspi-blacklist.conf ']' + sed /etc/modprobe.d/raspi-blacklist.conf -i -e 's/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/' + sed /etc/modprobe.d/raspi-blacklist.conf -i -e 's/^#\(blacklist[[:space:]]*i2c-dev\)/\1/' + modprobe i2c-bcm2708 + modprobe i2c-dev + do_w1 ++ grep w1-gpio ++ cat /boot/config.txt + output=dtoverlay=w1-gpio + '[' -z dtoverlay=w1-gpio ']' + sed -i 's/\(#dtoverlay.*=.*w1-gpio\).*/\dtoverlay=w1-gpio/' /boot/config.txt + ASK_TO_REBOOT=1 + line='* * * * * /etc/myDevices/crontab.sh' + sudo sed -i 's/.*myDevices.*/ /g' /var/spool/cron/crontabs/root + sudo crontab -u root -l + sudo crontab -u root - + echo '* * * * * /etc/myDevices/crontab.sh' + sudo /etc/init.d/cron start + sudo service myDevices start + '[' 0 == 1 ']' + '[' -x /var/log/myDevices.log ']' + rm -f /var/log/myDevices.log + rm -f /var/log/myDevicesData + rm -f '/var/log/myDevices.log.*-*-*.tar.bz2' + mv '/var/log/myDevices.log*' /var/log/myDevices/ mv: kan status van '/var/log/myDevices.log*' niet opvragen: Bestand of map bestaat niet + mv '/var/log/myDevices.update*' /var/log/myDevices/ mv: kan status van '/var/log/myDevices.update*' niet opvragen: Bestand of map bestaat niet + chown --quiet cayenne:cayenne '/var/log/myDevices/*' + updateProgress 100 5 'Install finished' + echo '(100%)' + '[' -n 'Install finished' ']' + normalEcho 'Install finished' ++ date + echo 'do mei 24 21:52:33 EEST 2018 Install finished' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=100&step=5' https://cayenne.mydevices.com/cayenne/api/install + rm -rf /home/pi/myDevices + rm -rf /home/pi/myDevices.tar.gz + updateProgress 100 6 'Install cleanup finished' + echo '(100%)' + '[' -n 'Install cleanup finished' ']' + normalEcho 'Install cleanup finished' ++ date + echo 'do mei 24 21:52:34 EEST 2018 Install cleanup finished' + '[' -n 5wsfpv2scu ']' + '[' 0 == 0 ']' + sudo nohup curl --data 'invitecode=5wsfpv2scu&progress=100&step=6' https://cayenne.mydevices.com/cayenne/api/install + '[' 1 -eq 1 ']' + '[' 0 -eq 0 ']' + echo 'Your system will reboot!' + sudo reboot