1#!/bin/bash 2 3# Wait for Login Prompt fully active. 4# Otherwise the output are mixed together. 5while true; do 6 systemctl is-active --quiet multi-user.target 7 if [ $? -eq 0 ]; then 8 break 9 fi 10 sleep 2 11done 12sleep 10 13 14# Parsing /proc/cmdline and export all the variables 15PARAMS="" 16if [ -e /proc/cmdline ]; then 17 PARAMS=$(cat /proc/cmdline) 18fi 19 20for i in ${PARAMS} 21do 22 export ${i} 23done 24 25# Log output for qemu serial. 26LOG_FILE=/dev/null 27if [ x"${console}" != x"" ]; then 28 if [ -e /dev/${console} ]; then 29 LOG_FILE=/dev/${console} 30 fi 31fi 32 33# Run the script 34cd / 35if [ x"${installer_script}" = x"" ]; then 36 exit 37fi 38if [ ! -x "${installer_script}" ]; then 39 exit 40fi 41 42${installer_script} > "${LOG_FILE}" 2>&1 43 44# shutdown the machine. 45shutdown -h 1 46