I'm trying to create a simple bash shell script provisioner for a vagrant puppet dev env which checks that /tmp/puppet-modules-up-to-date exists and was created within a certain timeframe, 14 days to be precise. I'm struggling to progress with this simple script. Any help appreciated.
#!/bin/bash
if [[ ! -f /tmp/.puppet-modules-up-to-date ]] && [[ ! (find /tmp/.puppet-modules-up-to-date -mtime -14 | grep puppet) ]]; then
puppet_dir=/etc/puppet
echo 'Copying Puppetfile into place'
cp /vagrant/puppet/Puppetfile $puppet_dir
cd $puppet_dir
echo 'Installing puppet modules into place'
librarian-puppet install
echo 'Updating previously installed puppet modules'
librarian-puppet update
touch /tmp/.puppet-modules-up-to-date
fi
Simply gives me the following error:
==> default: /tmp/vagrant-shell: line 3: conditional binary operator expected
==> default: /tmp/vagrant-shell: line 3: expected `)'
==> default: /tmp/vagrant-shell: line 3: syntax error near `/tmp/.puppet-modules-up-to-date'
==> default: /tmp/vagrant-shell: line 3: `if [[ ! -f /tmp/.puppet-modules-up-to-date ]] && [[ ! (find /tmp/.puppet-modules-up-to-date -mtime -14 | grep puppet) ]]; then'