#!/bin/bash

# Check if the script is run with root privileges
if [[ "$EUID" -ne 0 ]]; then
  echo "This script must be run with sudo or as root." >&2
  exit 1
fi

echo Updating the package information...
apt update

if echo $(uname -m) | grep -ciq x86_64; then
  echo Installing Codemeter package...
  dpkg -i ./codemeter*.deb
else
  echo Detected Arm architecture, skipping Codemeter package.
fi

# Install CVB packages including all dependencies
apt-get install -y ./cvb-core*.deb && apt-get install -y ./cvb-tools-*.deb && apt-get install -y ./cvb-dev-*.deb && apt-get install -y ./cvb-ui-*.deb

echo
echo Reboot recommended!
