#!/bin/bash

if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root (use sudo)" 1>&2
   exit 1
fi

is_Raspberry=$(cat /proc/device-tree/model | awk  '{print $1}')
if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
  echo "Sorry, this only works on raspberry pi"
  exit 1
fi

ver="1.0"


# we create a dir with this version to ensure that 'dkms remove' won't delete
# the sources during kernel updates
marker="0.0.0"

apt update
apt -y install git vim zsh darkice icecast2


cp ./darkice.cfg /etc/
cp ./darkice.service /lib/systemd/system/

systemctl daemon-reload
systemctl enable darkice
systemctl start darkice

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

echo "------------------------------------------------------"
echo "The Black Portal broadcasting device has been provisioned."
echo "Reboot this raspberry pi now in order for things to work"
echo "------------------------------------------------------"