#!/usr/bin/env bash
# 本地安装bingo脚本，用于本地开发调试bingo

set -e

PATH=~/.local/bin:$PATH

pip3 config set global.break-system-packages true
python3 build.py
echo "------------Build bingo(pip) successfully--------------"

pip3 uninstall -y openubmc-bingo
find output/PyPI -type f -name "*.whl" | xargs pip3 install
echo "------------Build bingo(pip) successfully--------------"

sudo dpkg -P openubmc-bingo
echo "-----------Uninstall bingo(deb) successfully------------"

deb_pkg=$(find output/Generic -type f -name "*.deb")
sudo dpkg -i $deb_pkg || :
sudo apt install -y -f
sudo dpkg -i $deb_pkg
echo "------------Install bingo(deb) successfully------------"
