mirror of
https://github.com/armbian/autotests.git
synced 2026-01-06 10:31:09 -08:00
Add user config handling
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/userconfig
|
||||
25
go.sh
25
go.sh
@@ -3,27 +3,42 @@
|
||||
# Simple autotest script.
|
||||
#
|
||||
|
||||
source lib/configuration.sh
|
||||
apt install -y -qq expect sshpass &>/dev/null
|
||||
mkdir -p userconfig
|
||||
|
||||
# create sample configuration
|
||||
if [[ ! -f userconfig/configuration.sh ]]; then
|
||||
cp lib/configuration.sh userconfig/configuration.sh
|
||||
fi
|
||||
|
||||
source userconfig/configuration.sh
|
||||
source lib/functions.sh
|
||||
|
||||
[[ -z $HOST ]] && echo "\$HOST not defined. Exiting." && exit 1
|
||||
[[ -z $HOST_IPERF ]] && echo "\$HOST_IPERF not defined. Exiting." && exit 1
|
||||
|
||||
# needed if we haven't login yet
|
||||
get_keys
|
||||
|
||||
sshpass -p 1234 ssh ${USER_ROOT}@${HOST} "ls" &>/dev/null
|
||||
# if password is still default, change passwd and create new user
|
||||
[[ $? -eq 0 ]] && armbian-first-login
|
||||
|
||||
x=1
|
||||
while [ $x -le ${PASSES} ]
|
||||
do
|
||||
while ! ping -c1 $HOST &>/dev/null; do echo "Ping Fail - `date`"; done ; echo "Host Found - `date`" ;
|
||||
|
||||
|
||||
# if wlan credentials are defined, let's check it first
|
||||
if [[ -n ${WLAN_ID} && $x -eq 1 ]]; then
|
||||
check_wlan
|
||||
fi
|
||||
|
||||
|
||||
echo "Stressing $HOSTNAME"
|
||||
sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M --timeout 60s"
|
||||
|
||||
|
||||
echo "Rebooting $HOSTNAME"
|
||||
sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "reboot"
|
||||
sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "reboot"
|
||||
sleep 20
|
||||
x=$(( $x + 1 ))
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_keys()
|
||||
{
|
||||
|
||||
local GET_KEYS=$(expect -c "
|
||||
spawn ssh ${USER_ROOT}@${HOST}
|
||||
set timeout 3
|
||||
expect \"Are you sure you want to continue connecting (yes/no)?\"
|
||||
send \"yes\r\"
|
||||
expect eof
|
||||
")
|
||||
|
||||
}
|
||||
|
||||
function armbian-first-login()
|
||||
{
|
||||
# clean keys
|
||||
@@ -9,8 +22,6 @@ function armbian-first-login()
|
||||
MAKE_USER=$(expect -c "
|
||||
spawn ssh ${USER_ROOT}@${HOST}
|
||||
set timeout 3
|
||||
expect \"Are you sure you want to continue connecting (yes/no)?\"
|
||||
send \"yes\r\"
|
||||
expect \"password:\"
|
||||
send \"1234\r\"
|
||||
expect \"Current password:\"
|
||||
|
||||
Reference in New Issue
Block a user