aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/bluetooth.sh47
-rw-r--r--board/network.sh26
-rwxr-xr-xboard/post-build.sh95
-rw-r--r--board/pulseaudio.sh23
4 files changed, 99 insertions, 92 deletions
diff --git a/board/bluetooth.sh b/board/bluetooth.sh
new file mode 100644
index 0000000..e49a345
--- /dev/null
+++ b/board/bluetooth.sh
@@ -0,0 +1,47 @@
+#############################
+# #
+# Bluetooth configuration #
+# #
+#############################
+
+create_missing_dir "/etc/bluetooth/"
+cat << __EOF__ > "${TARGET_DIR}/etc/bluetooth/main.conf"
+[General]
+
+Class = 200428
+DiscoverableTimeout = 0
+PairableTimeout = 0
+
+[Policy]
+AutoEnable=true
+__EOF__
+
+
+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
+RestartSec=5
+Restart=always
+KillSignal=SIGUSR1
+
+[Install]
+WantedBy=bluetooth.target
+__EOF__
+
+# The same for the bluetooth, as bluetoothd keep a track for each paired device
+create_missing_dir "/var/lib/bluetooth/"
+if ! grep -qE '/var/lib/bluetooth' "${TARGET_DIR}/etc/fstab"; then
+ cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
+tmpfs /var/lib/bluetooth tmpfs rw 0 0
+__EOF__
+fi
+
+
+
diff --git a/board/network.sh b/board/network.sh
new file mode 100644
index 0000000..65a5640
--- /dev/null
+++ b/board/network.sh
@@ -0,0 +1,26 @@
+###########################
+# #
+# Network configuration #
+# #
+###########################
+
+# Add default wpa_supplicant.conf if it exists
+if [ -f "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" ]; then
+ create_missing_dir "/etc/wpa_supplicant/"
+ cat "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" > "${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant-wlan0.conf"
+
+
+ cat << __EOF__ > "${TARGET_DIR}/etc/systemd/network/wireless.network"
+[Match]
+Name=wlan0
+
+[Network]
+DHCP=yes
+__EOF__
+
+ # Create the link to interface wlan0 directly in the system configuration
+ ln -sf /usr/lib/systemd/system/wpa_supplicant@.service "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service"
+
+fi
+
+
diff --git a/board/post-build.sh b/board/post-build.sh
index 6b1c86c..cfdaec0 100755
--- a/board/post-build.sh
+++ b/board/post-build.sh
@@ -15,98 +15,9 @@ fi
# Put the whole system in readonly
sed -ie '/^\/dev\/root/ s/rw 0 1/ro 0 0/' "${TARGET_DIR}/etc/fstab"
-###########################
-# #
-# Network configuration #
-# #
-###########################
-
-# Add default wpa_supplicant.conf if it exists
-if [ -f "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" ]; then
- create_missing_dir "/etc/wpa_supplicant/"
- cat "$BR2_EXTERNAL_PIAUDIO_PATH/wpa_supplicant.conf" > "${TARGET_DIR}/etc/wpa_supplicant/wpa_supplicant-wlan0.conf"
-
-
- cat << __EOF__ > "${TARGET_DIR}/etc/systemd/network/wireless.network"
-[Match]
-Name=wlan0
-
-[Network]
-DHCP=yes
-__EOF__
-
- # Create the link to interface wlan0 directly in the system configuration
- ln -sf /usr/lib/systemd/system/wpa_supplicant@.service "${TARGET_DIR}/usr/lib/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service"
-
-fi
-
-##############################
-# #
-# Pulseaudio configuration #
-# #
-##############################
-
-# Create the directory where pulseaudio store its files and put it in tempfs
-create_missing_dir "/var/lib/pulse"
-if ! grep -qE '/var/lib/pulse' "${TARGET_DIR}/etc/fstab"; then
- cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
-tmpfs /var/lib/pulse tmpfs rw 0 0
-__EOF__
-fi
-
-if ! grep -qE '^load-module module-native-protocol-tcp' "${TARGET_DIR}/etc/pulse/system.pa"; then
- cat << __EOF__ >> "${TARGET_DIR}/etc/pulse/system.pa"
-load-module module-bluetooth-policy
-load-module module-bluetooth-discover
-load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24;2a01:e35:8ac8:0e00::/64 auth-anonymous=1
-__EOF__
-fi
-
-#############################
-# #
-# Bluetooth configuration #
-# #
-#############################
-
-create_missing_dir "/etc/bluetooth/"
-cat << __EOF__ > "${TARGET_DIR}/etc/bluetooth/main.conf"
-[General]
-
-Class = 200428
-DiscoverableTimeout = 0
-PairableTimeout = 0
-
-[Policy]
-AutoEnable=true
-__EOF__
-
-
-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
-RestartSec=5
-Restart=always
-KillSignal=SIGUSR1
-
-[Install]
-WantedBy=bluetooth.target
-__EOF__
-
-# The same for the bluetooth, as bluetoothd keep a track for each paired device
-create_missing_dir "/var/lib/bluetooth/"
-if ! grep -qE '/var/lib/bluetooth' "${TARGET_DIR}/etc/fstab"; then
- cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
-tmpfs /var/lib/bluetooth tmpfs rw 0 0
-__EOF__
-fi
-
+. "${BR2_EXTERNAL_PIAUDIO_PATH}/board/network.sh"
+. "${BR2_EXTERNAL_PIAUDIO_PATH}/board/pulseaudio.sh"
+. "${BR2_EXTERNAL_PIAUDIO_PATH}/board/bluetooth.sh"
mkdir -p "${TARGET_DIR}"/etc/systemd/system/getty.target.wants
# Add a console on ttyAMA0 and enable auto login
diff --git a/board/pulseaudio.sh b/board/pulseaudio.sh
new file mode 100644
index 0000000..8b1186c
--- /dev/null
+++ b/board/pulseaudio.sh
@@ -0,0 +1,23 @@
+##############################
+# #
+# Pulseaudio configuration #
+# #
+##############################
+
+# Create the directory where pulseaudio store its files and put it in tempfs
+create_missing_dir "/var/lib/pulse"
+if ! grep -qE '/var/lib/pulse' "${TARGET_DIR}/etc/fstab"; then
+ cat << __EOF__ >> "${TARGET_DIR}/etc/fstab"
+tmpfs /var/lib/pulse tmpfs rw 0 0
+__EOF__
+fi
+
+if ! grep -qE '^load-module module-native-protocol-tcp' "${TARGET_DIR}/etc/pulse/system.pa"; then
+ cat << __EOF__ >> "${TARGET_DIR}/etc/pulse/system.pa"
+load-module module-bluetooth-policy
+load-module module-bluetooth-discover
+load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24;2a01:e35:8ac8:0e00::/64 auth-anonymous=1
+__EOF__
+fi
+
+