refactoring to add back write configs script

This commit is contained in:
Ray Tanaka
2018-11-02 15:24:25 -07:00
parent d758757839
commit aefdb082d0
8 changed files with 28 additions and 12 deletions

View File

@@ -15,8 +15,7 @@ function configure_archive () {
local cifs_version="${cifs_version:-3.0}"
local credentials_file_path="/root/.teslaCamArchiveCredentials"
echo "username=$shareuser" > "$credentials_file_path"
echo "password=$sharepassword" >> "$credentials_file_path"
/root/bin/write-archive-configs-to.sh "$credentials_file_path"
echo "//$archive_server_ip_address/$sharename $archive_path cifs vers=${cifs_version},credentials=${credentials_file_path},iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab

View File

@@ -26,9 +26,8 @@ function check_archive_mountable () {
local cifs_version="${cifs_version:-3.0}"
local tmp_credentials_file_path="/tmp/.teslaCamArchiveCredentials"
echo "username=$shareuser" > "$tmp_credentials_file_path"
echo "password=$sharepassword" >> "$tmp_credentials_file_path"
local tmp_credentials_file_path="/tmp/teslaCamArchiveCredentials"
/root/bin/write-archive-configs-to.sh "$tmp_credentials_file_path"
local mount_failed=false
mount -t cifs "//$archive_server_ip_address/$sharename" "$test_mount_location" -o "vers=${cifs_version},credentials=${tmp_credentials_file_path},iocharset=utf8,file_mode=0777,dir_mode=0777" || mount_failed=true

View File

@@ -0,0 +1,6 @@
#!/bin/bash -eu
FILE_PATH="$1"
echo "username=$shareuser" > "$FILE_PATH"
echo "password=$sharepassword" >> "$FILE_PATH"

View File

@@ -3,8 +3,8 @@
function configure_archive () {
echo "Configuring rclone archive..."
echo "drive=$RCLONE_DRIVE" > /root/.teslaCamRcloneConfig
echo "path=$RCLONE_PATH" >> /root/.teslaCamRcloneConfig
local config_file_path="/root/.teslaCamRcloneConfig"
/root/bin/write-archive-configs-to.sh "$config_file_path"
if [ ! -L "/root/.config/rclone" ] && [ -e "/root/.config/rclone" ]
then

View File

@@ -0,0 +1,6 @@
#!/bin/bash -eu
FILE_PATH="$1"
echo "drive=$RCLONE_DRIVE" > "$FILE_PATH"
echo "path=$RCLONE_PATH" >> "$FILE_PATH"

View File

@@ -3,9 +3,8 @@
function configure_archive () {
echo "Configuring the rsync archive..."
echo "user=$RSYNC_USER" > /root/.teslaCamRsyncConfig
echo "server=$RSYNC_SERVER" >> /root/.teslaCamRsyncConfig
echo "path=$RSYNC_PATH" >> /root/.teslaCamRsyncConfig
local config_file_path="/root/.teslaCamRsyncConfig"
/root/bin/write-archive-configs-to.sh "$config_file_path"
}
configure_archive

View File

@@ -0,0 +1,7 @@
#!/bin/bash -eu
FILE_PATH="$1"
echo "user=$RSYNC_USER" > "$FILE_PATH"
echo "server=$RSYNC_SERVER" >> "$FILE_PATH"
echo "path=$RSYNC_PATH" >> "$FILE_PATH"