xref: /aosp_15_r20/kernel/tests/net/test/rootfs/cron-run-installer-script.sh (revision 2f2c4c7ab4226c71756b9c31670392fdd6887c4f)
1*2f2c4c7aSAndroid Build Coastguard Worker#!/bin/bash
2*2f2c4c7aSAndroid Build Coastguard Worker
3*2f2c4c7aSAndroid Build Coastguard Worker# Wait for Login Prompt fully active.
4*2f2c4c7aSAndroid Build Coastguard Worker# Otherwise the output are mixed together.
5*2f2c4c7aSAndroid Build Coastguard Workerwhile true; do
6*2f2c4c7aSAndroid Build Coastguard Worker    systemctl is-active --quiet multi-user.target
7*2f2c4c7aSAndroid Build Coastguard Worker    if [ $? -eq 0 ]; then
8*2f2c4c7aSAndroid Build Coastguard Worker	break
9*2f2c4c7aSAndroid Build Coastguard Worker    fi
10*2f2c4c7aSAndroid Build Coastguard Worker    sleep 2
11*2f2c4c7aSAndroid Build Coastguard Workerdone
12*2f2c4c7aSAndroid Build Coastguard Workersleep 10
13*2f2c4c7aSAndroid Build Coastguard Worker
14*2f2c4c7aSAndroid Build Coastguard Worker# Parsing /proc/cmdline and export all the variables
15*2f2c4c7aSAndroid Build Coastguard WorkerPARAMS=""
16*2f2c4c7aSAndroid Build Coastguard Workerif [ -e /proc/cmdline ]; then
17*2f2c4c7aSAndroid Build Coastguard Worker    PARAMS=$(cat /proc/cmdline)
18*2f2c4c7aSAndroid Build Coastguard Workerfi
19*2f2c4c7aSAndroid Build Coastguard Worker
20*2f2c4c7aSAndroid Build Coastguard Workerfor i in ${PARAMS}
21*2f2c4c7aSAndroid Build Coastguard Workerdo
22*2f2c4c7aSAndroid Build Coastguard Worker    export ${i}
23*2f2c4c7aSAndroid Build Coastguard Workerdone
24*2f2c4c7aSAndroid Build Coastguard Worker
25*2f2c4c7aSAndroid Build Coastguard Worker# Log output for qemu serial.
26*2f2c4c7aSAndroid Build Coastguard WorkerLOG_FILE=/dev/null
27*2f2c4c7aSAndroid Build Coastguard Workerif [ x"${console}" != x"" ]; then
28*2f2c4c7aSAndroid Build Coastguard Worker    if [ -e /dev/${console} ]; then
29*2f2c4c7aSAndroid Build Coastguard Worker	LOG_FILE=/dev/${console}
30*2f2c4c7aSAndroid Build Coastguard Worker    fi
31*2f2c4c7aSAndroid Build Coastguard Workerfi
32*2f2c4c7aSAndroid Build Coastguard Worker
33*2f2c4c7aSAndroid Build Coastguard Worker# Run the script
34*2f2c4c7aSAndroid Build Coastguard Workercd /
35*2f2c4c7aSAndroid Build Coastguard Workerif [ x"${installer_script}" = x"" ]; then
36*2f2c4c7aSAndroid Build Coastguard Worker    exit
37*2f2c4c7aSAndroid Build Coastguard Workerfi
38*2f2c4c7aSAndroid Build Coastguard Workerif [ ! -x "${installer_script}" ]; then
39*2f2c4c7aSAndroid Build Coastguard Worker    exit
40*2f2c4c7aSAndroid Build Coastguard Workerfi
41*2f2c4c7aSAndroid Build Coastguard Worker
42*2f2c4c7aSAndroid Build Coastguard Worker${installer_script} > "${LOG_FILE}" 2>&1
43*2f2c4c7aSAndroid Build Coastguard Worker
44*2f2c4c7aSAndroid Build Coastguard Worker# shutdown the machine.
45*2f2c4c7aSAndroid Build Coastguard Workershutdown -h 1
46