summaryrefslogtreecommitdiffstats
path: root/firmware/amd_seattle/runtest.sh
blob: 457d25753877f48897e274645a9b8c07c4995c30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

# Pass BIOS Name and location to get it from.

BIOS=${BIOS_NAME:-ROD0083B}

if [ -n "$LOCATION_URL" ]; then
    wget -O $BIOS $LOCATION/$BIOS
fi

reboot_to_efi_shell() {
    bootorder=$(efibootmgr | grep 'BootOrder' | awk '{ print $2 }')
    # This job will end up aborting..  Next time the system is power cycled
    # we will boot from the wrong device.  restore the correct boot order and
    # reboot again.
    echo "efibootmgr -o $bootorder" >> /etc/rc.d/rc.local
    echo "reboot" >> /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    efishell=$(efibootmgr | grep 'Built-in EFI Shell' | cut -c5-8 | head -n 1)
    # set next boot to efi shell
    efibootmgr -n $efishell
    shutdown -r now
}

if [ -n "$RSTRNT_REBOOTCOUNT" ]; then
    if [ $RSTRNT_REBOOTCOUNT -eq 0 ]; then
        echo "Setup Firmware install"
        # copies firmware and startup.nsh to /boot/efi
        ./upBIOS $BIOS
        reboot_to_efi_shell
    else
        # This will never actually happen..
        rstrnt-report-result $RSTRNT_TASKNAME PASS
    fi
fi