enable --unattended option for use with mocha-vscode

This commit is contained in:
Michael Becker 2024-08-31 21:12:58 -04:00
parent de021e0006
commit 2eb53f4809
2 changed files with 26 additions and 10 deletions

View File

@ -79,11 +79,14 @@ elif [ "$1" == "new" ]; then
cd $VAGRANT_MOCHADIR
BGS=""
if [ "$2" == "--transient" ]; then
./provision --transient
else
./provision
BGS="$BGS --transient"
fi
if [ "$2" == "--unattended" ]; then
BGS="$BGS --unattended"
fi
./provision $BGS
else
echo "usage: mocha suv new [--transient] | (up|down|shell|delete MACHINENAME) | list"

View File

@ -15,6 +15,7 @@ SUV_IP_LAST=$(shuf -i 10-200 -n 1)
SUV_IP=$SUV_IP_PREFIX.$SUV_IP_FIRST.$SUV_IP_LAST
SUV_ALWAYS_PROVISION="false"
SUV_UNATTENDED="false"
if [ "$1" == "--transient" ]; then
shift
@ -25,6 +26,11 @@ else
echo "initializing new PERSISTENT Mocha SUV with id $SUV_NAME"
fi
if [ "$1" == "--unattended" ]; then
SUV_UNATTENDED="true"
shift
fi
SUV_TEMPLATE="default"
if [ "$1" != "" ]; then
@ -61,13 +67,15 @@ ln -s ../../../mocha-php/mocha-php/src/mocha-php ./site
ln -s ../../../mocha-common/mocha-common/data/libraries/yaml ./libraries
ln -s ../../../mocha-common/mocha-common/data/uploads ./uploads
echo "enter sudo password to add entry to /etc/hosts if desired"
SUV_DNS=""
if [ "$SUV_UNATTENDED" == "false" ]; then
echo "enter sudo password to add entry to /etc/hosts if desired"
echo "$SUV_IP $SUV_NAME$SUV_DOMAINNAME" | sudo tee -a /etc/hosts
if [ $? == "0" ]; then
SUV_DNS="$SUV_NAME$SUV_DOMAINNAME"
fi
fi
if [ "$SUV_DNS" != "" ]; then
SUV_IP_OR_DNS="$SUV_DNS"
@ -79,3 +87,8 @@ sed -i -e "s/@@MOCHA_SUV_ID@@/$SUV_NAME/" -e "s/@@MOCHA_SUV_ADDRESS@@/$SUV_IP/"
vagrant up
if [ "$?" != "0" ]; then
rm -rf ../$SUV_NAME
exit 127
fi