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."
|
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
|
export -f log
|
||||||
|
|
||||||
log "Starting..."
|
log "Starting..."
|
||||||
|
|
||||||
if [ ! -r "/root/.teslaCamRsyncConfig" ]
|
if [ -r "/root/.teslaCamRsyncConfig" ]
|
||||||
then
|
then
|
||||||
ensure_archive_is_mounted
|
/root/bin/connect-archive-rsync.sh
|
||||||
|
else
|
||||||
|
/root/bin/connect-archive-cifs.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
disconnect_usb_drives_from_host
|
disconnect_usb_drives_from_host
|
||||||
@@ -42,6 +38,13 @@ else
|
|||||||
/root/bin/archive-cifs.sh
|
/root/bin/archive-cifs.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -r "/root/.teslaCamRsyncConfig" ]
|
||||||
|
then
|
||||||
|
/root/bin/disconnect-archive-rsync.sh
|
||||||
|
else
|
||||||
|
/root/bin/disconnect-archive-cifs.sh
|
||||||
|
fi
|
||||||
|
|
||||||
unmount_cam_file
|
unmount_cam_file
|
||||||
|
|
||||||
connect_usb_drives_to_host
|
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.
|
||||||
@@ -187,9 +187,21 @@ function configure_archive_scripts () {
|
|||||||
then
|
then
|
||||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-rsync.sh
|
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-rsync.sh
|
||||||
chmod +x 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
|
else
|
||||||
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/archive-cifs.sh
|
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
|
fi
|
||||||
popd
|
popd
|
||||||
echo "Configured the archive scripts."
|
echo "Configured the archive scripts."
|
||||||
|
|||||||
Reference in New Issue
Block a user