mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Merge pull request #42 from Gocnak/master
Archive to FTP server using rsync
This commit is contained in:
@@ -105,12 +105,21 @@ function create_usb_drive_backing_files () {
|
||||
|
||||
function configure_archive () {
|
||||
echo "Configuring the archive..."
|
||||
mkdir /mnt/archive
|
||||
local archive_server_ip_address="$(ping -c 1 -w 1 $archiveserver 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
|
||||
echo "//$archive_server_ip_address/$sharename /mnt/archive cifs vers=3,credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab
|
||||
if [ $RSYNC_ENABLE = true ]
|
||||
then
|
||||
echo "Configuring for Rsync..."
|
||||
echo "user=$RSYNC_USER" > /root/.teslaCamRsyncConfig
|
||||
echo "server=$RSYNC_SERVER" >> /root/.teslaCamRsyncConfig
|
||||
echo "path=$RSYNC_PATH" >> /root/.teslaCamRsyncConfig
|
||||
else
|
||||
echo "Configuring for a shared drive..."
|
||||
mkdir /mnt/archive
|
||||
local archive_server_ip_address="$(ping -c 1 -w 1 $archiveserver 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
|
||||
echo "//$archive_server_ip_address/$sharename /mnt/archive cifs vers=3,credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab
|
||||
|
||||
echo "username=$shareuser" > /root/.teslaCamArchiveCredentials
|
||||
echo "password=$sharepassword" >> /root/.teslaCamArchiveCredentials
|
||||
echo "username=$shareuser" > /root/.teslaCamArchiveCredentials
|
||||
echo "password=$sharepassword" >> /root/.teslaCamArchiveCredentials
|
||||
fi
|
||||
echo "Configured the archive."
|
||||
}
|
||||
|
||||
@@ -128,6 +137,12 @@ function configure_archive_scripts () {
|
||||
pushd /root/bin
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-teslacam-clips
|
||||
chmod +x archive-teslacam-clips
|
||||
|
||||
if [ $RSYNC_ENABLE = true ]
|
||||
then
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-rsync
|
||||
chmod +x archive-rsync
|
||||
fi
|
||||
popd
|
||||
echo "Configured the archive scripts."
|
||||
|
||||
@@ -190,10 +205,18 @@ function make_root_fs_readonly () {
|
||||
|
||||
echo "Verifying environment variables..."
|
||||
|
||||
if [ $RSYNC_ENABLE = true ]
|
||||
then
|
||||
check_variable "RSYNC_USER"
|
||||
check_variable "RSYNC_SERVER"
|
||||
export archiveserver=$RSYNC_SERVER
|
||||
check_variable "RSYNC_PATH"
|
||||
else # Else for now, TODO allow both for more redundancy?
|
||||
check_variable "sharename"
|
||||
check_variable "shareuser"
|
||||
check_variable "sharepassword"
|
||||
fi
|
||||
check_variable "archiveserver"
|
||||
check_variable "sharename"
|
||||
check_variable "shareuser"
|
||||
check_variable "sharepassword"
|
||||
check_variable "campercent"
|
||||
|
||||
check_pushover_enabled
|
||||
|
||||
Reference in New Issue
Block a user