Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified credentials + readme. #3

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added countdown to reset scripts.
  • Loading branch information
AlexSkrypnyk committed Nov 27, 2015
commit fae09002ff7618f7aa68436f5e3471dbba028c86
32 changes: 32 additions & 0 deletions reset-full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,37 @@
# Reset Drupal installation and vagrant box.
#

##
# Countdown timer.
#
# Usage example:
# countdown "00:00:05"
#
function countdown() {
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS="${OLD_IFS}"
echo " "
}

echo "Resetting VM in 5 seconds"
countdown "00:00:05"

vagrant ssh -c "sudo chmod 775 /var/www/drupal/docroot/sites/default && rm -rf /home/vagrant/vagrantup /home/vagrant/siteinstalled /var/www/drupal/docroot"
vagrant provision
32 changes: 32 additions & 0 deletions reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,37 @@
# Re-install Drupal.
#

##
# Countdown timer.
#
# Usage example:
# countdown "00:00:05"
#
function countdown() {
local OLD_IFS="${IFS}"
IFS=":"
local ARR=( $1 )
local SECONDS=$(( (ARR[0] * 60 * 60) + (ARR[1] * 60) + ARR[2] ))
local START=$(date +%s)
local END=$((START + SECONDS))
local CUR=$START

while [[ $CUR -lt $END ]]
do
CUR=$(date +%s)
LEFT=$((END-CUR))

printf "\r%02d:%02d:%02d" \
$((LEFT/3600)) $(( (LEFT/60)%60)) $((LEFT%60))

sleep 1
done
IFS="${OLD_IFS}"
echo " "
}

echo "Resetting Drupal installation in 5 seconds"
countdown "00:00:05"

vagrant ssh -c "sudo rm -rf /home/vagrant/vagrantup /home/vagrant/siteinstalled"
vagrant provision