mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Merge branch 'master' into u/cimryan/fix_errors_on_startup
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
Param
|
||||
(
|
||||
[Parameter(Mandatory=$True,Position=1)]
|
||||
[string]$driveLetter
|
||||
[string]$driveLetter,
|
||||
|
||||
[Parameter(Mandatory=$True,Position=2)]
|
||||
[string]$wifiSSID,
|
||||
|
||||
[Parameter(Mandatory=$True,Position=3)]
|
||||
[string]$wifiPSK
|
||||
)
|
||||
|
||||
$drivePath="${driveLetter}:"
|
||||
@@ -28,4 +34,24 @@ $cmdlinetxtContent.Replace("rootwait", "rootwait modules-load=dwc2,g_ether").Rep
|
||||
Write-Verbose "Enabling SSH ..."
|
||||
[System.IO.File]::CreateText($sshPath).Dispose()
|
||||
|
||||
# Sets up wifi credentials so wifi will be
|
||||
# auto configured on first boot
|
||||
|
||||
$wpaSupplicantConfPath="$drivePath\wpa_supplicant.conf"
|
||||
|
||||
Write-Verbose "(Re)creating WiFi configuration file $wpaSupplicantConfPath."
|
||||
if ([System.IO.File]::Exists("$wpaSupplicantConfPath")) {
|
||||
del "$wpaSupplicantConfPath"
|
||||
}
|
||||
|
||||
"ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev`
|
||||
update_config=1`
|
||||
`
|
||||
network={`
|
||||
ssid=`"$wifiSSID`"`
|
||||
psk=`"$wifiPSK`"`
|
||||
key_mgmt=WPA-PSK`
|
||||
}`
|
||||
" | Out-File -FilePath "$wpaSupplicantConfPath" -Encoding utf8
|
||||
|
||||
Write-Verbose "All done."
|
||||
@@ -109,7 +109,7 @@ function create_usb_drive_backing_files () {
|
||||
function configure_archive () {
|
||||
echo "Configuring the archive..."
|
||||
mkdir /mnt/archive
|
||||
local archive_server_ip_address="$(getent hosts $archiveserver | cut -d' ' -f1)"
|
||||
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 "username=$shareuser" > /root/.teslaCamArchiveCredentials
|
||||
|
||||
Reference in New Issue
Block a user