Add using fix-product-repository.sh
authorMiroslav Ondra <ondra@faster.cz>
Wed, 13 Oct 2021 17:15:09 +0000 (19:15 +0200)
committerMiroslav Ondra <ondra@faster.cz>
Wed, 13 Oct 2021 17:15:09 +0000 (19:15 +0200)
fix-product-repository.sh [new file with mode: 0755]

diff --git a/fix-product-repository.sh b/fix-product-repository.sh
new file mode 100755 (executable)
index 0000000..5ebd01b
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+echo "Update apt repository based on PRODUCT"
+#
+# create    /etc/apt/sources.list.d/unipi-product.list
+# and/or    /etc/apt/sources.list.d/raspi.list
+#
+# file /etc/apt/sources.list.d/unipi.list already contains
+#       deb UNIPI_REPO main
+#
+
+. /ci-scripts/include.sh
+
+RASPBIAN_REPO="http://archive.raspberrypi.org/debian"
+UNIPI_REPO="https://repo.unipi.technology/debian"
+
+## for Raspberry Pi based products add raspbian repo
+if [ "$PRODUCT" == "neuron64" -o "$PRODUCT" == "neuron" ]; then
+    #curl $RASPBIAN_REPO/raspberrypi.gpg.key  | apt-key add - # done in bob-the-builder
+    echo "deb ${RASPBIAN_REPO}/ ${DEBIAN_VERSION} main" > /etc/apt/sources.list.d/raspi.list
+    [ "${DEBIAN_VERSION}" = "buster" ] && exit
+fi
+
+# skip all for stretch
+if [ "${DEBIAN_VERSION}" = "stretch" ]; then exit; fi
+
+if [ "$PRODUCT" == "axon" -a "${DEBIAN_VERSION}" = "buster" ]; then exit; fi
+
+if [ "${DEBIAN_VERSION}" = "buster" ]; then 
+    rm /etc/apt/sources.list.d/unipi.list
+fi
+
+echo "deb ${UNIPI_REPO}/ ${DEBIAN_VERSION} $PRODUCT-main" > /etc/apt/sources.list.d/unipi-product.list