mirror of
https://github.com/cimryan/teslausb.git
synced 2026-02-28 20:20:32 +00:00
10-24 image scripts
Tested working for me.
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
## Configure the SD card before first boot of the Pi
|
||||
|
||||
|
||||
1. Flash the image from [here](https://www.dropbox.com/s/zfzjbmx4744q810/image_2018-10-21-teslausb_headless-lite.zip?dl=0) using Etcher or similar.
|
||||
1. Mount the card again, and in the `boot` directory create a `teslausb_setup_variables.conf` file to export the same environment varibles normally needed for setup (including archive, Wifi, and push notifications (if desired).) See the main README for all the variables. I.e. file should contain at a minimum (replace with your own values):
|
||||
1. Flash the image from [here (10-24 dated image)](https://www.dropbox.com/s/6f8kxenvtz8pkj9/image_2018-10-24-teslausb_headless-lite.zip?dl=0) using Etcher or similar.
|
||||
1. Mount the card again, and in the `boot` directory create a `teslausb_setup_variables.conf` file to export the same environment varibles normally needed for setup (including archive, Wifi, and push notifications (if desired).) A sample conf file is in this repo. I.e. file should contain at a minimum (replace with your own values):
|
||||
```
|
||||
export archiveserver=Nautilus
|
||||
export sharename=SailfishCam
|
||||
@@ -22,29 +22,25 @@
|
||||
export SSID=your_ssid
|
||||
export WIFIPASS=your_wifi_password
|
||||
```
|
||||
1. Run the `setup-piForHeadlessBuild.sh` (note: **not** `setup-piForHeadlessSetup.sh`):
|
||||
```
|
||||
curl https://raw.githubusercontent.com/rtgoodwin/teslausb/headless-patch/headless-scripts/setup-piForHeadlessBuild.sh -o setup-piForHeadlessBuild.sh
|
||||
|
||||
chmod +x setup-piForHeadlessBuild.sh
|
||||
|
||||
./setup-piForHeadlessBuild.sh <location_of_boot_directory>
|
||||
```
|
||||
1. If all goes well, put card into Pi and boot.
|
||||
1. Wait for the the Pi to come up as a CAM USB drive, if you have it plugged into your computer. If plugged into just a power source, or your car, give it a few minutes until the LED starts pulsing steadily which means the archive loop is running and you're good to go.
|
||||
* Boot it in your Pi, give it a bit, watching for a series of flashes (2, 3, 4, 5, maybe 6) and then a reboot and/or the CAM to become available on your PC/Mac.
|
||||
* The Pi should be available at teslausb.local over Wifi (if it works) or USB networking (if it doesn't). Takes about 5 minutes for me. You should see in `/boot` the TESLAUSB_SETUP_FINISHED and WIFI_ENABLED files as markers of success too.
|
||||
* Currently doesn't create the TeslaCam folder, so you'll need to do that before taking to your car.
|
||||
* If plugged into just a power source, or your car, give it a few minutes until the LED starts pulsing steadily which means the archive loop is running and you're good to go.
|
||||
|
||||
## What happens under the covers
|
||||
|
||||
When the Pi boots the first time:
|
||||
* A `/boot/teslausb-headless-setup.log` file will be created and stages logged. This takes the place of the "STOP" commands
|
||||
* Marker files will be created in `boot` like `TESLA_USB_SETUP_STARTED` and `TESLA_USB_SETUP_FINISHED` to track progress. May use a progress system so the script can pick back up if needed. (This is probably useful for the general/old way of setup too.)
|
||||
* The Pi LED will flash patterns as it gets to each stage (labeled in the setup-teslausb-headless script).
|
||||
* Marker files will be created in `boot` like `TESLA_USB_SETUP_STARTED` and `TESLA_USB_SETUP_FINISHED` to track progress.
|
||||
* (Working on a progress system so the script can pick back up if needed. This is probably useful for the general/old way of setup too.)
|
||||
* Wifi is detected by looking for `/boot/WIFI_ENABLED` and if not, creates the `wpa_supplicant.conf` file in place and reboots.
|
||||
* The Pi LED will flash patterns (2, 3, 4, 5, maybe 6) as it gets to each stage (labeled in the setup-teslausb-headless script).
|
||||
* 10 flashes means setup failed!
|
||||
* After the final stage and reboot the LED will go back to normal. Remember, the step to remount the filesystem takes a few minutes.
|
||||
|
||||
At this point the next boot should start the Dashcam/music drives like normal. If you're watching the LED it will start flashing every 1 second, which is the archive loop running.
|
||||
|
||||
> NOTE: Don't delete the `TESLAUSB_SETUP_FINISHED` file. This is how the system knows setup is complete.
|
||||
> NOTE: Don't delete the `TESLAUSB_SETUP_FINISHED` or `WIFI_ENABLED` files. This is how the system knows setup is complete.
|
||||
|
||||
### Image builder source and patches
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ function check_available_space () {
|
||||
}
|
||||
|
||||
# function get_ancillary_setup_scripts () {
|
||||
# pushd /tmp
|
||||
# pushd
|
||||
# wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/create-backingfiles-partition.sh
|
||||
# chmod +x ./create-backingfiles-partition.sh
|
||||
# wget https://raw.githubusercontent.com/"$REPO"/teslausb/"$BRANCH"/windows_archive/create-backingfiles.sh
|
||||
@@ -111,20 +111,20 @@ BACKINGFILES_MOUNTPOINT=/backingfiles
|
||||
|
||||
function create_usb_drive_backing_files () {
|
||||
mkdir "$BACKINGFILES_MOUNTPOINT"
|
||||
/tmp/create-backingfiles-partition.sh "$BACKINGFILES_MOUNTPOINT"
|
||||
/root/bin/tmp/create-backingfiles-partition.sh "$BACKINGFILES_MOUNTPOINT"
|
||||
|
||||
setup_log "Mounting the partition for the backing files..."
|
||||
mount /backingfiles
|
||||
setup_log "Mounted the partition for the backing files."
|
||||
|
||||
/tmp/create-backingfiles.sh "$campercent" "$BACKINGFILES_MOUNTPOINT"
|
||||
/root/bin/tmp/create-backingfiles.sh "$campercent" "$BACKINGFILES_MOUNTPOINT"
|
||||
}
|
||||
|
||||
function configure_archive () {
|
||||
setup_log "Configuring the archive..."
|
||||
mkdir /mnt/archive
|
||||
local archive_server_ip_address="$(ping -c 1 -w 1 $archiveserver 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
|
||||
echo "//$archive_server_ip_address/$sharename /mnt/archive cifs vers=3,credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab
|
||||
echo "//$archive_server_ip_address/$sharename /mnt/archive cifs credentials=/root/.teslaCamArchiveCredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0" >> /etc/fstab
|
||||
|
||||
echo "username=$shareuser" > /root/.teslaCamArchiveCredentials
|
||||
echo "password=$sharepassword" >> /root/.teslaCamArchiveCredentials
|
||||
@@ -189,20 +189,20 @@ EOF
|
||||
setup_log "Configured rc.local."
|
||||
}
|
||||
|
||||
function configure_hostname () {
|
||||
setup_log "Configuring the hostname..."
|
||||
# function configure_hostname () {
|
||||
# setup_log "Configuring the hostname..."
|
||||
|
||||
local new_host_name="teslausb"
|
||||
cp /etc/hosts ~
|
||||
sed "s/raspberrypi/$new_host_name/g" ~/hosts > /etc/hosts
|
||||
# local new_host_name="teslausb"
|
||||
# cp /etc/hosts ~
|
||||
# sed "s/raspberrypi/$new_host_name/g" ~/hosts > /etc/hosts
|
||||
|
||||
cp /etc/hostname ~
|
||||
sed "s/raspberrypi/$new_host_name/g" ~/hostname > /etc/hostname
|
||||
setup_log "Configured the hostname."
|
||||
}
|
||||
# cp /etc/hostname ~
|
||||
# sed "s/raspberrypi/$new_host_name/g" ~/hostname > /etc/hostname
|
||||
# setup_log "Configured the hostname."
|
||||
# }
|
||||
|
||||
function make_root_fs_readonly () {
|
||||
/tmp/make-root-fs-readonly.sh
|
||||
/root/bin/tmp/make-root-fs-readonly.sh
|
||||
}
|
||||
|
||||
# TURN OFF LED so we can start watching progress
|
||||
@@ -214,13 +214,13 @@ sleep 5
|
||||
|
||||
/etc/stage_flash 1
|
||||
|
||||
setup_log "SETUP STAGE 1: Check variables file."
|
||||
if [ ! -e /boot/teslausb_setup_variables.conf ]
|
||||
then
|
||||
setup_log "ERROR: teslausb_setup_variables.conf file not found. Can't continue setup."
|
||||
/etc/stage_flash 10
|
||||
exit 1
|
||||
fi
|
||||
# setup_log "SETUP STAGE 1: Check variables file."
|
||||
# if [ ! -e /boot/teslausb_setup_variables.conf ]
|
||||
# then
|
||||
# setup_log "ERROR: teslausb_setup_variables.conf file not found. Can't continue setup."
|
||||
# /etc/stage_flash 10
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
source /boot/teslausb_setup_variables.conf
|
||||
|
||||
@@ -267,7 +267,7 @@ configure_archive
|
||||
|
||||
configure_rc_local
|
||||
|
||||
configure_hostname
|
||||
# configure_hostname
|
||||
|
||||
# SETUP STAGE 5 and reboot
|
||||
# If you see 5 flashes we are probably good!
|
||||
|
||||
10
headless-scripts/teslausb_setup_variables.conf.sample
Normal file
10
headless-scripts/teslausb_setup_variables.conf.sample
Normal file
@@ -0,0 +1,10 @@
|
||||
export archiveserver=your_archive_name_or_ip
|
||||
export sharename=your_archive_share_name
|
||||
export shareuser=username
|
||||
export sharepassword=password
|
||||
export campercent=100
|
||||
export SSID=your_ssid
|
||||
export WIFIPASS=your_pass
|
||||
# export pushover_enabled=false
|
||||
# export pushover_user_key=user_key
|
||||
# export pushover_app_key=app_key
|
||||
Reference in New Issue
Block a user