57 lines
2.2 KiB
Bash
Executable File
57 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
VERSION="1"
|
|
RUNTIME_PACKAGES="python3 udev alsa-utils alsa-utils-doc alsa-lib alsaconf py3-rpigpio py3-pip py3-numpy py3-kiwisolver py3-scikit-learn py3-scipy py3-joblib py3-cycler py3-matplotlib py3-simplejson"
|
|
BUILD_PACKAGES="alsa-lib-dev gcc g++ python3-dev musl-dev py3-numpy-dev"
|
|
|
|
# put back the resolv.conf to keep apk working
|
|
rm ${ROOTFS_PATH}/etc/resolv.conf # remove symlink
|
|
cp /etc/resolv.conf ${ROOTFS_PATH}/etc/resolv.conf
|
|
|
|
# install things
|
|
chroot_exec apk add $RUNTIME_PACKAGES $BUILD_PACKAGES
|
|
|
|
|
|
# setup udev
|
|
chroot_exec rc-update add udev sysinit
|
|
chroot_exec rc-update add udev-trigger default
|
|
chroot_exec rc-update add udev-settle default
|
|
# udev_postmount's purpose is to write stuff to / which is not possible now
|
|
|
|
# make audio work
|
|
echo "snd_bcm2835" >> ${ROOTFS_PATH}/etc/modules # Actually this is also loaded by udev, but it wouldn't hurt
|
|
echo "dtparam=audio=on" >> ${BOOTFS_PATH}/config.txt
|
|
echo "hdmi_drive=1" >> ${BOOTFS_PATH}/config.txt # disable HDMI audio
|
|
chroot_exec addgroup root audio
|
|
sed -i -e "s/^defaults.ctl.card [0-9]*$/defaults.ctl.card 0/" ${ROOTFS_PATH}/usr/share/alsa/alsa.conf
|
|
sed -i -e "s/^defaults.pcm.card [0-9]*$/defaults.pcm.card 0/" ${ROOTFS_PATH}/usr/share/alsa/alsa.conf
|
|
chroot_exec rc-update add alsa default
|
|
sed -i -e "s%alsastatedir=/var/lib/alsa%alsastatedir=/data/var/lib/alsa%" ${ROOTFS_PATH}/etc/init.d/alsa
|
|
mkdir -p ${DATAFS_PATH}/var/lib/alsa
|
|
|
|
# make serial work
|
|
sed -i -e 's%#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100%ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100%' ${ROOTFS_PATH}/etc/inittab
|
|
|
|
# mark this version
|
|
echo "Version: ${VERSION}\nBuild: $(date)\nUpdate: " > ${ROOTFS_PATH}/version
|
|
|
|
# install things
|
|
mkdir -p ${ROOTFS_PATH}/opt/
|
|
|
|
for repo in iot-platform-raspberry iot-logic; do
|
|
archive="${repo}.tar.gz"
|
|
wget https://git.kmlabz.com/birbnetes/$repo/archive/master.tar.gz -O "${archive}"
|
|
tar xvf "${archive}" -C ${ROOTFS_PATH}/opt/
|
|
done
|
|
|
|
chroot_exec pip3 install /opt/iot-platform-raspberry/
|
|
chroot_exec pip3 install -r /opt/iot-logic/requirements.txt
|
|
|
|
# clean build dependencies
|
|
chroot_exec apk del $BUILD_PACKAGES
|
|
|
|
# Put back resolv.conf where it was
|
|
rm ${ROOTFS_PATH}/etc/resolv.conf
|
|
ln -fs /data/etc/resolv.conf ${ROOTFS_PATH}/etc/resolv.conf
|
|
|