mirror of
https://github.com/cimryan/teslausb.git
synced 2026-02-28 20:20:32 +00:00
Merge pull request #92 from Cisien/master
switch to using hping3 for connectivity testing/ip resolution
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
dos2unix
|
dos2unix
|
||||||
|
hping3
|
||||||
@@ -26,7 +26,7 @@ function fix_errors_in_mounted_files () {
|
|||||||
|
|
||||||
function archive_is_reachable () {
|
function archive_is_reachable () {
|
||||||
local reachable=true
|
local reachable=true
|
||||||
ping -q -w 1 -c 1 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1 || reachable=false
|
hping3 -c 1 -S -p 445 "$ARCHIVE_HOST_NAME" > /dev/null 2>&1 || reachable=false
|
||||||
if [ "$reachable" = false ]
|
if [ "$reachable" = false ]
|
||||||
then
|
then
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
function check_archive_server_reachable () {
|
function check_archive_server_reachable () {
|
||||||
echo "Verifying that the archive server $archiveserver is reachable..."
|
echo "Verifying that the archive server $archiveserver is reachable..."
|
||||||
local serverunreachable=false
|
local serverunreachable=false
|
||||||
ping -c 1 -w 1 "$archiveserver" 1>/dev/null 2>&1 || serverunreachable=true
|
hping3 -c 1 -S -p 445 "$archiveserver" 1>/dev/null 2>&1 || serverunreachable=true
|
||||||
|
|
||||||
if [ "$serverunreachable" = true ]
|
if [ "$serverunreachable" = true ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash -eu
|
#!/bin/bash -eu
|
||||||
|
|
||||||
echo "$(ping -c 1 -w 1 $1 2>/dev/null | head -n 1 | grep -o -e "(\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d '()')"
|
echo "$(hping3 -c 1 -S -p 445 -n $1 2>/dev/null | head -n 1 | grep -o -e "\W\([[:digit:]]\{1,3\}\.\)\{3\}[[:digit:]]\{1,3\})" | tr -d ' )')"
|
||||||
@@ -7,14 +7,6 @@ function append_cmdline_txt_param() {
|
|||||||
sed -i "s/\'/ ${toAppend}/g" /boot/cmdline.txt >/dev/null
|
sed -i "s/\'/ ${toAppend}/g" /boot/cmdline.txt >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Updating package index files..."
|
|
||||||
apt-get update
|
|
||||||
echo "Removing unwanted packages..."
|
|
||||||
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..."
|
|
||||||
apt-get -y --force-yes install ntp busybox-syslogd; dpkg --purge rsyslog
|
|
||||||
echo "Configuring system..."
|
echo "Configuring system..."
|
||||||
|
|
||||||
# Add fastboot, noswap and/or ro to end of /boot/cmdline.txt
|
# Add fastboot, noswap and/or ro to end of /boot/cmdline.txt
|
||||||
|
|||||||
@@ -191,9 +191,22 @@ function make_root_fs_readonly () {
|
|||||||
/tmp/make-root-fs-readonly.sh
|
/tmp/make-root-fs-readonly.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function install_required_packages () {
|
||||||
|
echo "Updating package index files..."
|
||||||
|
apt-get update
|
||||||
|
echo "Removing unwanted packages..."
|
||||||
|
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..."
|
||||||
|
apt-get -y --force-yes install ntp busybox-syslogd hping3; dpkg --purge rsyslog
|
||||||
|
}
|
||||||
|
|
||||||
export -f setup_progress
|
export -f setup_progress
|
||||||
export HEADLESS_SETUP
|
export HEADLESS_SETUP
|
||||||
|
|
||||||
|
install_required_packages
|
||||||
|
|
||||||
headless_setup_populate_variables
|
headless_setup_populate_variables
|
||||||
|
|
||||||
# If USE_LED_FOR_SETUP_PROGRESS = true.
|
# If USE_LED_FOR_SETUP_PROGRESS = true.
|
||||||
|
|||||||
Reference in New Issue
Block a user