mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Prepare for abstract connect, disconnect, archive.
This commit is contained in:
@@ -14,19 +14,15 @@ function disconnect_usb_drives_from_host () {
|
||||
log "Disconnected usb from host."
|
||||
}
|
||||
|
||||
function ensure_archive_is_mounted () {
|
||||
log "Ensuring cam archive is mounted..."
|
||||
ensure_mountpoint_is_mounted_with_retry "$ARCHIVE_MOUNT"
|
||||
log "Ensured cam archive is mounted."
|
||||
}
|
||||
|
||||
export -f log
|
||||
|
||||
log "Starting..."
|
||||
|
||||
if [ ! -r "/root/.teslaCamRsyncConfig" ]
|
||||
if [ -r "/root/.teslaCamRsyncConfig" ]
|
||||
then
|
||||
ensure_archive_is_mounted
|
||||
/root/bin/connect-archive-rsync.sh
|
||||
else
|
||||
/root/bin/connect-archive-cifs.sh
|
||||
fi
|
||||
|
||||
disconnect_usb_drives_from_host
|
||||
@@ -42,6 +38,13 @@ else
|
||||
/root/bin/archive-cifs.sh
|
||||
fi
|
||||
|
||||
if [ -r "/root/.teslaCamRsyncConfig" ]
|
||||
then
|
||||
/root/bin/disconnect-archive-rsync.sh
|
||||
else
|
||||
/root/bin/disconnect-archive-cifs.sh
|
||||
fi
|
||||
|
||||
unmount_cam_file
|
||||
|
||||
connect_usb_drives_to_host
|
||||
|
||||
9
windows_archive/connect-archive-cifs.sh
Normal file
9
windows_archive/connect-archive-cifs.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
function ensure_archive_is_mounted () {
|
||||
log "Ensuring cam archive is mounted..."
|
||||
ensure_mountpoint_is_mounted_with_retry "$ARCHIVE_MOUNT"
|
||||
log "Ensured cam archive is mounted."
|
||||
}
|
||||
|
||||
ensure_archive_is_mounted
|
||||
2
windows_archive/connect-archive-rsync.sh
Normal file
2
windows_archive/connect-archive-rsync.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash -eu
|
||||
# Nothing to do.
|
||||
2
windows_archive/disconnect-archive-cifs.sh
Normal file
2
windows_archive/disconnect-archive-cifs.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash -eu
|
||||
# Nothing to do. It's okay to leave the archive mounted.
|
||||
2
windows_archive/disconnect-archive-rsync.sh
Normal file
2
windows_archive/disconnect-archive-rsync.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash -eu
|
||||
# Nothing to do.
|
||||
@@ -86,7 +86,7 @@ function check_archive_mountable () {
|
||||
if [ "$mount_failed" = true ]
|
||||
then
|
||||
echo "STOP: The archive couldn't be mounted with CIFS version ${cifs_version}. Try specifying a lower number for the CIFS version like this: export cifs_version=2"
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
umount "$test_mount_location"
|
||||
@@ -187,9 +187,21 @@ function configure_archive_scripts () {
|
||||
then
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-rsync.sh
|
||||
chmod +x archive-rsync.sh
|
||||
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/connect-archive-rsync.sh
|
||||
chmod +x connect-archive-rsync.sh
|
||||
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/disconnect-archive-rsync.sh
|
||||
chmod +x disconnect-archive-rsync.sh
|
||||
else
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-cifs.sh
|
||||
chmod +x archive-cifs.sh
|
||||
chmod +x archive-cifs.sh
|
||||
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/connect-archive-cifs.sh
|
||||
chmod +x connect-archive-cifs.sh
|
||||
|
||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/disconnect-archive-cifs.sh
|
||||
chmod +x disconnect-archive-cifs.sh
|
||||
fi
|
||||
popd
|
||||
echo "Configured the archive scripts."
|
||||
|
||||
Reference in New Issue
Block a user