DIRECTORY=""
OS=""
MEMORY=""
CPU=""
CPUS=$(nproc)
CONTINUE=true
while true
do
while [ -z "${DIRECTORY}" ]
do
clear
read -r -p "Please enter the tempory directory name [ Encore ] : " DIRECTORY
if [ -z "${DIRECTORY}" ]
then
DIRECTORY="Encore"
fi
done
while [ -z "${OS}" ]
do
clear
read -r -p "Please enter the os boxes to use [ generic/arch ] : " OS
if [ -z "${OS}" ]
then
OS="generic/arch"
fi
done
while [ -z "${MEMORY}" ]
do
clear
read -r -p "Please enter the memory to use [ 4096 ] : " MEMORY
if [ -z "${MEMORY}" ]
then
MEMORY="4096"
fi
done
while [ -z "${CPU}" ]
do
clear
read -r -p "Please enter the cpus to use [ ${CPUS} ] : " CPU
if [ -z "${CPU}" ]
then
CPU=${CPUS}
fi
while [ "${CPU}" -gt "${CPUS}" ]
do
clear
read -r -p "Please enter the cpus to use : " CPU
done
done
if [ -f "boot" ]
then
rm "boot"
fi
while [ ${CONTINUE} == true ]
do
command=""
while [ -z "${command}" ]
do
clear
echo -e "Please enter a command to run in the container : \n"
read -r command
done
echo
read -r -e -p "Append another command ? [Y/n] : " AGAIN
echo "${command}" >> boot
case "${AGAIN}" in
""|"y"|"Y")
CONTINUE=true
;;
*)
CONTINUE=false
;;
esac
done
COMMAND="$(cat boot)"
again "${DIRECTORY}" "${OS}" "${MEMORY}" "${CPU}" "${COMMAND}"
for i in $(seq 1 10)
do
printf "%s" "."
sleep "${i}"
done
DIRECTORY=""
OS=""
MEMORY=""
CPU=""
COMMAND=""
done