Overwrite local scripts with remote scripts.

This commit is contained in:
cimryan
2018-10-24 18:35:10 -07:00
parent d3c31cc83c
commit 2b7d155372

View File

@@ -58,15 +58,19 @@ function check_available_space () {
echo "There is sufficient space available." echo "There is sufficient space available."
} }
function get_script () {
local local_path="$1"
local name="$2"
local remote_path="${3:-}"
wget -O "$local_path/$name" https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/"$remote_path"/"$name"
chmod +x "$local_path/$name"
}
function get_ancillary_setup_scripts () { function get_ancillary_setup_scripts () {
pushd /tmp get_script /tmp create-backingfiles-partition.sh
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/create-backingfiles-partition.sh get_script /tmp create-backingfiles.sh
chmod +x ./create-backingfiles-partition.sh get_script /tmp make-root-fs-readonly.sh
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/create-backingfiles.sh
chmod +x ./create-backingfiles.sh
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/make-root-fs-readonly.sh
chmod +x ./make-root-fs-readonly.sh
popd
} }
function fix_cmdline_txt_modules_load () function fix_cmdline_txt_modules_load ()
@@ -81,12 +85,12 @@ function fix_cmdline_txt_modules_load ()
BACKINGFILES_MOUNTPOINT=/backingfiles BACKINGFILES_MOUNTPOINT=/backingfiles
function create_usb_drive_backing_files () { function create_usb_drive_backing_files () {
if [! -e "$BACKINGFILES_MOUNTPOINT" ] if [ ! -e "$BACKINGFILES_MOUNTPOINT" ]
then then
mkdir "$BACKINGFILES_MOUNTPOINT" mkdir "$BACKINGFILES_MOUNTPOINT"
fi fi
if [! -e /dev/mmcblk0p3 ] if [ ! -e /dev/mmcblk0p3 ]
then then
/tmp/create-backingfiles-partition.sh "$BACKINGFILES_MOUNTPOINT" /tmp/create-backingfiles-partition.sh "$BACKINGFILES_MOUNTPOINT"
fi fi
@@ -107,46 +111,27 @@ function create_usb_drive_backing_files () {
function configure_archive_scripts () { function configure_archive_scripts () {
echo "Configuring the archive scripts..." echo "Configuring the archive scripts..."
pushd /root/bin get_script /root/bin archiveloop
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/archiveloop get_script /root/bin archive-teslacam-clips
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/archive-teslacam-clips
if [ $RSYNC_ENABLE = true ] if [ $RSYNC_ENABLE = true ]
then then
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/rsync_archive/archive-clips.sh get_script /root/bin archive-clips.sh rsync_archive
get_script /root/bin connect-archive.sh rsync_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/rsync_archive/connect-archive.sh get_script /root/bin disconnect-archive.sh rsync_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/rsync_archive/disconnect-archive.sh
else else
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/archive-clips.sh get_script /root/bin archive-clips.sh cifs_archive
get_script /root/bin connect-archive.sh cifs_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/connect-archive.sh get_script /root/bin disconnect-archive.sh cifs_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/disconnect-archive.sh
fi fi
chmod +x archiveloop get_script /root/bin remountfs_rw
chmod +x archive-teslacam-clips
chmod +x archive-clips.sh
chmod +x connect-archive.sh
chmod +x disconnect-archive.sh
popd
echo "Configured the archive scripts." echo "Configured the archive scripts."
pushd /root/bin
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/remountfs_rw
chmod +x remountfs_rw
popd
} }
function configure_pushover_scripts() { function configure_pushover_scripts() {
pushd /root/bin get_script /root/bin send-pushover
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/send-pushover
chmod +x send-pushover
popd
} }
function configure_rc_local () { function configure_rc_local () {
@@ -224,26 +209,17 @@ then
mkdir /root/bin mkdir /root/bin
fi fi
pushd /root/bin
if [ "$RSYNC_ENABLE" = true ] if [ "$RSYNC_ENABLE" = true ]
then then
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/rsync_archive/verify-archive-configuration.sh get_script /root/bin verify-archive-configuration.sh rsync_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/rsync_archive/configure-archive.sh get_script /root/bin configure-archive.sh rsync_archive
else else
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/verify-archive-configuration.sh get_script /root/bin verify-archive-configuration.sh cifs_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/configure-archive.sh get_script /root/bin configure-archive.sh cifs_archive
get_script /root/bin write-archive-credentials-to.sh cifs_archive
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/cifs_archive/write-archive-credentials-to.sh
chmod +x write-archive-credentials-to.sh
fi fi
chmod +x verify-archive-configuration.sh get_script /root/bin get-archiveserver-ip-address.sh
chmod +x configure-archive.sh
wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/get-archiveserver-ip-address.sh
chmod +x get-archiveserver-ip-address.sh
popd
/root/bin/verify-archive-configuration.sh /root/bin/verify-archive-configuration.sh