aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/bluetooth.sh21
-rw-r--r--board/common.sh5
-rw-r--r--board/mpd.sh44
-rw-r--r--local/services/bt-agent.service18
-rw-r--r--local/services/playlists.service11
-rw-r--r--local/services/rss_playlist.service11
-rw-r--r--local/services/rss_playlist.timer13
7 files changed, 58 insertions, 65 deletions
diff --git a/board/bluetooth.sh b/board/bluetooth.sh
index c1af995..b37d6da 100644
--- a/board/bluetooth.sh
+++ b/board/bluetooth.sh
@@ -19,27 +19,6 @@ __EOF__
# Accept any code from any connexion
echo "* *" > "${TARGET_DIR}/etc/bluetooth/pins"
-# Run the Bluetooth agent
-cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/bt-agent.service"
-[Unit]
-Description=Bluetooth Agent
-After=bluetooth.service
-Requires=bluetooth.service
-
-[Service]
-Type=simple
-ExecStartPre=bt-adapter --set Discoverable 1
-#ExecStart=bt-agent -c NoInputNoOutput
-ExecStart=bt-agent -p /etc/bluetooth/pins
-## Restart the service each 60s
-#WatchdogSec=60
-#RestartSec=60
-#Restart=always
-
-[Install]
-WantedBy=multi-user.target
-__EOF__
-
enable_service "bt-agent.service"
create_missing_dir "/etc/dbus-1/system.d/"
diff --git a/board/common.sh b/board/common.sh
index 1026c11..04f0cbc 100644
--- a/board/common.sh
+++ b/board/common.sh
@@ -19,5 +19,10 @@ __EOF__
# Enable a systemd service
enable_service() {
+ if [ -e "$BR2_EXTERNAL_PIAUDIO_PATH/local/services/$1" ]; then
+ cp "$BR2_EXTERNAL_PIAUDIO_PATH/local/services/$1" "${TARGET_DIR}/etc/systemd/system/$1"
+ else
+ echo "WARN: local/services/$1 does not exists"
+ fi
ln -sf /etc/systemd/system/$1 "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/$1"
}
diff --git a/board/mpd.sh b/board/mpd.sh
index 319d7a2..9d2e3f5 100644
--- a/board/mpd.sh
+++ b/board/mpd.sh
@@ -45,50 +45,6 @@ find "$BR2_EXTERNAL_PIAUDIO_PATH/local/playlists" -name '*.m3u' -type f -print0
cp $BR2_EXTERNAL_PIAUDIO_PATH/local/mpd_playlist.sh "${TARGET_DIR}/home/"
-cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/playlists.service"
-[Unit]
-Description=Playlists
-Before=mpd.target
-
-[Service]
-Type=simple
-ExecStart=find /home/ -name '*.m3u' -exec cp {} /home/playlists \;
-
-[Install]
-WantedBy=multi-user.target
-__EOF__
-
-# Create the link to the system configuration
-#ln -sf /etc/systemd/system/playlists.service "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/playlists.service"
enable_service "playlists.service"
-
-cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/rss_playlists.service"
-[Unit]
-Description=RSS Playlists
-Wants=rss_playlists.timer
-
-[Service]
-Type=simple
-ExecStart=/home/mpd_playlist.sh
-
-[Install]
-WantedBy=multi-user.target
-__EOF__
-
-cat << __EOF__ > "${TARGET_DIR}/etc/systemd/system/rss_playlists.timer"
-[Unit]
-Description=Update the RSS playlists every day
-Requires=rss_playlists.service
-
-[Timer]
-Unit=rss_playlists.service
-OnBootSec=1min
-OnUnitInactiveSec=1d
-RandomizedDelaySec=15m
-
-[Install]
-WantedBy=timers.target
-__EOF__
-
enable_service "rss_playlists.service"
enable_service "rss_playlists.timer"
diff --git a/local/services/bt-agent.service b/local/services/bt-agent.service
new file mode 100644
index 0000000..379634e
--- /dev/null
+++ b/local/services/bt-agent.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Bluetooth Agent
+After=bluetooth.service
+Requires=bluetooth.service
+
+[Service]
+Type=simple
+ExecStartPre=bt-adapter --set Discoverable 1
+#ExecStart=bt-agent -c NoInputNoOutput
+ExecStart=bt-agent -p /etc/bluetooth/pins
+## Restart the service each 60s
+#WatchdogSec=60
+#RestartSec=60
+#Restart=always
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/local/services/playlists.service b/local/services/playlists.service
new file mode 100644
index 0000000..13729ff
--- /dev/null
+++ b/local/services/playlists.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Playlists
+Before=mpd.target
+
+[Service]
+Type=simple
+ExecStart=find /home/ -name '*.m3u' -exec cp {} /home/playlists \;
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/local/services/rss_playlist.service b/local/services/rss_playlist.service
new file mode 100644
index 0000000..87c924a
--- /dev/null
+++ b/local/services/rss_playlist.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=RSS Playlists
+Wants=rss_playlists.timer
+
+[Service]
+Type=simple
+ExecStart=/home/mpd_playlist.sh
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/local/services/rss_playlist.timer b/local/services/rss_playlist.timer
new file mode 100644
index 0000000..df70cb0
--- /dev/null
+++ b/local/services/rss_playlist.timer
@@ -0,0 +1,13 @@
+[Unit]
+Description=Update the RSS playlists every day
+Requires=rss_playlists.service
+
+[Timer]
+Unit=rss_playlists.service
+OnBootSec=1min
+OnUnitInactiveSec=1d
+RandomizedDelaySec=15m
+
+[Install]
+WantedBy=timers.target
+