41 lines
956 B
Bash
Executable File
41 lines
956 B
Bash
Executable File
# This script is called to install ocarina to INSTALLDIR
|
|
# Default install location is /opt/ocarina
|
|
|
|
INSTALLDIR=/opt/ocarina/
|
|
LAUNCHER=$INSTALLDIR/ocarina
|
|
RSYNC="rsync -aqz --progress"
|
|
|
|
# We need root access to install to /opt/
|
|
if [ "$(id -u)" != "0" ]; then
|
|
echo "Attempting to run script as root"
|
|
sudo sh $0
|
|
exit 1
|
|
fi
|
|
|
|
# if $INSTALLDIR doesn't exist, create it
|
|
if [ ! -d $INSTALLDIR ];then
|
|
echo "Creating directory $INSTALLDIR"
|
|
mkdir $INSTALLDIR
|
|
fi
|
|
|
|
|
|
# Rsync over all files
|
|
echo "Copying program to $INSTALLDIR"
|
|
$RSYNC src/ $INSTALLDIR/src/
|
|
echo "Copying examples to $INSTALLDIR"
|
|
$RSYNC images/ $INSTALLDIR/images/
|
|
$RSYNC uninstall.sh $INSTALLDIR/
|
|
|
|
|
|
# Create launcher
|
|
echo "#/bin/bash" > $LAUNCHER
|
|
echo "cd $INSTALLDIR && \`which python\` src/ocarina.py $*" >> $LAUNCHER
|
|
chmod +x $LAUNCHER
|
|
|
|
|
|
echo ""
|
|
echo ""
|
|
echo "Ocarina has been installed to $INSTALLDIR"
|
|
echo "To uninstall, remove $INSTALLDIR"
|
|
echo "Don't forget to add $INSTALLDIR to your path"
|