WIP: flux de test
This commit is contained in:
parent
a9a9516856
commit
a3471b303f
|
@ -1,4 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# KGPE-D16 firmware boot process debugging tools via BMC
|
||||
#
|
||||
# Copyright (C) 2024 Adrien 'neox' Bourmault <neox@gnu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
@ -14,24 +17,40 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
## Some variables
|
||||
set -e
|
||||
source power.inc
|
||||
source logs.inc
|
||||
|
||||
buffer=mktemp
|
||||
|
||||
greyblue='\033[38;5;245m'
|
||||
color_reset='\033[0m'
|
||||
|
||||
. includes.sh
|
||||
|
||||
## Main program ---------------------------------------------------------------
|
||||
main()
|
||||
{
|
||||
|
||||
echo 'Welcome to the KGPE-D16 debugging tools'
|
||||
echo 'Copyright (C) 2024 Adrien "neox" Bourmault <neox@gnu.org>'
|
||||
|
||||
stop_logs
|
||||
exit 0
|
||||
echo -e ${color_reset}
|
||||
|
||||
echo Starting logs...
|
||||
start_logs buffer
|
||||
|
||||
echo Booting up...
|
||||
boot
|
||||
wait_for_expression "Debian GNU/Linux 9"
|
||||
|
||||
wait_for buffer "Debian GNU/Linux 9"
|
||||
echo System successfully booted!
|
||||
wait_for_expression "link becomes ready"
|
||||
wait_for_expression "ttyS1"
|
||||
echo SSH should be ready
|
||||
|
||||
wait_for buffer "link becomes ready"
|
||||
echo Network ready
|
||||
|
||||
wait_for buffer "tty"
|
||||
echo Login should be ready
|
||||
|
||||
echo Shutting down
|
||||
shutdown
|
||||
echo Successful power cycle!
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# KGPE-D16 firmware boot process debugging tools via BMC
|
||||
#
|
||||
# Desc: log management
|
||||
#
|
||||
# Copyright (C) 2024 Adrien 'neox' Bourmault <neox@gnu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
@ -14,34 +19,12 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
## SSH Management -------------------------------------------------------------
|
||||
ssh_bmc()
|
||||
{
|
||||
sshpass -p '0penBmc' ssh root@ppalsoc08-bmc ${@}
|
||||
}
|
||||
source ssh.inc
|
||||
|
||||
ssh_hst()
|
||||
{
|
||||
sshpass -p 'password' ssh neox@ppalsoc08 ${@}
|
||||
}
|
||||
# colors
|
||||
greyblue='\033[38;5;245m'
|
||||
color_reset='\033[0m'
|
||||
|
||||
## Power Management -----------------------------------------------------------
|
||||
boot()
|
||||
{
|
||||
ssh_bmc /usr/local/bin/asus_power.sh on
|
||||
}
|
||||
|
||||
force_shutdown()
|
||||
{
|
||||
ssh_bmc /usr/local/bin/asus_power.sh off
|
||||
}
|
||||
|
||||
shutdown()
|
||||
{
|
||||
ssh_hst sudo shutdown now
|
||||
}
|
||||
|
||||
## Logs Management ------------------------------------------------------------
|
||||
get_logs()
|
||||
{
|
||||
ssh_bmc /usr/bin/microcom /dev/ttyS0 -s 115200
|
||||
|
@ -52,21 +35,26 @@ stop_logs()
|
|||
ssh_bmc killall microcom
|
||||
}
|
||||
|
||||
start_logs()
|
||||
{
|
||||
get_logs > ${1} &
|
||||
}
|
||||
|
||||
find_in_logs()
|
||||
{
|
||||
|
||||
keyword=$@
|
||||
while read line
|
||||
do
|
||||
echo -e "${greyblue}${line}${color_reset}" >&2
|
||||
echo "$line" | grep "$keyword" &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Found keyword : $line"
|
||||
stop_logs
|
||||
echo "${greyblue}Found : ${line}${color_reset}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
wait_for_expression()
|
||||
wait_for()
|
||||
{
|
||||
get_logs | find_in_logs $@
|
||||
tail -f ${1} | find_in_logs $@
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# KGPE-D16 firmware boot process debugging tools via BMC
|
||||
#
|
||||
# Desc: power management
|
||||
#
|
||||
# Copyright (C) 2024 Adrien 'neox' Bourmault <neox@gnu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
source ssh.inc
|
||||
|
||||
boot()
|
||||
{
|
||||
ssh_bmc /usr/local/bin/asus_power.sh on
|
||||
}
|
||||
|
||||
halt()
|
||||
{
|
||||
ssh_bmc /usr/local/bin/asus_power.sh off
|
||||
}
|
||||
|
||||
shutdown()
|
||||
{
|
||||
ssh_hst sudo shutdown now
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# KGPE-D16 firmware boot process debugging tools via BMC
|
||||
#
|
||||
# Desc: log management
|
||||
#
|
||||
# Copyright (C) 2024 Adrien 'neox' Bourmault <neox@gnu.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
ssh_bmc()
|
||||
{
|
||||
sshpass -p '0penBmc' ssh root@ppalsoc08-bmc ${@}
|
||||
}
|
||||
|
||||
ssh_hst()
|
||||
{
|
||||
sshpass -p 'password' ssh neox@ppalsoc08 ${@}
|
||||
}
|
Loading…
Reference in New Issue