shellchecked
This commit is contained in:
23
install.sh
23
install.sh
@@ -1,4 +1,5 @@
|
||||
#!/bin/bash
|
||||
# shellcheck disable=SC1090 # dynamically sourced file
|
||||
|
||||
SEQGITURL="https://winklerfamilie.eu/git/efelon/shell_sequencer.git"
|
||||
DEFAULT_DIR="/opt/sequencer"
|
||||
@@ -14,7 +15,7 @@ SEQUENCER_DIR="$1"
|
||||
if [ -z "$SEQUENCER_DIR" ]; then
|
||||
[ -w "$(dirname "$DEFAULT_DIR")" ] && SEQUENCER_DIR="$DEFAULT_DIR"
|
||||
# Fallback to working directory
|
||||
[ -z "$SEQUENCER_DIR" ] && $SEQUENCER_DIR="${WDIR}/sequencer"
|
||||
[ -z "$SEQUENCER_DIR" ] && SEQUENCER_DIR="${WDIR}/sequencer"
|
||||
fi
|
||||
|
||||
# Check if already installed
|
||||
@@ -23,36 +24,34 @@ if [ -d "$SEQUENCER_DIR" ]; then
|
||||
echo " $SEQUENCER_DIR"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -w "$(dirname $SEQUENCER_DIR)" ]; then
|
||||
echo " [E] Your user has no permission to write to $(dirname $SEQUENCER_DIR)"
|
||||
if [ ! -w "$(dirname "$SEQUENCER_DIR")" ]; then
|
||||
echo " [E] Your user has no permission to write to $(dirname "$SEQUENCER_DIR")"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Install git if neccessary
|
||||
which git >>/dev/null 2>&1
|
||||
if [ $? != 0 ]; then
|
||||
if ! which git >>/dev/null 2>&1; then
|
||||
echo " [W] Git not found and will be installed"
|
||||
apt update
|
||||
if [ $? != 0 ]; then
|
||||
|
||||
if ! apt update; then
|
||||
echo " [W] Cannot update apt repositories"
|
||||
fi
|
||||
apt install git -y
|
||||
if [ $? != 0 ]; then
|
||||
|
||||
if ! apt install git -y; then
|
||||
echo " [E] Cannot install git via apt"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
|
||||
# Clone sequncer to target directory
|
||||
git clone $SEQGITURL "$SEQUENCER_DIR"
|
||||
if [ $? -ne 0 ]; then
|
||||
if ! git clone $SEQGITURL "$SEQUENCER_DIR"; then
|
||||
echo " [E] Error cloning git repository:"
|
||||
echo " $SEQGITURL"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
# If available use configuration
|
||||
. ${SEQUENCER_DIR}/sequencer.cfg >/dev/null 2>&1
|
||||
. "${SEQUENCER_DIR}/sequencer.cfg" >/dev/null 2>&1
|
||||
|
||||
# Set to default if not configured
|
||||
[ -z "$SEQUENCER_USER_SEQS" ] && SEQUENCER_USER_SEQS="$DEFAULT_USER_SEQS"
|
||||
|
Reference in New Issue
Block a user