Jelajahi Sumber

update systemd

tuanchris 4 bulan lalu
induk
melakukan
b7c2f2169a

+ 8 - 2
dune-weaver-touch/dune-weaver-touch.service

@@ -1,7 +1,9 @@
 [Unit]
 Description=Dune Weaver Touch Interface
-After=graphical.target
+After=multi-user.target graphical.target systemd-user-sessions.service
 Wants=graphical.target
+# Ensure framebuffer is ready before starting
+After=systemd-vconsole-setup.service
 
 [Service]
 Type=simple
@@ -12,9 +14,13 @@ Environment=DISPLAY=:0
 Environment=QT_QPA_PLATFORM=linuxfb
 Environment=QT_QPA_FB_DRM=1
 Environment=QT_QPA_FONTDIR=/usr/share/fonts
-ExecStart=/home/pi/dune-weaver-touch/venv/bin/python /home/pi/dune-weaver-touch/main.py
+# Use wrapper script that checks for framebuffer availability
+ExecStart=/home/pi/dune-weaver-touch/start-with-fb-check.sh
 Restart=always
 RestartSec=5
+# Limit restart attempts on boot
+StartLimitBurst=5
+StartLimitIntervalSec=60
 
 [Install]
 WantedBy=graphical.target

+ 7 - 7
dune-weaver-touch/install.sh

@@ -55,22 +55,22 @@ install_scripts() {
 # Function to setup systemd service
 setup_systemd() {
     echo "🚀 Setting up systemd service..."
-    
+
+    # Make startup wrapper executable
+    chmod +x "$SCRIPT_DIR/start-with-fb-check.sh"
+
     # Update paths in the service file
     sed "s|/home/pi/dune-weaver-touch|$SCRIPT_DIR|g" "$SCRIPT_DIR/dune-weaver-touch.service" > /tmp/dune-weaver-touch.service
     sed -i "s|User=pi|User=$ACTUAL_USER|g" /tmp/dune-weaver-touch.service
     sed -i "s|Group=pi|Group=$ACTUAL_USER|g" /tmp/dune-weaver-touch.service
-    
-    # Ensure the ExecStart uses the venv python
-    sed -i "s|ExecStart=.*python.*|ExecStart=$SCRIPT_DIR/venv/bin/python $SCRIPT_DIR/main.py|g" /tmp/dune-weaver-touch.service
-    
+
     # Copy service file
     cp /tmp/dune-weaver-touch.service /etc/systemd/system/
-    
+
     # Enable service
     systemctl daemon-reload
     systemctl enable dune-weaver-touch.service
-    
+
     echo "   🚀 Systemd service installed and enabled"
 }