mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
clean up the archive server set up routine
This commit is contained in:
@@ -113,6 +113,43 @@ function check_pushover_enabled () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_archive_configs () {
|
||||||
|
|
||||||
|
RSYNC_ENABLE="${RSYNC_ENABLE:-false}"
|
||||||
|
RCLONE_ENABLE="${RCLONE_ENABLE:-false}"
|
||||||
|
|
||||||
|
if [ "$RSYNC_ENABLE" = true ] && [ "$RCLONE_ENABLE" = true ]
|
||||||
|
then
|
||||||
|
echo "STOP: Cannot enable rsync and rclone at the same time"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$RSYNC_ENABLE" = true ]
|
||||||
|
then
|
||||||
|
check_variable "RSYNC_USER"
|
||||||
|
check_variable "RSYNC_SERVER"
|
||||||
|
export archiveserver="$RSYNC_SERVER"
|
||||||
|
check_variable "RSYNC_PATH"
|
||||||
|
export archive_module="run/rsync_archive"
|
||||||
|
elif [ "$RCLONE_ENABLE" = true ]
|
||||||
|
then
|
||||||
|
check_variable "RCLONE_DRIVE"
|
||||||
|
check_variable "RCLONE_PATH"
|
||||||
|
# since it's a cloud hosted drive we'll just set this to google dns
|
||||||
|
export archiveserver="8.8.8.8"
|
||||||
|
export archive_module="run/rclone_archive"
|
||||||
|
else # Else for now, TODO allow both for more redundancy?
|
||||||
|
check_variable "sharename"
|
||||||
|
check_variable "shareuser"
|
||||||
|
check_variable "sharepassword"
|
||||||
|
|
||||||
|
export cifs_version="${cifs_version:-3.0}"
|
||||||
|
export archive_module="run/cifs_archive"
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_variable "archiveserver"
|
||||||
|
}
|
||||||
|
|
||||||
function check_available_space () {
|
function check_available_space () {
|
||||||
setup_progress "Verifying that there is sufficient space available on the MicroSD card..."
|
setup_progress "Verifying that there is sufficient space available on the MicroSD card..."
|
||||||
|
|
||||||
@@ -190,28 +227,23 @@ function configure_archive_scripts () {
|
|||||||
setup_progress "Configuring the archive scripts..."
|
setup_progress "Configuring the archive scripts..."
|
||||||
|
|
||||||
get_script /root/bin archiveloop run
|
get_script /root/bin archiveloop run
|
||||||
|
|
||||||
if [ $RSYNC_ENABLE = true ]
|
|
||||||
then
|
|
||||||
get_script /root/bin archive-clips.sh run/rsync_archive
|
|
||||||
get_script /root/bin connect-archive.sh run/rsync_archive
|
|
||||||
get_script /root/bin disconnect-archive.sh run/rsync_archive
|
|
||||||
elif [ $RCLONE_ENABLE = true ]
|
|
||||||
then
|
|
||||||
get_script /root/bin archive-clips.sh run/rclone_archive
|
|
||||||
get_script /root/bin connect-archive.sh run/rclone_archive
|
|
||||||
get_script /root/bin disconnect-archive.sh run/rclone_archive
|
|
||||||
else
|
|
||||||
get_script /root/bin archive-clips.sh run/cifs_archive
|
|
||||||
get_script /root/bin connect-archive.sh run/cifs_archive
|
|
||||||
get_script /root/bin disconnect-archive.sh run/cifs_archive
|
|
||||||
fi
|
|
||||||
|
|
||||||
get_script /root/bin remountfs_rw run
|
get_script /root/bin remountfs_rw run
|
||||||
|
|
||||||
setup_progress "Configured the archive scripts."
|
setup_progress "Configured the archive scripts."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_archive_scripts () {
|
||||||
|
check_variable "archive_module"
|
||||||
|
echo $archive_module
|
||||||
|
|
||||||
|
local install_path="/root/bin"
|
||||||
|
get_script $install_path verify-archive-configuration.sh $archive_module
|
||||||
|
get_script $install_path configure-archive.sh $archive_module
|
||||||
|
get_script $install_path archive-clips.sh $archive_module
|
||||||
|
get_script $install_path connect-archive.sh $archive_module
|
||||||
|
get_script $install_path disconnect-archive.sh $archive_module
|
||||||
|
}
|
||||||
|
|
||||||
function configure_pushover_scripts() {
|
function configure_pushover_scripts() {
|
||||||
get_script /root/bin send-pushover run
|
get_script /root/bin send-pushover run
|
||||||
}
|
}
|
||||||
@@ -274,32 +306,8 @@ headless_setup_progress_flash 1
|
|||||||
|
|
||||||
setup_progress "Verifying environment variables..."
|
setup_progress "Verifying environment variables..."
|
||||||
|
|
||||||
RSYNC_ENABLE="${RSYNC_ENABLE:-false}"
|
|
||||||
RCLONE_ENABLE="${RCLONE_ENABLE:-false}"
|
|
||||||
|
|
||||||
if [ "$RSYNC_ENABLE" = true ]
|
|
||||||
then
|
|
||||||
check_variable "RSYNC_USER"
|
|
||||||
check_variable "RSYNC_SERVER"
|
|
||||||
export archiveserver="$RSYNC_SERVER"
|
|
||||||
check_variable "RSYNC_PATH"
|
|
||||||
elif [ "$RCLONE_ENABLE" = true ]
|
|
||||||
then
|
|
||||||
check_variable "RCLONE_DRIVE"
|
|
||||||
check_variable "RCLONE_PATH"
|
|
||||||
# since it's a cloud hosted drive we'll just set this to google dns
|
|
||||||
export archiveserver="8.8.8.8"
|
|
||||||
else # Else for now, TODO allow both for more redundancy?
|
|
||||||
check_variable "sharename"
|
|
||||||
check_variable "shareuser"
|
|
||||||
check_variable "sharepassword"
|
|
||||||
|
|
||||||
export cifs_version="${cifs_version:-3.0}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
check_variable "archiveserver"
|
|
||||||
check_variable "campercent"
|
check_variable "campercent"
|
||||||
|
check_archive_configs
|
||||||
check_pushover_enabled
|
check_pushover_enabled
|
||||||
|
|
||||||
# Flash for Stage 3 headless (grab scripts)
|
# Flash for Stage 3 headless (grab scripts)
|
||||||
@@ -312,19 +320,7 @@ then
|
|||||||
mkdir /root/bin
|
mkdir /root/bin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$RSYNC_ENABLE" = true ]
|
install_archive_scripts
|
||||||
then
|
|
||||||
get_script /root/bin verify-archive-configuration.sh run/rsync_archive
|
|
||||||
get_script /root/bin configure-archive.sh run/rsync_archive
|
|
||||||
elif [ "$RCLONE_ENABLE" = true ]
|
|
||||||
then
|
|
||||||
get_script /root/bin verify-archive-configuration.sh run/rclone_archive
|
|
||||||
get_script /root/bin configure-archive.sh run/rclone_archive
|
|
||||||
else
|
|
||||||
get_script /root/bin verify-archive-configuration.sh run/cifs_archive
|
|
||||||
get_script /root/bin configure-archive.sh run/cifs_archive
|
|
||||||
get_script /root/bin write-archive-credentials-to.sh run/cifs_archive
|
|
||||||
fi
|
|
||||||
|
|
||||||
get_script /root/bin get-archiveserver-ip-address.sh run
|
get_script /root/bin get-archiveserver-ip-address.sh run
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user