From b175f17acda88e3af8498907a98e06ed93c8bc91 Mon Sep 17 00:00:00 2001 From: Willow Barraco Date: Fri, 21 Jul 2023 10:40:08 +0200 Subject: [PATCH] Add placeholder hooks to simplify user migrations Without those, every sxmo_migrate.sh ask the user if they want to remove those. Adding a placeholder make it easy to differenciate known hooks, and hooks that has been removed. This also cleanup, merge or fix some existing hooks. --- configs/default_hooks/sxmo_hook_power.sh | 8 ++++++++ configs/default_hooks/sxmo_hook_smslog.sh | 2 +- configs/default_hooks/sxmo_hook_tailtextlog.sh | 1 - docs/sxmo.7.scd | 4 ++-- scripts/core/sxmo_power.sh | 4 ++-- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 configs/default_hooks/sxmo_hook_power.sh diff --git a/configs/default_hooks/sxmo_hook_power.sh b/configs/default_hooks/sxmo_hook_power.sh new file mode 100644 index 0000000..c4d8fa0 --- /dev/null +++ b/configs/default_hooks/sxmo_hook_power.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# SPDX-License-Identifier: AGPL-3.0-only +# Copyright 2022 Sxmo Contributors + +# This script is executed before reboot and poweroff the system +# +# The following parameters are provided: +# $1 = Action (poweroff or reboot) diff --git a/configs/default_hooks/sxmo_hook_smslog.sh b/configs/default_hooks/sxmo_hook_smslog.sh index 8728302..2dcf984 100755 --- a/configs/default_hooks/sxmo_hook_smslog.sh +++ b/configs/default_hooks/sxmo_hook_smslog.sh @@ -3,7 +3,7 @@ # Copyright 2022 Sxmo Contributors # Allow user to override what we log in the sms.txt file. Note if you change -# this you probably should change sxmo_hook_parselog.sh +# this you probably should change sxmo_hook_tailtextlog.sh # include common definitions # shellcheck source=scripts/core/sxmo_common.sh diff --git a/configs/default_hooks/sxmo_hook_tailtextlog.sh b/configs/default_hooks/sxmo_hook_tailtextlog.sh index 1491366..611c8e4 100755 --- a/configs/default_hooks/sxmo_hook_tailtextlog.sh +++ b/configs/default_hooks/sxmo_hook_tailtextlog.sh @@ -48,4 +48,3 @@ CONTACTSSEDCMD="$(mkcontactssedcmd)" sxmo_terminal.sh sh -c "tail -n9999 -f \"$SXMO_LOGDIR/$LOGDIRNUM/sms.txt\" |\ sed -e \"$CONTACTSSEDCMD\" -e \"$DATESEDCMD\" -e \"$COLORSEDCMD\"" -#sxmo_terminal.sh sh -c "sxmo_hook_parselog.sh \"$NUMBER\"" diff --git a/docs/sxmo.7.scd b/docs/sxmo.7.scd index 9b5f55a..d51fa40 100644 --- a/docs/sxmo.7.scd +++ b/docs/sxmo.7.scd @@ -575,8 +575,8 @@ If your phone has a wifi killswitch (like the Pinephone or Librem 5), make sure HOOKS: _sxmo_hook_network_up.sh_ (what to do when network goes up), _sxmo_hook_network_down.sh_ (what to do when network goes down), -_sxmo_hook_network_preup.sh_, -_sxmo_hook_network_predown.sh_ +_sxmo_hook_network_pre_up.sh_, +_sxmo_hook_network_pre_down.sh_ # AUDIO diff --git a/scripts/core/sxmo_power.sh b/scripts/core/sxmo_power.sh index 77649d8..60ea179 100755 --- a/scripts/core/sxmo_power.sh +++ b/scripts/core/sxmo_power.sh @@ -11,12 +11,12 @@ usage() { case "$1" in reboot) - sxmo_hook_reboot.sh + sxmo_hook_power.sh reboot sxmo_daemons.sh stop all doas reboot ;; poweroff) - sxmo_hook_poweroff.sh + sxmo_hook_power.sh poweroff sxmo_daemons.sh stop all doas poweroff ;;