From patchwork Thu Nov 14 22:21:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Freihofer, Adrian" X-Patchwork-Id: 1195230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::437; helo=mail-wr1-x437.google.com; envelope-from=swupdate+bncbaabb5vgw7xakgqer7yxn5i@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=siemens.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="RBCvmu+r"; dkim-atps=neutral Received: from mail-wr1-x437.google.com (mail-wr1-x437.google.com [IPv6:2a00:1450:4864:20::437]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47DbYl2H4fz9sP3 for ; Fri, 15 Nov 2019 09:21:46 +1100 (AEDT) Received: by mail-wr1-x437.google.com with SMTP id g17sf5887214wru.4 for ; Thu, 14 Nov 2019 14:21:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1573770102; cv=pass; d=google.com; s=arc-20160816; b=b4PHa7xTREOIQTGE/fhuTIpQM6KtB2jAUsR7Qv9xwabzBcrwETQnNEQUi85NvhycIU XTVh0hrdojOtXQtPKLCikFF0iS1VAUqjZw7ystr/7dugwrO0RplRagKrjo3d11P47mND 6vcF5PpQuh7smhAH5S15J6AzVy83/EY1xprqbKm1HAT5qU6hx9no9OISZ5uSB4b2zOGm v1vjzSxoiJNkClljSkjj6HYGZhx/XL9p4MYmw5GxpIOYxnCj4pwUf2JQGCFrJex7g7mx yZBJybeLuOQQKH7fp/400tMijO2nH4hjpfpTrNI9FT1iOZ7iXvuEXzvJdnILCK1bpRRa fECg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:mime-version:sender:dkim-signature; bh=X79B2MzHPiGFs/ZTIH58WDW8jkJMvhzH02jfDBgRP7s=; b=xECjsrTOk8lImn0DZ7v4RS5c5kZTN+L9Vnuhor/ifJ0g5D7GLO/YBgIa0LoSuaiw2r 8hso6xQDc/9Fa60Yw9B+XaX823jUk3WBq7OYbQwUrVetVPkF1vCDEz+XZywwt/8OfVxP yCURe5ptMk2msmmikcjXJ2WthEDRdWBa9vewnMnKGoV1/owEAd8InZrMtR4MaoawWMhl iQoKJhFuMcA8u8emty96t/hJwxKpBb/pZoWfdYDwG0B018AEVnO58CPEcfO7yvFc5Af5 UJ5bezgCu8bfDRX1lhJB6pATwZcMgqxIRLQeAMIeC77hQyXrQDvy9ng4XUZdxPcrWvk5 6RNg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=X79B2MzHPiGFs/ZTIH58WDW8jkJMvhzH02jfDBgRP7s=; b=RBCvmu+r0uNpPfSsVkHoBGKJ84LFgMH4t4q+iI9sczSfqudyJFtBcOv0hvf65WYBgx 9VKieOQZqpYQags1xE2LGEQgBzt8pdhPXbyt5T86Z5lsEzOrmVV56dFXqNOwHkQrf6ci f6C0GIdlUaD9cxaMUBozpXIHl/NUv1EQaxrfSCyBokyD8WdaHlIORrVGzR21AdhT+5rJ X4XwMOaiBTuBAwa0IsOt8NvXoFNqPzwP4vTWnJa6+UFSVgt/Sd8xEkBOVysvhwGAurDr 3a0XqLR7+ohICOSPFui/EDRbguTRG2XOwgLTo/eqB67JOGCGRAUlhEWOzZTFQFGHd4nr Ckbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=X79B2MzHPiGFs/ZTIH58WDW8jkJMvhzH02jfDBgRP7s=; b=oAs0w40/bQr6X60J8S/zwEBUe/v3rzXfw7yBfB5Xd7IzjFC9J3IurRnVKhI/gu2ibe ERQLeSz1P0538LTodEL0Yik9s7/SCuffHd6/jRi1wRNzE2PBDfrR43BwC0rmbwDFD2m4 snWWv+MJYGCqiJn2BK+s2TZMx0rvscvEdEbN+zgEYQ3v3okX+1kt+pWMRpJ99XsQCog9 s6r4TJPJWxZFPLrIPDiFMUKM/rQxceg++IBYqXXa3YKN9IJGUW9L4Ym0IAvuPQE9V8Qg fW91FGYKwJi2CL/GLdqDnUrw7Ns1C7GTGovvhoQtJY+JA4UbRneHym3oiq6g3jwOKl76 uQOA== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAV5xxwG79dAl4z+hXC4LzycFEE3lcV+jSptRxoRQqCSqd4089Jh rjjnNwJDAAwPuAWnOU6ZJHI= X-Google-Smtp-Source: APXvYqzdd7Mo2j5RIWiZTWWPyKxNj1JSRILA6Ax7lmHXWxFzSpIWI/fyrOlJObYuO4ZoLB0vv570bw== X-Received: by 2002:a1c:453:: with SMTP id 80mr11007560wme.5.1573770102726; Thu, 14 Nov 2019 14:21:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:82:: with SMTP id 124ls12580712wma.1.gmail; Thu, 14 Nov 2019 14:21:42 -0800 (PST) X-Received: by 2002:a1c:544b:: with SMTP id p11mr11225685wmi.46.1573770102221; Thu, 14 Nov 2019 14:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573770102; cv=none; d=google.com; s=arc-20160816; b=oAkwCWJ7Sy2zC0QN+G2w4UGXlRgubLv5Rp/OWwc4Bb5ZRAOpfFGQrVR9ZLclwr/q+V xuXk1gp+oHMFnyncsxPljxc2h06GswXZO2deJ0tBTQHKfwGcJbRauVVaGw0F1Hk8aXQs gyhiBjWyWK6EG3jL427EecrOxnI/PT7Zckj8Bslz2FVNEfD7ax9AYQfDrEM0Z5/yVprx mr/ebRjHi+YdpMaE0Cqa1soZQZ3+CfFDHS/SSSL2+q5hp9CuwKMtmR+3qDtvKlgKCURb eDzWiQ4sBGJOGXGsJp+vS5mXZaxGu0qYz3bnh5JVjm0dHxxM4tgf8aVNWh2/MeF3aH2Y afTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=r9ZPkmlfxtPg4D/XkQVOFQM+XwemR82qfzo0jGwqqC4=; b=cohKMVv9JlJHm5mp7N/nNRdyqpe4Lq1hwsXEH+abRFbZizjsPS5j+X6rRuAS5h0icn +NCCjh7zz6PRNADhw4nbX/Y6WyzLt8tUTAcSQ/mYZUG9TDLed33XKY4SRV/w8Ie3wr+D HwF5DG+toyqAEPflxupr8xQslFI6oTPHnLapLG7II/1LjjTmi3k4T8IhAiZ00xV/iRTU hX/yT6kCrgew/lsxmudjtsLu8QWhN2TRM+4VznN7j/vkSft2fXk+R7d98P0KnuJYxkr8 C1tjQ5VcJIP2m6HXKMK2I72jC/lNb6Yytm4SO4qdIZe2gs/bRFif9fpQyqgsjDZpC1rb 9ajQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id l26si354469ejr.0.2019.11.14.14.21.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 14:21:42 -0800 (PST) Received-SPF: pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id xAEMLfm2017640 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Nov 2019 23:21:41 +0100 Received: from dev.vm6.ccp.siemens.com ([167.87.4.54]) by mail3.siemens.de (8.15.2/8.15.2) with ESMTP id xAEMLeeh013157; Thu, 14 Nov 2019 23:21:40 +0100 Received: from dev.localdomain (localhost [127.0.0.1]) by dev.vm6.ccp.siemens.com (Postfix) with ESMTP id 353CE2353A53; Thu, 14 Nov 2019 23:21:40 +0100 (CET) From: Adrian Freihofer To: swupdate@googlegroups.com Cc: Adrian Freihofer Subject: [swupdate] [meta-swupdate-boards][PATCH 2/2] support modular config and systemd Date: Thu, 14 Nov 2019 23:21:35 +0100 Message-Id: <20191114222135.15635-3-adrian.freihofer@siemens.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191114222135.15635-1-adrian.freihofer@siemens.com> References: <20191114222135.15635-1-adrian.freihofer@siemens.com> X-Original-Sender: adrian.freihofer@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Latest meta-swupdate provides a shell script wrapper to start swupdate. This allows to put shell code snippets into the folder /usr/lib/swupdate/conf.d to generate the parameters for swupdate at run-time, in a very flexible way. Based on that meta-swupdate-boards is now generic enough to work for systemd and sysv based DISTROs. Note: For the beaglebone board swupdate 2019.11 is highly recommended. This version provides proper support for force_ro protection. Signed-off-by: Adrian Freihofer --- .../swupdate/beaglebone-yocto/09-swupdate-args | 16 ++ .../swupdate/beaglebone-yocto/10-remove-force-ro | 2 + .../swupdate/swupdate/beaglebone-yocto/defconfig | 42 +++-- .../swupdate/swupdate/beaglebone-yocto/swupdate | 193 --------------------- .../swupdate/raspberrypi3/09-swupdate-args | 16 ++ .../swupdate/swupdate/raspberrypi3/swupdate | 191 -------------------- .../swupdate/swupdate/wandboard/09-swupdate-args | 16 ++ .../swupdate/swupdate/wandboard/swupdate | 191 -------------------- recipes-support/swupdate/swupdate_%.bbappend | 16 +- 9 files changed, 87 insertions(+), 596 deletions(-) create mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args create mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro delete mode 100644 recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate create mode 100644 recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args delete mode 100644 recipes-support/swupdate/swupdate/raspberrypi3/swupdate create mode 100644 recipes-support/swupdate/swupdate/wandboard/09-swupdate-args delete mode 100644 recipes-support/swupdate/swupdate/wandboard/swupdate diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args b/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args new file mode 100644 index 0000000..ceb4d77 --- /dev/null +++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/09-swupdate-args @@ -0,0 +1,16 @@ +rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` + +if [ $rootfs == '/dev/mmcblk1p2' ];then + selection="-e stable,copy2" +else + selection="-e stable,copy1" +fi + +state=`fw_printenv ustate | cut -f 2 -d'='` +if [ $state == 1 ];then + SWUPDATE_SURICATTA_ARGS="-c 2" +else + SWUPDATE_SURICATTA_ARGS=" " +fi + +SWUPDATE_ARGS="-H beaglebone:1.0 ${selection} -f /etc/swupdate.cfg" diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro b/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro new file mode 100644 index 0000000..33a9b9c --- /dev/null +++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/10-remove-force-ro @@ -0,0 +1,2 @@ +# be sure that we can change U-Boot ENV (not needed with swupdate >2019.11) +echo 0 > /sys/block/mmcblk1boot1/force_ro diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig b/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig index ff8ab7c..5c2cd08 100644 --- a/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig +++ b/recipes-support/swupdate/swupdate/beaglebone-yocto/defconfig @@ -11,10 +11,20 @@ CONFIG_HAVE_DOT_CONFIG=y # # General Configuration # +CONFIG_CURL=y +# CONFIG_CURL_SSL is not set +# CONFIG_SYSTEMD is not set CONFIG_SCRIPTS=y CONFIG_HW_COMPATIBILITY=y CONFIG_HW_COMPATIBILITY_FILE="/etc/hwrevision" CONFIG_SW_VERSIONS_FILE="/etc/sw-versions" + +# +# Socket Paths +# +CONFIG_SOCKET_CTRL_PATH="" +CONFIG_SOCKET_PROGRESS_PATH="" +CONFIG_SOCKET_REMOTE_HANDLER_DIRECTORY="/tmp/" # CONFIG_MTD is not set CONFIG_LUA=y CONFIG_LUAPKG="lua" @@ -35,22 +45,25 @@ CONFIG_EXTRA_LDLIBS="" # CONFIG_DEBUG is not set # CONFIG_WERROR is not set # CONFIG_NOCLEANUP is not set -# CONFIG_BOOTLOADER is not set +# CONFIG_BOOTLOADER_EBG is not set CONFIG_UBOOT=y # CONFIG_BOOTLOADER_NONE is not set # CONFIG_BOOTLOADER_GRUB is not set CONFIG_UBOOT_FWENV="/etc/fw_env.config" +CONFIG_UBOOT_NEWAPI=y +CONFIG_UBOOT_DEFAULTENV="/etc/u-boot-initial-env" +# CONFIG_SSL_IMPL_NONE is not set +CONFIG_SSL_IMPL_OPENSSL=y +# CONFIG_SSL_IMPL_MBEDTLS is not set CONFIG_DOWNLOAD=y +# CONFIG_DOWNLOAD_SSL is not set +CONFIG_CHANNEL_CURL=y CONFIG_HASH_VERIFY=y # CONFIG_SIGNED_IMAGES is not set CONFIG_ENCRYPTED_IMAGES=y CONFIG_SURICATTA=y # -# Suricatta -# - -# # Features # CONFIG_SURICATTA_SSL=y @@ -62,25 +75,13 @@ CONFIG_SURICATTA_STATE_BOOTLOADER="ustate" # Server # CONFIG_SURICATTA_HAWKBIT=y -# CONFIG_SURICATTA_SERVER_NONE is not set +# CONFIG_SURICATTA_GENERAL is not set CONFIG_WEBSERVER=y - -# -# Webserver Features -# CONFIG_MONGOOSE=y - -# -# Mongoose Feature -# -CONFIG_MONGOOSELUA=y # CONFIG_MONGOOSEIPV6 is not set CONFIG_MONGOOSESSL=y - -# -# Archival Features -# CONFIG_GUNZIP=y +# CONFIG_ZSTD is not set # # Parser Features @@ -95,9 +96,12 @@ CONFIG_JSON=y # Image Handlers # CONFIG_RAW=y +# CONFIG_RDIFFHANDLER is not set CONFIG_LUASCRIPTHANDLER=y CONFIG_SHELLSCRIPTHANDLER=y # CONFIG_HANDLER_IN_LUA is not set CONFIG_ARCHIVE=y CONFIG_REMOTE_HANDLER=y +# CONFIG_SWUFORWARDER_HANDLER is not set CONFIG_BOOTLOADERHANDLER=y +# CONFIG_UCFWHANDLER is not set diff --git a/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate b/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate deleted file mode 100644 index aba2e84..0000000 --- a/recipes-support/swupdate/swupdate/beaglebone-yocto/swupdate +++ /dev/null @@ -1,193 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: swupdate -# Required-Start: $local_fs -# Should-Start: -# Required-Stop: $local_fs -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start swupdate application -### END INIT INFO - -# The definition of actions: (From LSB 3.1.0) -# start start the service -# stop stop the service -# restart stop and restart the service if the service is already running, -# otherwise start the service -# try-restart restart the service if the service is already running -# reload cause the configuration of the service to be reloaded without -# actually stopping and restarting the service -# force-reload cause the configuration to be reloaded if the service supports -# this, otherwise restart the service if it is running -# status print the current status of the service - -# The start, stop, restart, force-reload, and status actions shall be supported -# by all init scripts; the reload and the try-restart actions are optional - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -DESC="swupdate" -NAME="swupdate" -DAEMON=/usr/bin/swupdate -PIDFILE=/var/run/$NAME.pid - -. /etc/init.d/functions || exit 1 - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# -# Function that starts the daemon/service -# -do_start() { - local status pid - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC already running ($pid)." - exit 1 - ;; - *) - rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` - - if [ $rootfs == '/dev/mmcblk1p2' ];then - selection="-e stable,copy2" - else - selection="-e stable,copy1" - fi - - state=`fw_printenv ustate | cut -f 2 -d'='` - if [ $state == 1 ];then - EXTRA_ARGS="-c 2" - else - EXTRA_ARGS="" - fi - - cd /home/root - # be sure that we can change U-Boot ENV - echo 0 > /sys/block/mmcblk1boot1/force_ro - echo "Starting $DESC ..." - exec /usr/bin/swupdate-progress -w -p -r & - exec $DAEMON -v -H beaglebone:1.0 ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" & - exit 0 - ;; - esac -} - -# -# Function that stops the daemon/service -# -do_stop() { - local pid status - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - # Exit when fail to stop, the kill would complain when fail - kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \ - echo "Stopped $DESC ($pid)." || exit $? - ;; - *) - echo "$DESC is not running; none killed." >&2 - ;; - esac - - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - return $status -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - local pid status - - status=0 - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "Reloading $DESC ..." - kill -s 1 $pid || exit $? - ;; - *) - echo "$DESC is not running; none reloaded." >&2 - ;; - esac - exit $status -} - - -# -# Function that shows the daemon/service status -# -status_of_proc () { - local pid status - - status=0 - # pidof output null when no program is running, so no "2>/dev/null". - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC is running ($pid)." - exit 0 - ;; - *) - echo "$DESC is not running." >&2 - exit $status - ;; - esac -} - -case "$1" in -start) - do_start - ;; -stop) - do_stop || exit $? - ;; -status) - status_of_proc - ;; -restart) - # Always start the service regardless the status of do_stop - do_stop - do_start - ;; -try-restart|force-reload) - # force-reload is the same as reload or try-restart according - # to its definition, the reload is not implemented here, so - # force-reload is the alias of try-restart here, but it should - # be the alias of reload if reload is implemented. - # - # Only start the service when do_stop succeeds - do_stop && do_start - ;; -#reload) - # If the "reload" action is implemented properly, then let the - # force-reload be the alias of reload, and remove it from - # try-restart|force-reload) - # - #do_reload - #;; -*) - echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2 - exit 3 - ;; -esac - diff --git a/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args b/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args new file mode 100644 index 0000000..1bad677 --- /dev/null +++ b/recipes-support/swupdate/swupdate/raspberrypi3/09-swupdate-args @@ -0,0 +1,16 @@ +rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` + +if [ $rootfs == '/dev/mmcblk0p2' ];then + selection="-e stable,copy2" +else + selection="-e stable,copy1" +fi + +state=`fw_printenv ustate | cut -f 2 -d'='` +if [ $state == 1 ];then + SWUPDATE_SURICATTA_ARGS="-c 2" +else + SWUPDATE_SURICATTA_ARGS=" " +fi + +SWUPDATE_ARGS="-H raspberrypi3:1.0 ${selection} -f /etc/swupdate.cfg" diff --git a/recipes-support/swupdate/swupdate/raspberrypi3/swupdate b/recipes-support/swupdate/swupdate/raspberrypi3/swupdate deleted file mode 100644 index 85b12ae..0000000 --- a/recipes-support/swupdate/swupdate/raspberrypi3/swupdate +++ /dev/null @@ -1,191 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: swupdate -# Required-Start: $local_fs -# Should-Start: -# Required-Stop: $local_fs -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start swupdate application -### END INIT INFO - -# The definition of actions: (From LSB 3.1.0) -# start start the service -# stop stop the service -# restart stop and restart the service if the service is already running, -# otherwise start the service -# try-restart restart the service if the service is already running -# reload cause the configuration of the service to be reloaded without -# actually stopping and restarting the service -# force-reload cause the configuration to be reloaded if the service supports -# this, otherwise restart the service if it is running -# status print the current status of the service - -# The start, stop, restart, force-reload, and status actions shall be supported -# by all init scripts; the reload and the try-restart actions are optional - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -DESC="swupdate" -NAME="swupdate" -DAEMON=/usr/bin/swupdate -PIDFILE=/var/run/$NAME.pid - -. /etc/init.d/functions || exit 1 - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# -# Function that starts the daemon/service -# -do_start() { - local status pid - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC already running ($pid)." - exit 1 - ;; - *) - rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` - - if [ $rootfs == '/dev/mmcblk0p2' ];then - selection="-e stable,copy2" - else - selection="-e stable,copy1" - fi - - state=`fw_printenv ustate | cut -f 2 -d'='` - if [ $state == 1 ];then - EXTRA_ARGS="-c 2" - else - EXTRA_ARGS="" - fi - - cd /home/root - echo "Starting $DESC ..." - exec /usr/bin/swupdate-progress -w -p -r & - exec $DAEMON -v -H raspberrypi3:1.0 ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" & - exit 0 - ;; - esac -} - -# -# Function that stops the daemon/service -# -do_stop() { - local pid status - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - # Exit when fail to stop, the kill would complain when fail - kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \ - echo "Stopped $DESC ($pid)." || exit $? - ;; - *) - echo "$DESC is not running; none killed." >&2 - ;; - esac - - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - return $status -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - local pid status - - status=0 - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "Reloading $DESC ..." - kill -s 1 $pid || exit $? - ;; - *) - echo "$DESC is not running; none reloaded." >&2 - ;; - esac - exit $status -} - - -# -# Function that shows the daemon/service status -# -status_of_proc () { - local pid status - - status=0 - # pidof output null when no program is running, so no "2>/dev/null". - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC is running ($pid)." - exit 0 - ;; - *) - echo "$DESC is not running." >&2 - exit $status - ;; - esac -} - -case "$1" in -start) - do_start - ;; -stop) - do_stop || exit $? - ;; -status) - status_of_proc - ;; -restart) - # Always start the service regardless the status of do_stop - do_stop - do_start - ;; -try-restart|force-reload) - # force-reload is the same as reload or try-restart according - # to its definition, the reload is not implemented here, so - # force-reload is the alias of try-restart here, but it should - # be the alias of reload if reload is implemented. - # - # Only start the service when do_stop succeeds - do_stop && do_start - ;; -#reload) - # If the "reload" action is implemented properly, then let the - # force-reload be the alias of reload, and remove it from - # try-restart|force-reload) - # - #do_reload - #;; -*) - echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2 - exit 3 - ;; -esac - diff --git a/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args b/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args new file mode 100644 index 0000000..0855d23 --- /dev/null +++ b/recipes-support/swupdate/swupdate/wandboard/09-swupdate-args @@ -0,0 +1,16 @@ +rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` + +if [ $rootfs == '/dev/mmcblk2p1' ];then + selection="-e stable,copy2" +else + selection="-e stable,copy1" +fi + +state=`fw_printenv ustate | cut -f 2 -d'='` +if [ $state == 1 ];then + SWUPDATE_SURICATTA_ARGS="-c 2" +else + SWUPDATE_SURICATTA_ARGS=" " +fi + +SWUPDATE_ARGS="-H wandboard:revC ${selection} -f /etc/swupdate.cfg" diff --git a/recipes-support/swupdate/swupdate/wandboard/swupdate b/recipes-support/swupdate/swupdate/wandboard/swupdate deleted file mode 100644 index 845ae43..0000000 --- a/recipes-support/swupdate/swupdate/wandboard/swupdate +++ /dev/null @@ -1,191 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: swupdate -# Required-Start: $local_fs -# Should-Start: -# Required-Stop: $local_fs -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start swupdate application -### END INIT INFO - -# The definition of actions: (From LSB 3.1.0) -# start start the service -# stop stop the service -# restart stop and restart the service if the service is already running, -# otherwise start the service -# try-restart restart the service if the service is already running -# reload cause the configuration of the service to be reloaded without -# actually stopping and restarting the service -# force-reload cause the configuration to be reloaded if the service supports -# this, otherwise restart the service if it is running -# status print the current status of the service - -# The start, stop, restart, force-reload, and status actions shall be supported -# by all init scripts; the reload and the try-restart actions are optional - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -DESC="swupdate" -NAME="swupdate" -DAEMON=/usr/bin/swupdate -PIDFILE=/var/run/$NAME.pid - -. /etc/init.d/functions || exit 1 - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# -# Function that starts the daemon/service -# -do_start() { - local status pid - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC already running ($pid)." - exit 1 - ;; - *) - rootfs=`mount | grep "on / type" | cut -d':' -f 2 | cut -d' ' -f 1` - - if [ $rootfs == '/dev/mmcblk2p1' ];then - selection="-e stable,copy2" - else - selection="-e stable,copy1" - fi - - state=`fw_printenv ustate | cut -f 2 -d'='` - if [ $state == 1 ];then - EXTRA_ARGS="-c 2" - else - EXTRA_ARGS="" - fi - - cd /home/root - echo "Starting $DESC ..." - exec /usr/bin/swupdate-progress -w -p -r & - exec $DAEMON -v -H wandboard:revC ${selection} -f /etc/swupdate.cfg -u "$EXTRA_ARGS" -w "" & - exit 0 - ;; - esac -} - -# -# Function that stops the daemon/service -# -do_stop() { - local pid status - - status=0 - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - # Exit when fail to stop, the kill would complain when fail - kill -s 15 $pid >/dev/null && rm -f $PIDFILE && \ - echo "Stopped $DESC ($pid)." || exit $? - ;; - *) - echo "$DESC is not running; none killed." >&2 - ;; - esac - - # Wait for children to finish too if this is a daemon that forks - # and if the daemon is only ever run from this initscript. - # If the above conditions are not satisfied then add some other code - # that waits for the process to drop all resources that could be - # needed by services started subsequently. A last resort is to - # sleep for some time. - return $status -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - local pid status - - status=0 - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "Reloading $DESC ..." - kill -s 1 $pid || exit $? - ;; - *) - echo "$DESC is not running; none reloaded." >&2 - ;; - esac - exit $status -} - - -# -# Function that shows the daemon/service status -# -status_of_proc () { - local pid status - - status=0 - # pidof output null when no program is running, so no "2>/dev/null". - pid=`pidofproc $NAME` || status=$? - case $status in - 0) - echo "$DESC is running ($pid)." - exit 0 - ;; - *) - echo "$DESC is not running." >&2 - exit $status - ;; - esac -} - -case "$1" in -start) - do_start - ;; -stop) - do_stop || exit $? - ;; -status) - status_of_proc - ;; -restart) - # Always start the service regardless the status of do_stop - do_stop - do_start - ;; -try-restart|force-reload) - # force-reload is the same as reload or try-restart according - # to its definition, the reload is not implemented here, so - # force-reload is the alias of try-restart here, but it should - # be the alias of reload if reload is implemented. - # - # Only start the service when do_stop succeeds - do_stop && do_start - ;; -#reload) - # If the "reload" action is implemented properly, then let the - # force-reload be the alias of reload, and remove it from - # try-restart|force-reload) - # - #do_reload - #;; -*) - echo "Usage: $0 {start|stop|status|restart|try-restart|force-reload}" >&2 - exit 3 - ;; -esac - diff --git a/recipes-support/swupdate/swupdate_%.bbappend b/recipes-support/swupdate/swupdate_%.bbappend index 62d9b58..c8bae04 100644 --- a/recipes-support/swupdate/swupdate_%.bbappend +++ b/recipes-support/swupdate/swupdate_%.bbappend @@ -3,10 +3,22 @@ FILESEXTRAPATHS_append := "${THISDIR}/${PN}:" PACKAGECONFIG_CONFARGS = "" SRC_URI += " \ - file://swupdate.cfg \ - " + file://09-swupdate-args \ + file://swupdate.cfg \ + " + +SRC_URI_append_beaglebone-yocto = " file://10-remove-force-ro" do_install_append() { + install -m 0644 ${WORKDIR}/09-swupdate-args ${D}${libdir}/swupdate/conf.d/ + install -d ${D}${sysconfdir} install -m 644 ${WORKDIR}/swupdate.cfg ${D}${sysconfdir} } + +do_install_append_beaglebone-yocto() { + # Recent swupdate as well as libubootenv handles force_ro flags automatically + if ${@bb.utils.contains('DEPENDS','libubootenv','false','true',d)}; then + install -m 0644 ${WORKDIR}/10-remove-force-ro ${D}${libdir}/swupdate/conf.d/ + fi +} \ No newline at end of file