Skip to content

Commit 0ea7b93

Browse files
author
Michael Kreitzer
committed
1.0.2: Updates to issues found when running against an existing instance
- Added better OS detection to Vagrantfile - fixed error in scripts/000-setup_environment.sh to run dos2unix on config_users.sh - updated scripts/001-setup_users.sh to run user/group checks without /srv/www
1 parent 3087865 commit 0ea7b93

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

Vagrantfile

+19-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,25 @@ mounts_required.each do |required_folder|
3333
end
3434
end
3535

36-
if !Vagrant::Util::Platform.windows?
36+
module OS
37+
def OS.windows?
38+
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
39+
end
40+
41+
def OS.mac?
42+
(/darwin/ =~ RUBY_PLATFORM) != nil
43+
end
44+
45+
def OS.unix?
46+
!OS.windows?
47+
end
48+
49+
def OS.linux?
50+
OS.unix? and not OS.mac?
51+
end
52+
end
53+
54+
if OS.mac?
3755
check_plugins ["vagrant-bindfs"]
3856
end
3957

scripts/000-setup_environment.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ apt-get install -y git tig htop smem strace lynx dos2unix 2>&1
2222
find /vagrant/files -type f -exec dos2unix {} \;
2323
dos2unix /vagrant/config_php.sh
2424
dos2unix /vagrant/config_groups.sh
25-
dos2unix /vagrant/config_groups.sh
25+
dos2unix /vagrant/config_users.sh
2626

2727

2828
# Setup Hosts file

scripts/001-setup_users.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function vagrant_groups() {
3333
echo "Remapping existing group ${group_name} from GID ${group_oldGID} to GID ${group_newGID}"
3434
groupmod -g ${group_newGID} ${group_name}
3535
echo "Reassigning files and folders associated with old group id to the new one"
36-
$(find / -gid ${group_oldGID} '!' -type l -exec chgrp ${group_newGID} '{}' ';' 2>&1 | grep -v 'No such file or directory') || true
36+
$(find / -path "/srv/www" -prune -o -gid ${group_oldGID} '!' -type l -exec chgrp ${group_newGID} '{}' ';' 2>&1 | grep -v 'No such file or directory') || true
3737
fi
3838
done
3939
}
@@ -81,7 +81,7 @@ function vagrant_users() {
8181
echo "Remapping existing user ${user_name} from UID ${user_oldUID} to UID ${user_newUID}"
8282
usermod -u ${user_newUID} ${user_name}
8383
echo "Reassigning files and folders associated with old user id to the new one"
84-
$(find / -uid ${user_oldUID} '!' -type l -exec chown ${user_newUID} '{}' ';' 2>&1 | grep -v 'No such file or directory') || true
84+
$(find / -path "/srv/www" -prune -o -uid ${user_oldUID} '!' -type l -exec chown ${user_newUID} '{}' ';' 2>&1 | grep -v 'No such file or directory') || true
8585
fi
8686

8787
if [ $(id -g ${user_name}) != ${user_newGID} ]; then
@@ -97,7 +97,7 @@ function vagrant_services {
9797
local i
9898
local services
9999

100-
services=('apache2 mysql redis-server varnish')
100+
services=('apache2 redis-server varnish')
101101
arr=(${services// / })
102102
for i in "${arr[@]}"; do
103103
sudo service ${i} ${1} || true

0 commit comments

Comments
 (0)