From 29f5f5b3f3917dc77040cf3e0e9943e8b382c5bd Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 19 Jun 2021 09:26:52 +0200 Subject: [PATCH 1/3] update Recovery version to 2.3.0 Signed-off-by: Michel-FK --- Recovery/board/funkey/rootfs-overlay/etc/issue | 2 +- Recovery/board/funkey/rootfs-overlay/etc/os-release | 10 +++++----- Recovery/board/funkey/rootfs-overlay/etc/sw-versions | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Recovery/board/funkey/rootfs-overlay/etc/issue b/Recovery/board/funkey/rootfs-overlay/etc/issue index 588ec58..cb97a30 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/issue +++ b/Recovery/board/funkey/rootfs-overlay/etc/issue @@ -5,6 +5,6 @@ |___| |_____|__|__||__|\__||_____|___ | FUN ON A KEYCHAIN |_____| ----------------------------------------------------- - Version 2.1.1 (Recovery) + Version 2.3.0 (Recovery) ----------------------------------------------------- diff --git a/Recovery/board/funkey/rootfs-overlay/etc/os-release b/Recovery/board/funkey/rootfs-overlay/etc/os-release index b2a962b..79857e6 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/os-release +++ b/Recovery/board/funkey/rootfs-overlay/etc/os-release @@ -1,12 +1,12 @@ NAME="FunKey-OS Recovery" -VERSION="2.1.1 (Vitriolic Vulture)" +VERSION="2.3.0 (Zen Zebu)" ID=funkey-recovery ID_LIKE=buildroot -PRETTY_NAME="FunKey-OS Recovery 2.1.1" -VERSION_ID="2.1.1" +PRETTY_NAME="FunKey-OS Recovery 2.3.0" +VERSION_ID="2.3.0" HOME_URL="https://www.funkey-project.com/" SUPPORT_URL="https://www.funkey-project.com/" BUG_REPORT_URL="https://www.funkey-project.com/" PRIVACY_POLICY_URL="https://www.funkey-project.com" -VERSION_CODENAME=Vitriolic -UBUNTU_CODENAME=Vitriolic +VERSION_CODENAME=Zen +UBUNTU_CODENAME=Zen diff --git a/Recovery/board/funkey/rootfs-overlay/etc/sw-versions b/Recovery/board/funkey/rootfs-overlay/etc/sw-versions index c02866f..8e9cb2d 100644 --- a/Recovery/board/funkey/rootfs-overlay/etc/sw-versions +++ b/Recovery/board/funkey/rootfs-overlay/etc/sw-versions @@ -1 +1 @@ -Recovery 2.1.1 +Recovery 2.3.0 From 04570f0499ba0c174efb0c64cca728916976e4c6 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 19 Jun 2021 12:01:25 +0200 Subject: [PATCH 2/3] fix indentation Signed-off-by: Michel-FK --- .../usr/local/sbin/instant_play | 111 +++++++++--------- .../funkey/rootfs-overlay/usr/local/sbin/pid | 2 +- 2 files changed, 56 insertions(+), 57 deletions(-) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play index 43a5b4e..b6185ba 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play @@ -23,83 +23,82 @@ fi case ${1} in load) - if [ ${#} -ne 1 ]; then - usage - fi - - # Umount any remaining OPK, if any - umount /opk >/dev/null 2>&1 - - # Mount last OPK, if any - if [ -r "${LAST_OPK_FILE}" ]; then - last_opk=$(cat "${LAST_OPK_FILE}") - mount -t squashfs "${last_opk}" /opk - fi - - # Remove unnecessary files - rm -f "${RESUME_PLAY_FILE}" - - # Launch Previous Game if any - if [ -f "${INSTANT_PLAY_FILE}" ]; then - keymap resume - echo -n "Found Instant Play file, restarting previous game with command: " - cat "${INSTANT_PLAY_FILE}" - mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}" - source "${RESUME_PLAY_FILE}" - rm -f "${RESUME_PLAY_FILE}" - keymap default - termfix_all - fi - - # Unmount last OPK, if any - if [ -r "${LAST_OPK_FILE}" -a ! -f "${REBOOTING_FILE}" ]; then - umount /opk - rm "${LAST_OPK_FILE}" + if [ ${#} -ne 1 ]; then + usage fi - ;; + + # Umount any remaining OPK, if any + umount /opk >/dev/null 2>&1 + + # Mount last OPK, if any + if [ -r "${LAST_OPK_FILE}" ]; then + last_opk=$(cat "${LAST_OPK_FILE}") + mount -t squashfs "${last_opk}" /opk + fi + + # Remove unnecessary files + rm -f "${RESUME_PLAY_FILE}" + + # Launch Previous Game if any + if [ -f "${INSTANT_PLAY_FILE}" ]; then + keymap resume + echo -n "Found Instant Play file, restarting previous game with command: " + cat "${INSTANT_PLAY_FILE}" + mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}" + source "${RESUME_PLAY_FILE}" + rm -f "${RESUME_PLAY_FILE}" + keymap default + termfix_all + fi + + # Unmount last OPK, if any + if [ -r "${LAST_OPK_FILE}" -a ! -f "${REBOOTING_FILE}" ]; then + umount /opk + rm "${LAST_OPK_FILE}" + fi + ;; save) - if [ ${#} -lt 2 ]; then - usage - fi - shift + if [ ${#} -lt 2 ]; then + usage + fi + shift - # Write quick load file args - echo -n "" > "${INSTANT_PLAY_FILE}" - printf "'" >> "${INSTANT_PLAY_FILE}" - # First arg is prog name, forcing real path - bin=$(printf %s "$1" | sed "s/'/'\\\\''/g") + # Write quick load file args + echo -n "" > "${INSTANT_PLAY_FILE}" + printf "'" >> "${INSTANT_PLAY_FILE}" + # First arg is prog name, forcing real path + bin=$(printf %s "$1" | sed "s/'/'\\\\''/g") bin_name=$(basename "$bin") bin_path="$(cat $PID_PATH)"/"$bin_name" - echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}" + echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}" printf "' " >> "${INSTANT_PLAY_FILE}" shift - while [ "$#" != "0" ] - do + while [ "$#" != "0" ] + do printf "'" >> "${INSTANT_PLAY_FILE}" printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" printf "' " >> "${INSTANT_PLAY_FILE}" shift - done + done - # Add the magic sauce to launch the process in background, - # record the PID into a file, wait for the process to - # terminate and erase the recorded PID - cat << EOF >> "${INSTANT_PLAY_FILE}" + # Add the magic sauce to launch the process in background, + # record the PID into a file, wait for the process to + # terminate and erase the recorded PID + cat << EOF >> "${INSTANT_PLAY_FILE}" & pid record \$! wait \$! pid erase EOF - # Now terminate gracefully - exec powerdown now - ;; + # Now terminate gracefully + exec powerdown now + ;; *) - usage - ;; + usage + ;; esac exit 0 - diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid index 19fca61..3d48b1c 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid @@ -41,7 +41,7 @@ case "${1}" in erase_pid ;; - print) + print) cat "${PID_FILE}" ;; From 2155537e624db16a387f7185d32a0ac94ca1ac35 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 19 Jun 2021 12:03:58 +0200 Subject: [PATCH 3/3] use pid script wherever possible Signed-off-by: Michel-FK --- .../funkey/rootfs-overlay/usr/local/sbin/assembly_tests | 4 ++-- .../board/funkey/rootfs-overlay/usr/local/sbin/powerdown | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests index 81b9a1b..4a67fd5 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/assembly_tests @@ -18,7 +18,7 @@ touch ${LOCK_FILE} ## Register ourself as the running FunKey task for receiving USR1 ## signal for shutting down -echo $$ > "/var/run/funkey.pid" +pid record $$ ## Binaries PROD_SCREEN_BIN="/usr/local/sbin/funkey_prod_screens" @@ -224,7 +224,7 @@ function launch_tests_up_until_magnet { ## Register ourself back as the running FunKey task for receiving USR1 ## signal for shutting down - echo $$ > "/var/run/funkey.pid" + pid record $$ # check magnet test result if [[ "$res" == "0" ]]; then diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown index 8717ad2..4412a84 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown @@ -4,7 +4,6 @@ #set -x SELF="$(basename ${0})" -PID_FILE="/var/run/funkey.pid" PID_PATH="/var/run/pid_path" REBOOTING_FILE="/run/rebooting" @@ -19,12 +18,12 @@ schedule_powerdown() { # Save current pid path before closing bin # (won't work if bin is already closed) - pid_path=$(dirname $(readlink /proc/$(pid print)/exe)) - echo -n "$pid_path" > "$PID_PATH" + local pid_path=$(dirname $(readlink /proc/$(pid print)/exe)) + echo -n "${pid_path}" > "${PID_PATH}" # Send USR1 signal to the running FunKey process to warn about # impending shutdown - pkill -USR1 -F "${PID_FILE}" > /dev/null 2>&1 + pkill -USR1 "$(pid print)" > /dev/null 2>&1 # Delay for the given grace period seconds to catch signal USR2. # If the signal is caught, then it means the running FunKey