Verify setenforce is executable

Some images/distros do not install/use selinux. This small change will
verify that `setenforce` is executable and in the path before attempting
to run the command. This prevents the script from erroring and causing a
failed `cloud-init` run.

Change-Id: I42f802c7994b8d907f0cc4e3b1a38e6fd89dac0c
changes/19/71019/1
BK Box 9 years ago
parent c02b8e8c02
commit 265467f5cd

@ -1,5 +1,5 @@
#!/bin/bash
setenforce 0
command -v setenforce >/dev/null 2>&1 && setenforce 0
useradd -m @INSTANCE_USER@
echo -e '@INSTANCE_USER@\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers

Loading…
Cancel
Save