我正在尝试使用post shell脚本将apache网站的目录复制到使用packer的vagrant box但我不知道我应该将包含apache所有文件的目录放在哪个目录中。我一直遇到这个错误:
ubuntu-vanilla-16011-server: cp -r bootstrap-website/ ~/var/www/html/
ubuntu-vanilla-16011-server: cp: cannot stat 'bootstrap-website/': No such file or directory
==> ubuntu-vanilla-16011-server: Unregistering and deleting virtual machine...
==> ubuntu-vanilla-16011-server: Deleting output directory...
Build 'ubuntu-vanilla-16011-server' errored: Script exited with non-zero exit status: 1
==> Some builds didn't complete successfully and had errors:
--> ubuntu-vanilla-16011-server: Script exited with non-zero exit status: 1
==> Builds finished but no artifacts were created.
这是我的安装后脚本:
#!/bin/bash
set -e
set -v
# http://superuser.com/questions/196848/how-do-i-create-an-administrator-user-on-ubuntu
# http://unix.stackexchange.com/questions/1416/redirecting-stdout-to-a-file-you-dont-have-write-permission-on
# This line assumes the user you created in the preseed directory is vagrant
echo "vagrant ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/init-users
sudo cat /etc/sudoers.d/init-users
# Installing vagrant keys
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
sudo mkdir -p /home/vagrant/.ssh
sudo chown -R vagrant:vagrant /home/vagrant/.ssh
cat ./vagrant.pub >> /home/vagrant/.ssh/authorized_keys
apt-get update
apt-get install -y apache2
apt-get install -y php
if ! [ -L /var/www ]; then
rm -rf /var/www
ln -fs /vagrant /var/www
fi
cp -r bootstrap-website/ ~/var/www/html/
任何帮助将不胜感激。 感谢