mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
- the sysprep.sh script was not executable (flagged by rpmlint)
- Need to explicitly `require 'tmpdir'` in `spec_helper.rb` on openSUSE
Tumbleweed,
otherwise you get tons of failures like:
```
An error occurred while loading ./spec/unit/action/prepare_nfs_settings_spec.rb.
Failure/Error: temp_dir = Dir.mktmpdir("rspec-")
NoMethodError:
undefined method `mktmpdir' for Dir:Class
temp_dir = Dir.mktmpdir("rspec-")
^^^^^^^^^
Did you mean? mkdir
# ./spec/spec_helper.rb:44:in `block in <top (required)>'
# ./spec/spec_helper.rb:41:in `<top (required)>'
# ./spec/unit/action/prepare_nfs_settings_spec.rb:3:in `require'
# ./spec/unit/action/prepare_nfs_settings_spec.rb:3:in `<top (required)>'
```
33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#!/bin/sh -eux
|
|
|
|
# consider purging any packages you don't need here
|
|
|
|
echo "autoremoving packages and cleaning apt data"
|
|
apt-get -y autoremove;
|
|
apt-get -y clean;
|
|
|
|
# repeat what machine-ids does in sysprep as this script needs to run via customize
|
|
# which has a bug resulting in the machine-ids being regenerated
|
|
|
|
if [ -f /etc/machine-id ]
|
|
then
|
|
truncate --size=0 /etc/machine-id
|
|
fi
|
|
|
|
if [ -f /var/lib/dbus/machine-id ]
|
|
then
|
|
truncate --size=0 /run/machine-id
|
|
fi
|
|
|
|
echo "remove /var/cache"
|
|
find /var/cache -type f -exec rm -rf {} \;
|
|
|
|
echo "force a new random seed to be generated"
|
|
rm -f /var/lib/systemd/random-seed
|
|
|
|
# for debian based systems ensure host keys regenerated on boot
|
|
if [ -e /usr/sbin/dpkg-reconfigure ]
|
|
then
|
|
printf "@reboot root command bash -c 'export PATH=$PATH:/usr/sbin ; export DEBIAN_FRONTEND=noninteractive ; export DEBCONF_NONINTERACTIVE_SEEN=true ; /usr/sbin/dpkg-reconfigure openssh-server &>/dev/null ; /bin/systemctl restart ssh.service ; rm --force /etc/cron.d/keys'\n" > /etc/cron.d/keys
|
|
fi
|