update ccollect_add_source
- add gpl3 - add support for 0.7 configuration style - arrived at home with the bus 862, quite cold and snowy
This commit is contained in:
parent
213c15297c
commit
16c2efa1b8
1 changed files with 26 additions and 9 deletions
|
@ -1,10 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Nico Schottelius
|
#
|
||||||
# 2007-08-16
|
# 2007-2008 Nico Schottelius (nico-ccollect at schottelius.org)
|
||||||
# Written for Netstream (www.netstream.ch)
|
#
|
||||||
|
# This file is part of ccollect.
|
||||||
|
#
|
||||||
|
# ccollect 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.
|
||||||
|
#
|
||||||
|
# ccollect 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 ccollect. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# 2007-08-16: Written for Netstream (www.netstream.ch)
|
||||||
|
#
|
||||||
# Creates a source from standard values specified in
|
# Creates a source from standard values specified in
|
||||||
# /etc/ccollect/defaults/sources
|
# /etc/ccollect/defaults/sources
|
||||||
# Copying: GPLv3
|
#
|
||||||
|
|
||||||
# standard values
|
# standard values
|
||||||
CCOLLECT_CONF="${CCOLLECT_CONF:-/etc/ccollect}"
|
CCOLLECT_CONF="${CCOLLECT_CONF:-/etc/ccollect}"
|
||||||
|
@ -70,7 +87,7 @@ while [ $# -gt 0 ]; do
|
||||||
# copy standard files
|
# copy standard files
|
||||||
for file in $standard_opts; do
|
for file in $standard_opts; do
|
||||||
eval rfile=\"\$$file\"
|
eval rfile=\"\$$file\"
|
||||||
eval filename=${SCONFIG}/${rfile}
|
eval filename="${SCONFIG}/${rfile}"
|
||||||
if [ -e "${filename}" ]; then
|
if [ -e "${filename}" ]; then
|
||||||
_echo Copying \"$rfile\" to ${fullname} ...
|
_echo Copying \"$rfile\" to ${fullname} ...
|
||||||
cp -r "${filename}" "${fullname}/${rfile}"
|
cp -r "${filename}" "${fullname}/${rfile}"
|
||||||
|
@ -86,7 +103,7 @@ while [ $# -gt 0 ]; do
|
||||||
source_source="${source_source}$(cat "${src_postfix}")" || _exit_err "${src_postfix}: Reading failed."
|
source_source="${source_source}$(cat "${src_postfix}")" || _exit_err "${src_postfix}: Reading failed."
|
||||||
fi
|
fi
|
||||||
_echo "Adding \"${source_source}\" as source for ${source}"
|
_echo "Adding \"${source_source}\" as source for ${source}"
|
||||||
echo "${source_source}" > "${fullname}/source"
|
echo "${source_source}" > "${fullname}/source" || _exit_err "Creating ${fullname}/source: failed."
|
||||||
|
|
||||||
# create destination directory
|
# create destination directory
|
||||||
absbase=$(cd "${destination_base}" 2>/dev/null && pwd -P) || \
|
absbase=$(cd "${destination_base}" 2>/dev/null && pwd -P) || \
|
||||||
|
@ -97,9 +114,9 @@ while [ $# -gt 0 ]; do
|
||||||
mkdir -p "${dest}" || _exit_err "${dest}: Cannot create."
|
mkdir -p "${dest}" || _exit_err "${dest}: Cannot create."
|
||||||
|
|
||||||
# link destination directory
|
# link destination directory
|
||||||
dest_abs=$(cd "${dest}" && pwd -P) || _exit_err "${dest}: Changing to newly create dirctory failed."
|
dest_abs=$(cd "${dest}" && pwd -P) || _exit_err "${dest}: Changing to newly created directory failed."
|
||||||
ln -s "${dest_abs}" "${fullname}/destination" || \
|
echo "${dest_abs}" > "${fullname}/destination" || \
|
||||||
_exit_err "${fullname}/destination: Failed to link \"${dest_abs}\""
|
_exit_err "${fullname}/destination: Failed to create."
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue