This commit is contained in:
cheykrym 2026-09-15 17:47:41 +03:00
parent 4cd6f5f25f
commit 95cd1b84fa
2 changed files with 43 additions and 9 deletions

View File

@ -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 " Return helper: $RETURN_HELPER_TARGET"
echo " Dev helper: $DEV_HELPER_TARGET"
echo " Desktop launcher: $LAUNCHER_TARGET"

View File

@ -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