Files
shell_sequencer/install.sh

45 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
SEQLOC="/opt"
SEQHOME="${SEQLOC}/sequencer"
SEQGITURL="https://winklerfamilie.eu/git/efelon/shell_sequencer.git"
if [ -d "$SEQHOME" ]; then
echo " [E] Sequencer seems to be installed already at:"
echo " $SEQHOME"
exit 1
fi
if [ ! -w "$SEQLOC" ]; then
echo " [E] Your user has no permission to write to $SEQLOC"
exit 2
fi
which git >>/dev/null 2>&1
if [ $? != 0 ]; then
echo " [W] Git not found and will be installed"
apt update
if [ $? != 0 ]; then
echo " [W] Cannot update apt repositories"
fi
apt install git -y
if [ $? != 0 ]; then
echo " [E] Cannot install git via apt"
exit 4
fi
fi
git clone $SEQGITURL "$SEQHOME"
if [ $? != 0 ]; then
echo " [E] Error cloning git repository:"
echo " $SEQGITURL"
exit 6
fi
ln -s "${SEQHOME}/sequencer/sequencer.sh" "/usr/local/bin"
ln -s "${SEQHOME}/seqs" "/opt"
echo " [I] Successfully installed shell sequencer"
echo " Don't forget to set git user variables:"
echo " git config user.name=\"Your Name\""
echo " git config user.email=\"Your.Name@example.com\""