From 87fa49d415478804b07c2bb1c2e0ea0508fedf86 Mon Sep 17 00:00:00 2001 From: pvizeli Date: Tue, 21 Mar 2017 11:14:44 +0100 Subject: [PATCH 1/2] ResinHup auto start --- .../resinhup/resinhup.bbappend | 30 +++++++++++++++++++ .../resinhup/resinhup/run-resinhup.sh | 15 ++-------- version.json | 4 ++- version_beta.json | 4 ++- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/meta-hassio/recipes-support/resinhup/resinhup.bbappend b/meta-hassio/recipes-support/resinhup/resinhup.bbappend index 6b2ba6fc5..02a00ae4a 100644 --- a/meta-hassio/recipes-support/resinhup/resinhup.bbappend +++ b/meta-hassio/recipes-support/resinhup/resinhup.bbappend @@ -1,2 +1,32 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://resinhup.sh \ + file://resinhup.service \ + " + +SYSTEMD_SERVICE_${PN} += " + resinhup.service \ + resinhup.timer \ + " + +SYSTEMD_AUTO_ENABLE = "enable" + +FILES_${PN} += " \ + ${systemd_unitdir} \ + ${bindir} \ + " + +do_install_append() { + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -d ${D}${systemd_unitdir}/system + install -c -m 0644 ${WORKDIR}/resinhup.service ${D}${systemd_unitdir}/system + install -c -m 0644 ${WORKDIR}/resinhup.time ${D}${systemd_unitdir}/system + + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + ${D}${systemd_unitdir}/system/*.service + fi +} diff --git a/meta-hassio/recipes-support/resinhup/resinhup/run-resinhup.sh b/meta-hassio/recipes-support/resinhup/resinhup/run-resinhup.sh index 2d501716b..d66feb584 100644 --- a/meta-hassio/recipes-support/resinhup/resinhup/run-resinhup.sh +++ b/meta-hassio/recipes-support/resinhup/resinhup/run-resinhup.sh @@ -56,7 +56,7 @@ Options: $LOGFILE file. --no-reboot - Don't reboot if update is successful. This is useful when debugging. + Dont reboot if update is successful. This is useful when debugging. EOF } @@ -116,17 +116,6 @@ function runPreHacks { # can't fix label of data partition from container e2label $DATA_MOUNTPOINT resin-data - - # Some devices never actually update /etc/timestamp because they are hard-rebooted. - # Force a /etc/timestamp update so we don't get into TLS issues. - # This assumes that current date is valid - which should be because we can't remotely - # update a device with outdated time (vpn would not be available so ssh would not - # work). - # Only applies on sysvinit systems - if [[ $(readlink /sbin/init) == *"sysvinit"* ]]; then - log "Save timestamp..." - date -u +%4Y%2m%2d%2H%2M%2S > /etc/timestamp - fi } # Test if a version is greater than another @@ -296,7 +285,7 @@ log "Running resinhup for version $HOSTOS_VERSION ..." RESINHUP_STARTTIME=$(date +%s) # Set options -RESINHUP_ENV="-e VERSION=$HOSTOS_VERSION -e REMOTE=$DOCKER_REPO/resinos" +RESINHUP_ENV="-e VERSION=$HOSTOS_VERSION -e REMOTE=$DOCKER_REPO/hassio" docker run --privileged --rm --net=host $RESINHUP_ENV \ -v /:/host \ diff --git a/version.json b/version.json index 24083acd1..21ccef488 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,6 @@ { - "supervisor_tag": "20170316", + "supervisor_tag": "20170319", "homeassistant_tag": "0.40.1", + "hassio_version": "0.1", + "resinhup_version": "1.1.1", } diff --git a/version_beta.json b/version_beta.json index 24083acd1..21ccef488 100644 --- a/version_beta.json +++ b/version_beta.json @@ -1,4 +1,6 @@ { - "supervisor_tag": "20170316", + "supervisor_tag": "20170319", "homeassistant_tag": "0.40.1", + "hassio_version": "0.1", + "resinhup_version": "1.1.1", } From 1db4eea2e6d4f47d1ea71a0aee51075be9993229 Mon Sep 17 00:00:00 2001 From: pvizeli Date: Tue, 21 Mar 2017 11:24:10 +0100 Subject: [PATCH 2/2] ResinHup auto start v2 --- .../resinhup/resinhup/resinhup.service | 19 +++++++++++++++++++ .../resinhup/resinhup/resinhup.timer | 9 +++++++++ 2 files changed, 28 insertions(+) create mode 100644 meta-hassio/recipes-support/resinhup/resinhup/resinhup.service create mode 100644 meta-hassio/recipes-support/resinhup/resinhup/resinhup.timer diff --git a/meta-hassio/recipes-support/resinhup/resinhup/resinhup.service b/meta-hassio/recipes-support/resinhup/resinhup/resinhup.service new file mode 100644 index 000000000..c97372eff --- /dev/null +++ b/meta-hassio/recipes-support/resinhup/resinhup/resinhup.service @@ -0,0 +1,19 @@ +[Unit] +Description=Resinhup updater +Requires=\ + docker.service \ + etc-resin\x2dsupervisor.mount \ + tmp.mount +Wants=\ + mnt-boot.mount \ + resin-supervisor.service +After=\ + docker.service \ + tmp.mount \ + mnt-boot.mount \ + etc-resin\x2dsupervisor.mount \ + resin-supervisor.service + +[Service] +Type=simple +ExecStart=@BASE_BINDIR@/bash @BINDIR@/run-resinhub.sh diff --git a/meta-hassio/recipes-support/resinhup/resinhup/resinhup.timer b/meta-hassio/recipes-support/resinhup/resinhup/resinhup.timer new file mode 100644 index 000000000..865ed70a6 --- /dev/null +++ b/meta-hassio/recipes-support/resinhup/resinhup/resinhup.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Resinhup updater timer + +[Timer] +OnBootSec=15min +OnUnitInactiveSec=1d + +[Install] +WantedBy=multi-user.target