Don't try to use hostnamectl when systemd isn't running

This commit is contained in:
Markus Koller 2016-07-06 11:22:15 +02:00
parent 0e114c37ac
commit e79610f23c
No known key found for this signature in database
GPG Key ID: A2B74A05A7A2B7B7
1 changed files with 7 additions and 2 deletions

View File

@ -18,7 +18,12 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Check whether system has hostnamectl
# Check whether system has hostnamectl and it's usable, i.e. don't
# try to use it when systemd isn't running yet.
#
command -v hostnamectl || true
if command -v hostnamectl >/dev/null && hostnamectl status >/dev/null 2>&1; then
echo "yes"
else
true
fi