This commit is contained in:
Pascal Vizeli 2017-03-21 11:29:00 +01:00
commit e91f573eb0
6 changed files with 66 additions and 15 deletions

View File

@ -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
}

View File

@ -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

View File

@ -0,0 +1,9 @@
[Unit]
Description=Resinhup updater timer
[Timer]
OnBootSec=15min
OnUnitInactiveSec=1d
[Install]
WantedBy=multi-user.target

View File

@ -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 \

View File

@ -1,4 +1,6 @@
{
"supervisor_tag": "20170316",
"supervisor_tag": "20170319",
"homeassistant_tag": "0.40.1",
"hassio_version": "0.1",
"resinhup_version": "1.1.1",
}

View File

@ -1,4 +1,6 @@
{
"supervisor_tag": "20170316",
"supervisor_tag": "20170319",
"homeassistant_tag": "0.40.1",
"hassio_version": "0.1",
"resinhup_version": "1.1.1",
}