#!/bin/zsh

# Check if the script is run as root
if [[ $EUID -eq 0 ]]; then
    echo "Run this script as a normal user, not as root."
    exit 1
fi

# Prepare Toolchain
echo "[DSMOSS] Prepare Toolchain..."
xcode-select --install
echo Install toolchain, then press ENTER.

# Prepare Rosetta
echo "[DSMOSS] Prepare Rosetta..."
softwareupdate --install-rosetta --agree-to-license
echo Install Rosetta if on ARM, then press ENTER.

# Prepare Homebrew
echo "[DSMOSS] Prepare Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
cp .zprofile ~/
eval $(/usr/local/bin/brew shellenv)

# Homebrew
echo "[DSMOSS] Install homebrew stuffs..."
brew install thefuck
brew install mas node python3 potrace imagemagick wget golang c2048
brew install ffmpeg streamlink
brew install --cask android-platform-tools
brew install git-credential-manager

# NPM global
echo "[DSMOSS] Install NPM Global stuffs..."
sudo npm install -g cordova

# Make code folder
echo "[DSMOSS] Make code folder..."
mkdir ~/Code

echo "[DSMOSS] Run the more common settings script..."
chmod +x "more-common-settings.sh"
./more-common-settings.sh