forked from ungleich-public/cdist
Merge remote-tracking branch 'telmich/master' into nfs
This commit is contained in:
commit
a511461d9b
47 changed files with 615 additions and 197 deletions
|
|
@ -49,7 +49,7 @@ if grep -q ^Fedora /etc/redhat-release 2>/dev/null; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# CentOS is also based on Redhat, this return before redhat!
|
||||
# CentOS is also based on Redhat, thus return before redhat!
|
||||
if grep -q ^CentOS /etc/redhat-release 2>/dev/null; then
|
||||
echo centos
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -26,12 +26,18 @@ else
|
|||
file="/$__object_id"
|
||||
fi
|
||||
|
||||
regex=$(cat "$__object/parameter/line")
|
||||
if [ -f "$__object/parameter/regex" ]; then
|
||||
regex=$(cat "$__object/parameter/regex")
|
||||
else
|
||||
wrap=$(cat "$__object/parameter/line")
|
||||
regex="^$wrap\$"
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
# sh -e is our environment, we know what we do,
|
||||
# skip error detection for now
|
||||
set +e
|
||||
grep -q "^$regex\$" "$file"
|
||||
grep -q "$regex" "$file"
|
||||
if [ $? -eq 1 ]; then
|
||||
echo "NOTFOUND"
|
||||
else
|
||||
|
|
|
|||
|
|
@ -25,7 +25,9 @@ OPTIONAL PARAMETERS
|
|||
file::
|
||||
If supplied, use this as the destination file.
|
||||
Otherwise the object_id is used.
|
||||
|
||||
regex::
|
||||
If supplied, search for this regex.
|
||||
Otherwise entire line must be matched.
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
file
|
||||
regex
|
||||
|
|
|
|||
|
|
@ -27,4 +27,4 @@ require="__package/python-software-properties" \
|
|||
--source "$__type/files/remove-apt-repository" \
|
||||
--mode 0755
|
||||
|
||||
require="$__self" __apt_update_index
|
||||
require="$__object_name" __apt_update_index
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ if [ -f "$__object/parameter/comment" ]; then
|
|||
fi
|
||||
echo "$entry" >> "$__object/parameter/entry"
|
||||
|
||||
require="$__self" __autofs_master
|
||||
require="$__object_name" __autofs_master
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ if [ ! -f "$__object/parameter/header" ]; then
|
|||
fi
|
||||
|
||||
[ -d "$__object/files" ] || mkdir "$__object/files"
|
||||
require="$__self" __file /etc/auto.master --source "$__object/files/auto.master" \
|
||||
require="$__object_name" __file /etc/auto.master --source "$__object/files/auto.master" \
|
||||
--mode 644 \
|
||||
--owner root \
|
||||
--group root
|
||||
|
|
|
|||
|
|
@ -49,4 +49,4 @@ for property in $(ls .); do
|
|||
fi
|
||||
done
|
||||
|
||||
require="$__self" __package_$type "$@"
|
||||
require="$__object_name" __package_$type "$@"
|
||||
|
|
|
|||
31
conf/type/__package_luarocks/explorer/pkg_status
Executable file
31
conf/type/__package_luarocks/explorer/pkg_status
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2012 SwellPath, Inc.
|
||||
# Christian G. Warden <cwarden@xerus.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 status of a rock
|
||||
#
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="$__object_id"
|
||||
fi
|
||||
|
||||
# Accept luarocks failing if package is not known/installed
|
||||
luarocks list "$name" | egrep -A1 "^$name$" || exit 0
|
||||
52
conf/type/__package_luarocks/gencode-remote
Executable file
52
conf/type/__package_luarocks/gencode-remote
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2012 SwellPath, Inc.
|
||||
# Christian G. Warden <cwarden@xerus.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/>.
|
||||
#
|
||||
#
|
||||
# Manage LuaRocks packages
|
||||
#
|
||||
|
||||
|
||||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="$__object_id"
|
||||
fi
|
||||
|
||||
state="$(cat "$__object/parameter/state")"
|
||||
is_installed="$(grep "(installed)" "$__object/explorer/pkg_status" || true)"
|
||||
|
||||
case "$state" in
|
||||
installed)
|
||||
# Install only if non-existent
|
||||
if [ -z "$is_installed" ]; then
|
||||
echo luarocks install \"$name\"
|
||||
fi
|
||||
;;
|
||||
removed)
|
||||
# Remove only if existent
|
||||
if [ -n "$is_installed" ]; then
|
||||
echo luarocks remove \"$name\"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown state: $state" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
49
conf/type/__package_luarocks/man.text
Normal file
49
conf/type/__package_luarocks/man.text
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
cdist-type__package_luarocks(7)
|
||||
==============================
|
||||
Christian G. Warden <cwarden@xerus.org>
|
||||
|
||||
|
||||
NAME
|
||||
----
|
||||
cdist-type__package_luarocks - Manage luarocks packages
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
LuaRocks is a deployment and management system for Lua modules.
|
||||
|
||||
|
||||
REQUIRED PARAMETERS
|
||||
-------------------
|
||||
state::
|
||||
Either "installed" or "removed".
|
||||
|
||||
|
||||
OPTIONAL PARAMETERS
|
||||
-------------------
|
||||
name::
|
||||
If supplied, use the name and not the object id as the package name.
|
||||
|
||||
|
||||
EXAMPLES
|
||||
--------
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
# Ensure luasocket is installed
|
||||
__package_luarocks luasocket --state installed
|
||||
|
||||
# Remove package
|
||||
__package_luarocks luasocket --state removed
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
- cdist-type(7)
|
||||
- cdist-type__package(7)
|
||||
|
||||
|
||||
COPYING
|
||||
-------
|
||||
Copyright \(C) 2012 SwellPath, Inc. Free use of this software is
|
||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
|
||||
23
conf/type/__package_luarocks/manifest
Normal file
23
conf/type/__package_luarocks/manifest
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2012 SwellPath, Inc.
|
||||
# Christian G. Warden <cwarden@xerus.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/>.
|
||||
#
|
||||
|
||||
__package luarocks --state installed
|
||||
__package make --state installed
|
||||
1
conf/type/__package_luarocks/parameter/optional
Normal file
1
conf/type/__package_luarocks/parameter/optional
Normal file
|
|
@ -0,0 +1 @@
|
|||
name
|
||||
1
conf/type/__package_luarocks/parameter/required
Normal file
1
conf/type/__package_luarocks/parameter/required
Normal file
|
|
@ -0,0 +1 @@
|
|||
state
|
||||
|
|
@ -38,4 +38,4 @@ if [ ! -f "$__object/parameter/size" ]; then
|
|||
fi
|
||||
|
||||
# pull in the type that actually does something with the above parameters
|
||||
require="$__self" __partition_msdos_apply
|
||||
require="$__object_name" __partition_msdos_apply
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
if [ -f "$__object/parameter/name" ]; then
|
||||
name="$(cat "$__object/parameter/name")"
|
||||
else
|
||||
name="/$__object_id"
|
||||
name="$__object_id"
|
||||
fi
|
||||
|
||||
pgrep -x -f "$name" || true
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@ __process /usr/sbin/sshd --state stopped --stop "/etc/rc.d/sshd stop"
|
|||
# Ensure cups is running, which runs with -C ...:
|
||||
__process cups --start "/etc/rc.d/cups start" --state running \
|
||||
--name "/usr/sbin/cupsd -C /etc/cups/cupsd.conf"
|
||||
|
||||
# Ensure rpc.statd is running (which usually runs with -L) using a regexp
|
||||
__process rpcstatd --state running --start "/etc/init.d/statd start" \
|
||||
--name "rpc.statd.*"
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue