custom-scripts/timelapse/install.sh

41 lines
878 B
Bash

#!/bin/bash
# Check for root/sudo
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root or with sudo."
exit 1
else
echo "Running as root or with sudo."
fi
# Configuration variables
# Install directory
INSTALL_DIR="/usr/local/bin"
FILE_LIST=("tl-capture" "tl-control")
# Copy the executable files
for file in ${FILE_LIST[@]}; do
echo "Copying $file to $INSTALL_DIR..."
cp "./$file" $INSTALL_DIR
if [[ $? -eq 0 ]]; then
echo "Done."
else
echo "Unable to copy the file. Exiting"
exit 1
fi
echo "Setting executable status on $file..."
chmod +x "$INSTALL_DIR/$file"
if [[ $? -eq 0 ]]; then
echo "Done."
else
echo "Unable to set the executable bit. Exiting"
exit 1
fi
done
# Set up the cron job
# Wrap up
echo "Install complete, press any key to exit..."
read -n 1 -s