Skip to content

Commit

Permalink
fix the auto startup of qtdemo
Browse files Browse the repository at this point in the history
Signed-off-by: bigbearishappy <[email protected]>
  • Loading branch information
bigbearishappy committed Aug 4, 2023
1 parent 4769469 commit c18ffce
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 6 deletions.
9 changes: 9 additions & 0 deletions recipes-qtdemo/reterminal/files/S51expand_file_system
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: expand_file_system
# Required-Start:
# Required-Stop:
# Default-Start: 3
# Default-Stop:
# Short-Description: expand file system
# Description:
### END INIT INFO

ROOT_PART="$(findmnt / -o source -n)"
ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")"
Expand Down
14 changes: 12 additions & 2 deletions recipes-qtdemo/reterminal/files/S52qtdemo
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
#!/bin/sh
#!/bin/bash
### BEGIN INIT INFO
# Provides: qtdemo
# Required-Start:
# Required-Stop:
# Default-Start: 4
# Default-Stop:
# Short-Description: qtdemo for seeed
# Description:
### END INIT INFO

modprobe lis331dlh-i2c

sleep 5
echo "loading qt demo..."
export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
cd /home/root/Seeed_Python_ReTerminalQt5Examples/src/
python3 main.py &
python3 main.py
echo "qt demo start ok!"

12 changes: 12 additions & 0 deletions recipes-qtdemo/reterminal/files/seeed_qtdemo.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description= qtdemo for reterminal plus
After=network.target

[Service]
Restart=on-failure
RestartSec=1s
User=root
ExecStart=/var/S52qtdemo

[Install]
WantedBy=multi-user.target
19 changes: 15 additions & 4 deletions recipes-qtdemo/reterminal/reterminalqt5example_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,37 @@ LIC_FILES_CHKSUM = "file://${WORKDIR}/git/LICENSE;md5=1ebbd3e34237af26da5dc08a4e

SRCREV = "${AUTOREV}"

inherit systemd

SRC_URI = "git://github.com/Seeed-Studio/Seeed_Python_ReTerminalQt5Examples.git;protocol=https;branch=main \
file://S52qtdemo \
file://S51expand_file_system \
file://seeed_qtdemo.service \
"

S = "${WORKDIR}/git"

INSANE_SKIP:${PN} = "file-rdeps"

#MY_DESTINATION = "/home/root/Seeed_Python_ReTerminalQt5Examples"
MY_DESTINATION = "/home/root/Seeed_Python_ReTerminalQt5Examples"
do_install() {
install -d ${D}${MY_DESTINATION}
if [ -d ${S}/imports/armv7l ]; then
rm -r ${S}/imports/armv7l
fi
cp -r ${WORKDIR}/git/* ${D}${MY_DESTINATION}
install -d ${D}/etc/rc5.d/
cp ${WORKDIR}/S52qtdemo ${D}/etc/rc5.d/
cp ${WORKDIR}/S51expand_file_system ${D}/etc/rc5.d/

# install qtdemo start script
install -d ${D}/var
install -m 0755 ${WORKDIR}/S52qtdemo ${D}/var
install -m 0755 ${WORKDIR}/S51expand_file_system ${D}/var

# install qtdemo start service
install -d ${D}${systemd_unitdir}/system/
install -m 0644 ${WORKDIR}/seeed_qtdemo.service ${D}${systemd_unitdir}/system/
}

FILES:${PN} += "${MY_DESTINATION}/*"

SYSTEMD_SERVICE:${PN} = "seeed_qtdemo.service"
SYSTEMD_AUTO_ENABLE:${PN} = "enable"

0 comments on commit c18ffce

Please sign in to comment.