#!/bin/sh

# Change this if your "install" program is in a weird place...
INSTALL=/usr/bin/install

echo ""
echo "Installing ReBorn..."

# Check if we are running the script as superuser
if [ "`whoami`" != "root" ]; then
  echo "Sorry, the install script must be run as root!"
  echo ""
  exit 1
fi

# Create the required directory structure
$INSTALL -d -o root -g bin -m 755 /usr/local/bin
$INSTALL -d -o root -g bin -m 755 /usr/local/share/reborn
$INSTALL -d -o root -g bin -m 755 /usr/local/share/reborn/mods
$INSTALL -d -o root -g bin -m 755 /usr/local/share/reborn/docs
$INSTALL -d -o root -g bin -m 755 /usr/local/share/reborn/songs
$INSTALL -d -o root -g bin -m 755 /usr/local/man/man1

# Copy the required components
$INSTALL -o root -g bin -m 755 bin/reborn /usr/local/bin/
$INSTALL -o root -g bin -m 644 mods/*.rma /usr/local/share/reborn/mods
$INSTALL -o root -g bin -m 644 docs/* /usr/local/share/reborn/docs
$INSTALL -o root -g bin -m 644 docs/reborn.1 /usr/local/man/man1
$INSTALL -o root -g bin -m 644 README /usr/local/share/reborn/docs
$INSTALL -o root -g bin -m 644 songs/*.rbs /usr/local/share/reborn/songs

echo "Installation complete."
echo "Ensure /usr/local/bin is in your path, then type 'reborn' to begin!"
echo ""
