[__hostname] Support more operating systems See merge request ungleich-public/cdist!802remotes/origin/6.1
commit
d10dfa7807
@ -1,30 +0,0 @@ |
||||
#!/bin/sh |
||||
# |
||||
# 2014 Nico Schottelius (nico-cdist at schottelius.org) |
||||
# |
||||
# This file is part of cdist. |
||||
# |
||||
# cdist is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# cdist is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>. |
||||
# |
||||
# |
||||
# Retrieve the contents of /etc/hostname |
||||
# |
||||
|
||||
# Almost any distribution |
||||
if [ -f /etc/hostname ]; then |
||||
cat /etc/hostname |
||||
# SuSE |
||||
elif [ -f /etc/HOSTNAME ]; then |
||||
cat /etc/HOSTNAME |
||||
fi |
@ -1,26 +0,0 @@ |
||||
#!/bin/sh |
||||
# |
||||
# 2014 Nico Schottelius (nico-cdist at schottelius.org) |
||||
# |
||||
# This file is part of cdist. |
||||
# |
||||
# cdist is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# cdist is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
# |
||||
# You should have received a copy of the GNU General Public License |
||||
# along with cdist. If not, see <http://www.gnu.org/licenses/>. |
||||
# |
||||
# |
||||
# Retrieve the contents of /etc/hostname |
||||
# |
||||
|
||||
if [ -f /etc/sysconfig/network ]; then |
||||
awk -F= '/^HOSTNAME=/ { print $2 }' /etc/sysconfig/network |
||||
fi |
@ -0,0 +1,10 @@ |
||||
#!/bin/sh -e |
||||
|
||||
command -v getconf >/dev/null || exit 0 |
||||
|
||||
val=$(getconf HOST_NAME_MAX 2>/dev/null) || exit 0 |
||||
|
||||
if test -n "${val}" -a "${val}" != 'undefined' |
||||
then |
||||
echo "${val}" |
||||
fi |
Loading…
Reference in new issue