From 6087251483dd72920463a6ac5de3c873ca13b58a Mon Sep 17 00:00:00 2001 From: Yossi Date: Sun, 8 Apr 2018 15:23:25 +0300 Subject: [PATCH] migrate services to systemctl :rocket: --- stage2/06-dride-base/00-run.sh | 10 +++++++--- .../06-dride-base/files/etc_initd_dride-core | 7 ------- .../06-dride-base/files/systemctl/ble.service | 18 ++++++++++++++++++ .../files/systemctl/record.service | 18 ++++++++++++++++++ .../06-dride-base/files/systemctl/ws.service | 17 +++++++++++++++++ stage3/00-install-packages/00-packages | 14 -------------- stage3/01-tweaks/00-run.sh | 3 --- stage3/prerun.sh | 5 ----- 8 files changed, 60 insertions(+), 32 deletions(-) create mode 100644 stage2/06-dride-base/files/systemctl/ble.service create mode 100644 stage2/06-dride-base/files/systemctl/record.service create mode 100644 stage2/06-dride-base/files/systemctl/ws.service delete mode 100644 stage3/00-install-packages/00-packages delete mode 100755 stage3/01-tweaks/00-run.sh delete mode 100755 stage3/prerun.sh diff --git a/stage2/06-dride-base/00-run.sh b/stage2/06-dride-base/00-run.sh index 81f3f1d..b4e18ce 100755 --- a/stage2/06-dride-base/00-run.sh +++ b/stage2/06-dride-base/00-run.sh @@ -5,10 +5,13 @@ # Do not include if you are building for RPiZW -install -m 755 files/etc_initd_dride-ws ${ROOTFS_DIR}/etc/init.d/dride-ws install -m 755 files/etc_initd_dride-core ${ROOTFS_DIR}/etc/init.d/dride-core install -m 644 files/lib_udev_hwclock-set ${ROOTFS_DIR}/lib/udev/hwclock-set +install -m 644 files/systemctl/ble.service ${ROOTFS_DIR}/lib/systemd/system/ble.service +install -m 644 files/systemctl/record.service ${ROOTFS_DIR}/lib/systemd/system/record.service +install -m 644 files/systemctl/ws.service ${ROOTFS_DIR}/lib/systemd/system/ws.service + on_chroot << EOF #------------------------------------------------------- @@ -110,11 +113,12 @@ sudo pip install pyserial # express on startup -sudo update-rc.d dride-ws defaults +sudo systemtl enable ws # dride-core on startup sudo update-rc.d dride-core defaults - +sudo systemtl enable record +sudo systemtl enable ble if [ ${OS_TYPE} == "dride-plus" ]; then diff --git a/stage2/06-dride-base/files/etc_initd_dride-core b/stage2/06-dride-base/files/etc_initd_dride-core index b16ac62..69b478e 100644 --- a/stage2/06-dride-base/files/etc_initd_dride-core +++ b/stage2/06-dride-base/files/etc_initd_dride-core @@ -20,13 +20,6 @@ case "$1" in echo "Starting dride-core" #blink LED sudo python /home/core/modules/indicators/python/states/standalone.py welcome - - # start recording - sudo nice -n -19 node /home/core/modules/video/index.js & - - # run button / bluetooth daemon - sudo python /home/core/daemons/bluetooth/initPin.py & - sudo BLENO_DEVICE_NAME="dride" node /home/core/daemons/bluetooth/main.js & ;; stop) echo "Stopping dride-core" diff --git a/stage2/06-dride-base/files/systemctl/ble.service b/stage2/06-dride-base/files/systemctl/ble.service new file mode 100644 index 0000000..934a8bf --- /dev/null +++ b/stage2/06-dride-base/files/systemctl/ble.service @@ -0,0 +1,18 @@ +[Unit] +Description=Control record proccess in your Dride +Documentation=https://dride.io/documentation +After=network.target + +[Service] +Environment=BLENO_DEVICE_NAME=dride +Type=simple +User=pi +ExecStart=/usr/bin/node /home/core/daemons/bluetooth/main.js +Restart=on-failure + +[Install] +WantedBy=multi-user.target + + + + diff --git a/stage2/06-dride-base/files/systemctl/record.service b/stage2/06-dride-base/files/systemctl/record.service new file mode 100644 index 0000000..a07fceb --- /dev/null +++ b/stage2/06-dride-base/files/systemctl/record.service @@ -0,0 +1,18 @@ +[Unit] +Description=Control record proccess in your Dride +Documentation=https://dride.io/documentation +After=network.target + +[Service] +Environment=NODE_PORT=3001 +Type=simple +User=pi +ExecStart=/usr/bin/node /home/core/modules/video/index.js +Restart=on-failure + +[Install] +WantedBy=multi-user.target + + + + diff --git a/stage2/06-dride-base/files/systemctl/ws.service b/stage2/06-dride-base/files/systemctl/ws.service new file mode 100644 index 0000000..8821d13 --- /dev/null +++ b/stage2/06-dride-base/files/systemctl/ws.service @@ -0,0 +1,17 @@ +[Unit] +Description=Control record proccess in your Dride +Documentation=https://dride.io/documentation +After=network.target + +[Service] +Type=simple +User=pi +ExecStart=/usr/bin/node /home/core/dride-ws/server/app.js +Restart=on-failure + +[Install] +WantedBy=multi-user.target + + + + diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages deleted file mode 100644 index ad64cce..0000000 --- a/stage3/00-install-packages/00-packages +++ /dev/null @@ -1,14 +0,0 @@ -gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav -xpdf gtk2-engines alsa-utils -desktop-base -git -omxplayer -raspberrypi-artwork -policykit-1 -gvfs -rfkill -chromium-browser rpi-chromium-mods -gldriver-test -fonts-droid-fallback -fonts-liberation2 -obconf diff --git a/stage3/01-tweaks/00-run.sh b/stage3/01-tweaks/00-run.sh deleted file mode 100755 index 5da7c1a..0000000 --- a/stage3/01-tweaks/00-run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -e - -rm -f "${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d/wait.conf" diff --git a/stage3/prerun.sh b/stage3/prerun.sh deleted file mode 100755 index 9acd13c..0000000 --- a/stage3/prerun.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -e - -if [ ! -d "${ROOTFS_DIR}" ]; then - copy_previous -fi