From b43e4d709d46fcd05c79486d453f10a89d135e28 Mon Sep 17 00:00:00 2001 From: Ray Tanaka Date: Sun, 28 Oct 2018 10:15:54 -0700 Subject: [PATCH] making change to leverage the new /mutable directory updating docs for clarification --- README.md | 4 ++-- doc/SetupRClone.md | 4 ++-- setup/pi/make-root-fs-readonly.sh | 33 ++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 40f525f..06914af 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ Get the IP address of the archive machine. You'll need this later, so write it d Since sftp/rsync is accessing a computer through SSH, the only requirement for hosting an SFTP/rsync server is to have a box running Linux. An example can be another Raspberry Pi connected to your local network with a USB storage drive plugged in. The official Raspberry Pi site has a good example on [how to mount an external drive](https://www.raspberrypi.org/documentation/configuration/external-storage.md). You will need the username and host/IP of the storage server, as well as the path for the files to go in, and the storage server will need to allow SSH. ### Hosting via rclone (for Google Drive, S3, DropBox, etc) -**EXPERIMENTAL** - This hasn't been thoroughly tested yet but you can follow these [instructions](/doc/SetupRClone.md) and give it a spin. +**EXPERIMENTAL** - This hasn't been thoroughly tested yet but you can follow these [instructions](/doc/SetupRClone.md) to setup up and configure rclone to work with teslausb. ### ***TODO: Other hosting solutions*** @@ -107,7 +107,7 @@ Now that you have Wifi up and running, it's time to set up the USB storage and s export campercent= ``` For example, using `export campercent=100` would allocate 100% of the space to recording footage from your car, and would not create a separate music partition. `export campercent=50` would be only allocate half of the space for a dashcam footage drive, and allocates the other half to be a music storage drive. -1. If you are trying to archive on an SFTP/rsync server, then follow these [instructions](doc/SetupRSync.md) and skip step 7. Otherwise, skip this step. +1. **Only for SFTP/rsync or rclone archives**: If you are trying to archive on an SFTP/rsync server, then follow these [instructions](doc/SetupRSync.md) and skip step 7. If you set up rclone you can also skip step 7 and go to step 8. 1. If you are trying to archive on a shared drive, run these commands, subsituting your values for your shared drive: ``` export archiveserver=Nautilus diff --git a/doc/SetupRClone.md b/doc/SetupRClone.md index e4aaa55..72ce8b4 100644 --- a/doc/SetupRClone.md +++ b/doc/SetupRClone.md @@ -16,7 +16,7 @@ curl -L https://raw.github.com/pageauc/rclone4pi/master/rclone-install.sh | bash You can also install the script manually by following these [instructions](https://github.com/pageauc/rclone4pi/wiki#manual-install). -Once installed, the script will install rclone-install.sh, rclone-sync.sh and create a subfolder rpi-sync in users home eg. /home/pi +Once installed, the script will install rclone-install.sh, rclone-sync.sh and create a subfolder rpi-sync in users home eg. /root # Step 2: Configure rclone storage system @@ -26,7 +26,7 @@ Next, run this command as root to configure a storage system. rclone config ``` -**Important:** Run this as root since archiveloop runs as root and the rclone config is bound to the user running the config. +**Important:** Make sure to run this as root since archiveloop runs as root and the rclone config is bound to the user running the config. The config file is also moved with the assumption that the root user ran config. This will launch an interactive setup with a series of questions. I highly recommend you look at the documents for your storage system by going to [rclone](https://rclone.org/) and selecting your storage system from the pull down menu at the stop. diff --git a/setup/pi/make-root-fs-readonly.sh b/setup/pi/make-root-fs-readonly.sh index 1d7882c..fdf2ba6 100644 --- a/setup/pi/make-root-fs-readonly.sh +++ b/setup/pi/make-root-fs-readonly.sh @@ -10,7 +10,7 @@ function append_cmdline_txt_param() { echo "Updating package index files..." apt-get update echo "Removing unwanted packages..." -apt-get remove -y --force-yes --purge triggerhappy logrotate dphys-swapfile fake-hwclock +apt-get remove -y --force-yes --purge triggerhappy logrotate dphys-swapfile apt-get -y --force-yes autoremove --purge # Replace log management with busybox (use logread if needed) echo "Installing ntp and busybox-syslogd..." @@ -22,6 +22,37 @@ append_cmdline_txt_param fastboot append_cmdline_txt_param noswap append_cmdline_txt_param ro +# Move fake-hwclock.data to /mutable directory so it can be updated +if ! findmnt --mountpoint /mutable +then + echo "Mounting the multable partition..." + mount /mutable + echo "Mounted." +fi +if [ ! -e "/mutable/etc" ] +then + mkdir -p /mutable/etc +fi +if [ -e "/etc/fake-hwclock.data" ] +then + echo "Moving fake-hwclock data" + cp /etc/fake-hwclock.data /mutable/etc/fake-hwclock.data + rm /etc/fake-hwclock.data + ln -s /mutable/etc/fake-hwclock.data /etc/fake-hwclock.data +fi + +# Move rclone configs if it exists so we can write to it +if [ ! -e "/mutable/configs" ] +then + mkdir -p /mutable/configs +fi +if [ -e "/root/.config/rclone/rclone.conf" ] +then + echo "Moving rclone configs" + mv /root/.config/rclone /mutable/configs + ln -s /mutable/configs/rclone /root/.config/rclone +fi + # Move /var/spool to /tmp rm -rf /var/spool ln -s /tmp /var/spool