2014-01-20 12:47:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
2014-01-20 12:50:42 +00:00
|
|
|
# 2014 Nico Schottelius (nico-cdist at schottelius.org)
|
2014-01-20 12:47:45 +00:00
|
|
|
#
|
|
|
|
# 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/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
os=$(cat "$__global/explorer/os")
|
2014-04-24 23:48:58 +00:00
|
|
|
if [ -f "$__object/parameter/name" ]; then
|
|
|
|
name_should="$(cat "$__object/parameter/name")"
|
|
|
|
else
|
|
|
|
name_should="$(echo "${__target_host%%.*}")"
|
|
|
|
fi
|
|
|
|
|
2014-01-20 12:47:45 +00:00
|
|
|
|
|
|
|
not_supported() {
|
|
|
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
|
|
|
echo "Please contribute an implementation for it if you can." >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$os" in
|
2016-04-12 03:18:47 +00:00
|
|
|
archlinux|debian|suse|ubuntu|devuan)
|
2014-04-24 23:48:58 +00:00
|
|
|
# handled in gencode-remote
|
|
|
|
:
|
|
|
|
;;
|
2016-06-22 11:32:51 +00:00
|
|
|
scientific|centos)
|
2014-04-24 23:48:58 +00:00
|
|
|
__key_value sysconfig-hostname \
|
|
|
|
--file /etc/sysconfig/network \
|
|
|
|
--delimiter '=' \
|
|
|
|
--key HOSTNAME \
|
|
|
|
--value "$name_should" --exact_delimiter
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
not_supported
|
|
|
|
;;
|
2014-01-20 12:47:45 +00:00
|
|
|
esac
|