1
0
Fork 0
mirror of https://gitlab.postmarketos.org/postmarketOS/pmaports.git synced 2025-07-13 00:29:49 +03:00
pmaports/extra-repos/systemd/dsme/0001-correct-paths.patch

77 lines
2.3 KiB
Diff

This scripts assumes locations that are not valid on our system.
Also, we do not have a shutdown command available
This patch modifies the paths to our locations, and removes the shutdown command
diff --git a/reboot-via-dsme.sh b/reboot-via-dsme.sh
index cc97de0..40aee0f 100644
--- a/reboot-via-dsme.sh
+++ b/reboot-via-dsme.sh
@@ -11,9 +11,9 @@
# commands from interactive shell, but do the shutdown/reboot
# via dsme.
#
-# If needed, the real systemd binaries (e.g. reboot) can still
+# If needed, the real binaries (e.g. reboot) can still
# be invoked by using the full path:
-# # /usr/sbin/reboot
+# # /sbin/reboot
#
# Or by ignoring the shell functions via command:
# # command reboot
@@ -21,51 +21,18 @@
# Define shell functions for interactive shells only
case "$-" in *i*) ;; *) return ;; esac
-# Replace simple poweroff/halt/reboot/shutdown invocations
+# Replace simple poweroff/halt/reboot invocations
# with equivalent dsmetool operations
poweroff()
{
- [ "$#" -eq 0 ] && /usr/sbin/dsmetool --shutdown || /usr/sbin/poweroff "$@"
+ [ "$#" -eq 0 ] && /usr/sbin/dsmetool --shutdown || /sbin/poweroff "$@"
}
halt()
{
- [ "$#" -eq 0 ] && /usr/sbin/dsmetool --shutdown || /usr/sbin/halt "$@"
+ [ "$#" -eq 0 ] && /usr/sbin/dsmetool --shutdown || /sbin/halt "$@"
}
reboot()
{
- [ "$#" -eq 0 ] && /usr/sbin/dsmetool --reboot || /usr/sbin/reboot "$@"
-}
-shutdown()
-{
- DSME_SHUTDOWN_MODE="--shutdown"
- DSME_SHUTDOWN_TIME=""
- DSME_SHUTDOWN_MESG=""
- DSME_SHUTDOWN_UNKN=""
- for f in "$@"; do
- case "$f" in
- -H|--halt|-P|--poweroff|-h)
- DSME_SHUTDOWN_MODE="--shutdown"
- ;;
- -r|--reboot)
- DSME_SHUTDOWN_MODE="--reboot"
- ;;
- -*)
- DSME_SHUTDOWN_UNKN="y"
- ;;
- *)
- if [ -z "$DSME_SHUTDOWN_TIME" ]; then
- DSME_SHUTDOWN_TIME="$f"
- else
- DSME_SHUTDOWN_MESG="$f"
- fi
- ;;
- esac
- done
- [ "${DSME_SHUTDOWN_TIME:-now}" = "now" ] && \
- [ "$DSME_SHUTDOWN_MESG" = "" ] && \
- [ "$DSME_SHUTDOWN_UNKN" = "" ] && \
- /usr/sbin/dsmetool "$DSME_SHUTDOWN_MODE" || /usr/sbin/shutdown "$@"
- unset DSME_SHUTDOWN_MODE DSME_SHUTDOWN_TIME
- unset DSME_SHUTDOWN_MESG DSME_SHUTDOWN_UNKN
+ [ "$#" -eq 0 ] && /usr/sbin/dsmetool --reboot || /sbin/reboot "$@"
}