From 8ea36fe63d5f915d270ce354391a8e7247ce8a03 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 14 Jan 2020 23:43:16 +0200 Subject: [PATCH 1/2] Add support for post-upgrade scripts with network --- .../common/overlay/etc/init.d/S14postupgrade | 11 ++++-- .../overlay/etc/init.d/S42postupgradenet | 36 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100755 board/common/overlay/etc/init.d/S42postupgradenet diff --git a/board/common/overlay/etc/init.d/S14postupgrade b/board/common/overlay/etc/init.d/S14postupgrade index a2fd9fcc8d..a040b789de 100755 --- a/board/common/overlay/etc/init.d/S14postupgrade +++ b/board/common/overlay/etc/init.d/S14postupgrade @@ -3,6 +3,7 @@ SYS_VERSION_FILE="/etc/version" VERSION_FILE="/data/etc/version" POST_UPGRADE_DIR="/usr/share/post-upgrade" +POST_UPGRADE_NET_SCHEDULED="/data/.post-upgrade-net-scheduled" LOG="/var/log/post-upgrade.log" @@ -30,11 +31,18 @@ function run_post_upgrade() { echo "---- post-upgrade from ${version} to ${sys_version} ----" >> ${LOG} - versions=$(ls -1 ${POST_UPGRADE_DIR} | cut -d '.' -f 1) + echo -n > ${POST_UPGRADE_NET_SCHEDULED} + + versions=$(ls -1 ${POST_UPGRADE_DIR} | rev | cut -d '.' -f 2-100 | rev) for v in ${versions}; do if [[ ${v} == "post-upgrade" ]]; then continue fi + + if [[ ${v} == *-net ]]; then # scripts that require network + echo "${POST_UPGRADE_DIR}/${v}.sh" >> ${POST_UPGRADE_NET_SCHEDULED} + continue + fi if [[ -z "${version}" ]] || version_gt ${v} ${version}; then msg_begin "Post-upgrading to version ${v}" @@ -66,4 +74,3 @@ case "$1" in esac exit $? - diff --git a/board/common/overlay/etc/init.d/S42postupgradenet b/board/common/overlay/etc/init.d/S42postupgradenet new file mode 100755 index 0000000000..2b10d950e6 --- /dev/null +++ b/board/common/overlay/etc/init.d/S42postupgradenet @@ -0,0 +1,36 @@ +#!/bin/bash + +POST_UPGRADE_NET_SCHEDULED="/data/.post-upgrade-net-scheduled" + +LOG="/var/log/post-upgrade.log" + + +test -n "${OS_VERSION}" || source /etc/init.d/base + +test -s ${POST_UPGRADE_NET_SCHEDULED} || exit 0 + +function run_post_upgrade() { + for script in $(cat ${POST_UPGRADE_NET_SCHEDULED}); do + msg_begin "Running post-upgrade script ${script}" + ${script} >> ${LOG} 2>&1 + test $? == 0 && msg_done || msg_fail + done +} + +case "$1" in + start) + run_post_upgrade + rm ${POST_UPGRADE_NET_SCHEDULED} + ;; + + stop) + true + ;; + + *) + echo "Usage: $0 {start}" + exit 1 +esac + +exit $? + From 0ee6f94520e5fa3f36c6965142f554ead223299b Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 14 Jan 2020 23:44:58 +0200 Subject: [PATCH 2/2] busybox: enable rev applet --- board/common/busybox.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/common/busybox.config b/board/common/busybox.config index 6cdd1becd1..7c34aa9650 100644 --- a/board/common/busybox.config +++ b/board/common/busybox.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Busybox version: 1.29.3 -# Wed Dec 18 22:45:43 2019 +# Tue Jan 14 23:44:35 2020 # CONFIG_HAVE_DOT_CONFIG=y @@ -659,7 +659,7 @@ CONFIG_NSENTER=y # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set CONFIG_RENICE=y -# CONFIG_REV is not set +CONFIG_REV=y # CONFIG_RTCWAKE is not set # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set