From 95cd1b84fa6b6273d7875e60acfcbf174554f1b4 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Tue, 15 Sep 2026 17:47:41 +0300 Subject: [PATCH] update --- scripts/deploy.sh | 41 +++++++++++++++++++++++++++-------- scripts/switch-to-dev-mode.sh | 11 ++++++++++ 2 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 scripts/switch-to-dev-mode.sh diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 5405911..de0b0ce 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -14,8 +14,11 @@ DESKTOP_DIR="/home/$DESKTOP_USER/Desktop" LAUNCHER_SOURCE="$PROJECT_DIR/system_configs/Return_to_Car_UI.desktop" LAUNCHER_TARGET="$DESKTOP_DIR/Return_to_Car_UI.desktop" -HELPER_SOURCE="$PROJECT_DIR/scripts/return-to-car-mode.sh" -HELPER_TARGET="/usr/local/bin/return-to-car-mode" +RETURN_HELPER_SOURCE="$PROJECT_DIR/scripts/return-to-car-mode.sh" +RETURN_HELPER_TARGET="/usr/local/bin/return-to-car-mode" + +DEV_HELPER_SOURCE="$PROJECT_DIR/scripts/switch-to-dev-mode.sh" +DEV_HELPER_TARGET="/usr/local/bin/switch-to-dev-mode" if [[ $EUID -ne 0 ]]; then echo "ERROR: deploy.sh must be run as root." @@ -39,9 +42,15 @@ if [[ ! -f "$LAUNCHER_SOURCE" ]]; then exit 1 fi -if [[ ! -f "$HELPER_SOURCE" ]]; then +if [[ ! -f "$RETURN_HELPER_SOURCE" ]]; then echo "ERROR: Return-to-Car helper not found:" - echo " $HELPER_SOURCE" + echo " $RETURN_HELPER_SOURCE" + exit 1 +fi + +if [[ ! -f "$DEV_HELPER_SOURCE" ]]; then + echo "ERROR: Switch-to-Dev helper not found:" + echo " $DEV_HELPER_SOURCE" exit 1 fi @@ -55,9 +64,15 @@ rm -rf "$INSTALL_DIR" mkdir -p "$INSTALL_DIR" cp -a "$SOURCE_DIR/." "$INSTALL_DIR/" -echo "==> Installing Return to Car UI helper" +echo "==> Installing system helpers" -install -m 755 "$HELPER_SOURCE" "$HELPER_TARGET" +install -o root -g root -m 755 \ + "$RETURN_HELPER_SOURCE" \ + "$RETURN_HELPER_TARGET" + +install -o root -g root -m 755 \ + "$DEV_HELPER_SOURCE" \ + "$DEV_HELPER_TARGET" echo "==> Installing desktop launcher" @@ -77,9 +92,17 @@ sudo -u "$DESKTOP_USER" \ echo "==> Starting $SERVICE" -systemctl start "$SERVICE" +if [[ "$(systemctl get-default)" == "multi-user.target" ]]; then + echo "==> Starting $SERVICE" + systemctl start "$SERVICE" +else + echo "==> Development mode detected" + echo " $SERVICE will not be started" +fi echo echo "==> Deployment complete" -echo " Application: $INSTALL_DIR/car_ui" -echo " Launcher: $LAUNCHER_TARGET" +echo " Application: $INSTALL_DIR/car_ui" +echo " Return helper: $RETURN_HELPER_TARGET" +echo " Dev helper: $DEV_HELPER_TARGET" +echo " Desktop launcher: $LAUNCHER_TARGET" diff --git a/scripts/switch-to-dev-mode.sh b/scripts/switch-to-dev-mode.sh new file mode 100644 index 0000000..a068ad5 --- /dev/null +++ b/scripts/switch-to-dev-mode.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -euo pipefail + +systemctl disable car-ui.service + +systemctl unmask getty@tty1.service +systemctl enable getty@tty1.service + +systemctl set-default graphical.target + +reboot