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

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

View File

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