Commit 487e7e55 authored by Vinicius Ruoso's avatar Vinicius Ruoso

Created scripts to automatize the package creation process

The following scripts were added:
  - build-agent-files: script to compile the sources from the git and create
    a tree with all necessary files to agent work.
  - create-integrity-system: script to create backup and md5sum from agent
    files to a better integrity.
  - build-update-package: script to create a .run package to be used with
    the auto-update feature.
  - build-install-package: script to create a package to be installed from
    the portal.

The following bootstraps were added:
  - bootstrap-install: the script to prepare the environment for the package
  - bootstrap-update: critical script to update a package installation

In a near future the README will contain details on how to use those
scripts.
Signed-off-by: default avatarVinicius Ruoso <vkr07@c3sl.ufpr.br>
parent 8f24a59a
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This is the installation bootstrap
[MD5SUM]
FILE="SEED2.tgz"
SEED_MEC_HOME="/opt/seed_mec"
# This function shows some error message and aborts execution
abort(){
printf "error: fatal: $1\n"
exit 1
}
# This function will check the integrity of tar package
verify_md5(){
printf "Checking the md5..."
if [[ ${MD5_CHECK} == $(md5sum ${FILE} | awk '{print $1}') ]] ; then
printf "OK!\n"
else
printf "ERROR!\n"
rm -rf "${FILE}" &>/dev/null
userdel -r seed_mec &>/dev/null
groupdel seed_mec &>/dev/null
abort "este pacote está corrompido, por favor faça um novo download."
fi
}
# Begin of script
# Creating seed_mec group and user
if ! groupadd -fr seed_mec; then
abort "falha ao criar o grupo seed_mec."
fi
if ! useradd -rm -g seed_mec -s /bin/bash -d "${SEED_MEC_HOME}" seed_mec; then
abort "falha ao criar o usuário seed_mec."
fi
# Uncompress tar package and check its integrity
tail -n +[BOOTSTRAP_LINES] $0 > "${SEED_MEC_HOME}/${FILE}"
cd "${SEED_MEC_HOME}"
verify_md5
# Extract tar file and run agent
tar xzf "${FILE}" &>/dev/null
chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"
rm -rf ${FILE} &>/dev/null
su -c "bash SEED2/agent.sh" seed_mec
exit 0
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This is the update bootstrap
FILE="SEED2-update-0.1.0.tgz"
MD5_CHECK="2c8762a29fac0f380aa57301e84aa0f4"
SEED_MEC_HOME="/opt/seed_mec"
UPDATE_DIR="update/tmp/SEED2-run"
# This function shows some error message and aborts execution
abort(){
printf "error: fatal: $1\n"
exit 1
}
# That function verify the md5 of package is correct
verify_md5(){
printf "[SEED2-update] Checking the md5..."
if [[ ${MD5_CHECK} == $(md5sum "${SEED_MEC_HOME}/update/tmp/${FILE}" | \
awk '{print $1}') ]]; then
printf "OK!\n"
else
printf "ERROR!\n"
rm -rf ${FILE} &>/dev/null
abort "this package is currupted, please download it again."
fi
}
# Re-create the md5 from inep and proxy
restore_inep_proxy_md5sum(){
for FILE in inep proxy; do
md5sum "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" |cut -d' ' -f1 > \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}"
# The backup md5 is the same
cp -a "${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/.backup/client/conf/"
done
}
# Re-create the backup inep and proxy files
# and copy the md5files
restore_inep_proxy_backup(){
for FILE in inep proxy; do
# The backup itself
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.backup/client/conf/"
done
}
# Begin of script
# Create auxiliar directories
mkdir -p "${SEED_MEC_HOME}/update/tmp"
mkdir -p "${SEED_MEC_HOME}/update/old"
# Extract the tar package
tail -n +138 "$0" > "${SEED_MEC_HOME}/update/tmp/${FILE}"
verify_md5
cd "${SEED_MEC_HOME}/update/tmp"
tar xzf "${FILE}" &>/dev/null
cd - &>/dev/null
# Copy the configuration files and dependents to new tree
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf"
# Check if inep and proxy files exist
INEP_PROXY="${SEED_MEC_HOME}/SEED2/client/conf/inep
${SEED_MEC_HOME}/SEED2/client/conf/proxy"
for FILE in ${INEP_PROXY}; do
test -f "${FILE}" ||
abort "inep and/or proxy file(s) missing, please reinstall the package."
done
# Copy inep and proxy to new tree
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf/"
# Copy or create the md5 files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.md5sum" &&
cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf/") ||
restore_inep_proxy_md5sum
# Copy or create the backup files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.backup" &&
cp -a "${SEED_MEC_HOME}/SEED2/.backup/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.backup/client/conf/") ||
restore_inep_proxy_backup
# TODO: do some security backup???
#cp -ra "${SEED_MEC_HOME}/SEED2/" "${SEED_MEC_HOME}/old/"
# If something interrupt the script here, the tree will not be entirely
# correct, so we create a file to mark somthing happen and on the next
# execution the package will try to recover itself
##### CRITICAL #####
touch "${SEED_MEC_HOME}/SEED2/updating"
# md5sum and backup folders
rm -rf "${SEED_MEC_HOME}/SEED2/.md5sum" \
"${SEED_MEC_HOME}/SEED2/.backup" &>/dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"{.md5*,.back*}* \
"${SEED_MEC_HOME}/SEED2/"
# The files itself
rm -rf "${SEED_MEC_HOME}/SEED2/"{bin,lib,net,client,scripts} &>/dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"* \
"${SEED_MEC_HOME}/SEED2/"
rm -f "${SEED_MEC_HOME}/SEED2/updating" &>/dev/null
### END CRITICAL ###
# Remove auxiliar directories
rm -rf "${SEED_MEC_HOME}/update" &>/dev/null
# Call the agent
bash "${SEED_MEC_HOME}/SEED2/agent.sh"
exit 0
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
PREFIX="$(dirname $0)"
# Get the configuration
if ! source "${PREFIX}/buildpackage.conf" 2>/dev/null; then
echo "error: failed to load buildpackage.conf"
exit 1
fi
# Customizable variables, please refer to
# buildpackage.conf to change these values
: ${GITBASEDIR:="../"}
: ${GITUSER:="git"}
: ${GITSERVER:="git.c3sl.ufpr.br"}
: ${WEBSERVICE:="seed.c3sl.ufpr.br"}
: ${AGENTDIR:="agent-files"}
: ${AGENTPACKAGEDIR:="SEED2-run"}
printf "====================\n"
printf "$0 v0.1\n"
printf "\n"
printf "**** Make sure that ${WEBSERVICE} webservice are up and running!!!\n"
printf "\n"
printf "NOTE: This will take a while.\n"
printf " Make sure the git update process below will run ok.\n"
printf "====================\n"
printf "\n"
# Make sure all repositories are ok
printf "Updating git repositories...\n"
for repo in "${GITBASEDIR}/client:client" "${GITBASEDIR}/coleta:coleta"; do
REPOPATH="$(echo $repo |cut -d: -f1)"
REPONAME="$(echo $repo |cut -d: -f2)"
printf "${REPONAME}...\n"
# Check the environment
if ! cd "${REPOPATH}" 2>/dev/null; then
if ! cd "${GITBASEDIR}" 2>/dev/null; then
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "MAKE SURE THAT GITBASEDIR EXISTS AND HAVE ACCESS TO IT.\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
else
printf "git-clone ${REPONAME}...\n"
if git-clone ${GITUSER}@${GITSERVER}:seed2/${REPONAME}.git; then
cd - &>/dev/null
cd "${REPOPATH}"
else
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "PROBLEMS EXECUTING GIT-CLONE...\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
fi
fi
fi
if ! git pull; then
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "PROBLEMS EXECUTING GIT-PULL...\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
fi
cd - &>/dev/null
done
printf "\n\n"
# Compile agent and collect
printf "Starting compilation proccess...\n\n"
printf "Starting compiling client..\n\n"
sleep 1
cd "${GITBASEDIR}/client"
if make && make install; then
printf "\n\n"
printf "Client compilation is finished.\n"
printf "EVERYTHING WAS FINE\n\n"
else
printf "\n\n"
printf "Client compilation is finished.\n"
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
fi
cd -
printf "Starting compiling collect-parser...\n\n"
sleep 1
cd "${GITBASEDIR}/coleta"
if make && make install; then
printf "\n\n"
printf "Collect-parser compilation is finished.\n"
printf "EVERYTHING WAS FINE\n\n"
else
printf "\n\n"
printf "Collect-parser compilation is finished.\n"
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
fi
cd -
# Build the package itself
printf "Starting build the package...\n"
OUTDIR="${AGENTDIR}/${AGENTPACKAGEDIR}/"
rm -Rf "${OUTDIR}"
mkdir -p "${OUTDIR}/client/"
mkdir -p "${OUTDIR}/lib/"
EXCLUDEFILE=$(tempfile --prefix=build-package-exclude)
cat > ${EXCLUDEFILE} << EOF
src
lib/include
lib/libxml2*/*
lib/*.tar.gz
Makefile
TODO
EOF
printf "Copying collect files..."
rsync -aHx --delete --exclude-from=${EXCLUDEFILE} \
"${GITBASEDIR}/coleta/"* "${OUTDIR}"
rm -Rf "${OUTDIR}/lib/libxml2"*
printf " done\n"
cat > ${EXCLUDEFILE} << EOF
src
lib
Makefile
run-config.sh
COPYING
INSTALL
NEWS
README
AUTHORS
TODO
EOF
printf "Copying client files..."
rsync -aHx --delete --exclude-from=${EXCLUDEFILE} \
"${GITBASEDIR}/client/"* "${OUTDIR}/client/"
printf " done\n\n"
BOOTSTRAP="${PREFIX}/bootstraps/bootstrap-install"
printf "Copying bootstrap..."
cp -a "${BOOTSTRAP}" "${AGENTDIR}"/
printf " done\n\n"
rm -f "${EXCLUDEFILE}"
printf "All done.\n"
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
AGENT_FILES="./agent-files"
INEP=$1
if [[ "$2" == "\"\"" ]]; then
PHOST=
else
PHOST=$2
fi
if [[ "$3" == "\"\"" ]]; then
PPORT=
else
PPORT=$3
fi
if [[ "$4" == "\"\"" ]]; then
PUID=
else
PUID=$4
fi
if [[ "$5" == "\"\"" ]]; then
PPASSWD=
else
PPASSWD=$5
fi
# Check the INEP value
if test -z ${INEP}; then
echo "error: invalid INEP."
exit 1
fi
# Start the tree creation process
printf "Creating tree..."
mkdir -p "/tmp/${INEP}"
cp -r "${AGENT_FILES}/SEED2-run" "/tmp/${INEP}/SEED2"
mkdir -p "/tmp/${INEP}/SEED2/client/conf"
echo "${INEP}" > "/tmp/${INEP}/SEED2/client/conf/inep"
FILE="/tmp/${INEP}/SEED2/client/conf/inep"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/client/conf/inep"
cp -a "${FILE}" "/tmp/${INEP}/SEED2/.backup/client/conf/inep"
FILE="/tmp/${INEP}/SEED2/.backup/client/conf/inep"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/.backup/client/conf/inep"
echo "phost=$PHOST" > "/tmp/${INEP}/SEED2/client/conf/proxy"
echo "pport=$PPORT" >> "/tmp/${INEP}/SEED2/client/conf/proxy"
echo "puid=$PUID" >> "/tmp/${INEP}/SEED2/client/conf/proxy"
echo "ppasswd=$PPASSWD" >> "/tmp/${INEP}/SEED2/client/conf/proxy"
FILE="/tmp/${INEP}/SEED2/client/conf/proxy"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/client/conf/proxy"
cp -a "${FILE}" "/tmp/${INEP}/SEED2/.backup/client/conf/proxy"
FILE="/tmp/${INEP}/SEED2/.backup/client/conf/proxy"
md5sum "${FILE}" |cut -d' ' -f1 > \
"/tmp/${INEP}/SEED2/.md5sum/.backup/client/conf/proxy"
cp -r "${AGENT_FILES}/bootstrap-install" "/tmp/${INEP}"
printf "done.\n"
# The tree is ready, we need to compress it now (tar+gz)
printf "Packaging..."
cd "/tmp/${INEP}"
tar -czf SEED2.tgz SEED2
# Create the tar md5 and compute the bootstrap lines
MD5_CHECK=$(md5sum SEED2.tgz | awk '{print $1}')
LINENUM=$(( $(wc -l "bootstrap-install" | cut -d' ' -f1) + 1 ))
# Edit the bootstrap and start the real package
sed "s/\[BOOTSTRAP_LINES\]/${LINENUM}/g; \
s/\[MD5SUM\]/MD5_CHECK=\"${MD5_CHECK}\"/g" \
"bootstrap-install" > agent_${INEP}.run
# Insert the tar on the package and finish
cat "SEED2.tgz" >> "agent_${INEP}.run"
mv "agent_${INEP}.run" "/tmp"
printf "done.\n"
# Remove temporary files
printf "Removing temporary files..."
cd ..
rm -rf "${INEP}" 2>/dev/null
printf "done.\n"
echo "All done"
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
PREFIX="$(dirname $0)"
# Get the configuration
if ! source "${PREFIX}/buildpackage.conf" 2>/dev/null; then
echo "error: failed to load buildpackage.conf"
exit 1
fi
# Customizable variables, please refer to
# buildpackage.conf to change these values
: ${AGENTDIR:="agent-files"}
: ${AGENTPACKAGEDIR:="SEED2-run"}
: ${UPDATEDIR:="update-files"}
BOOTSTRAP="${PREFIX}/bootstraps/bootstrap-update"
VERSIONFILE="${AGENTDIR}/${AGENTPACKAGEDIR}/client/conf/version"
printf "====================\n"
printf "$0 v0.1\n"
printf "\n"
printf "*** Make sure ${AGENTDIR}/${AGENTPACKAGEDIR}\n"
printf "contains the latest package generated by build-agent-files ***\n"
printf "====================\n"
printf "\n"
printf "Starting build the package...\n\n"
VERSION=$(cat ${VERSIONFILE})
if test $? != 0; then
printf "FATAL: version file not found.\n"
printf "ABORTING!!!!!!!!!!\n"
exit 1
fi
printf "Compressing SEED2-run files..."
cd "${AGENTDIR}"
TARFILE=$(tempfile --prefix=SEED2-tar)
tar -czf "${TARFILE}" SEED2-run
cd - &>/dev/null
printf " done\n"
printf "Calculating MD5SUM..."
MD5_CHECK=$(md5sum ${TARFILE} | awk '{print $1}')
printf " done\n\n"
OUTPUT="${UPDATEDIR}/SEED2-update-${VERSION}.run"
printf "Creating update .run package..."
mkdir -p "${UPDATEDIR}"
LINENUM=$(( $(wc -l "${BOOTSTRAP}" | cut -d' ' -f1) + 1 ))
sed "s/\[BOOTSTRAP_LINES\]/${LINENUM}/g; \
s/\[TARFILE\]/FILE=\"SEED2-update-${VERSION}.tgz\"/g; \
s/\[MD5SUM\]/MD5_CHECK=\"${MD5_CHECK}\"/g" \
"${BOOTSTRAP}" > "${OUTPUT}"
cat "${TARFILE}" >> "${OUTPUT}"
printf "done\n"
rm -f "${TARFILE}"
printf "All done.\n"
GITSERVER="git.c3sl.ufpr.br"
GITUSER="git"
GITBASEDIR="../git"
WEBSERVICE="seed.c3sl.ufpr.br"
AGENTDIR="./agent/agent-files"
AGENTPACKAGEDIR="SEED2-run"
UPDATEDIR="./agent/update-files"
#!/bin/bash
# Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# collect-agent 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
PREFIX="$(dirname $0)"
# Get the configuration
if ! source "${PREFIX}/buildpackage.conf" 2>/dev/null; then
echo "error: failed to load buildpackage.conf"
exit 1
fi
# Customizable variables, please refer to
# buildpackage.conf to change these values
: ${AGENTDIR:="agent-files"}
: ${AGENTPACKAGEDIR:="SEED2-run"}
BASEDIR="${AGENTDIR}/${AGENTPACKAGEDIR}"
MD5DIR=".md5sum"
BACKUPDIR=".backup"
# The list of files to backup
# client/conf/{inep,proxy} will be added on creation process
BACKUPLIST="agent.sh collect.conf client/run.sh client/bin/client
load-config.sh client/common.sh client/conf/version collect.conf"
printf "====================\n"
printf "$0 v0.1\n"
printf "\n"
printf "NOTE: Make sure this is the last thing you do before publish the "
printf "package.\n"
printf "====================\n"
printf "\n"
if ! cd "${BASEDIR}"; then
printf "SOMETHING WENT WRONG !!!!!!!!!!!!!!!!!!!!!!!!\n"
printf "I CANT ACCESS THE AGENT FILES...\n"
printf "ABORTING !!!!!!!!!!!!!!!!!!!!!!!!\n\n"
exit 1
fi
rm -Rf "${MD5DIR}" 2> /dev/null
mkdir -p "${MD5DIR}"
printf "Starting creating backup files..."
mkdir -p "${BACKUPDIR}/client/"{conf,bin}
for FILE in ${BACKUPLIST}; do
cp -a "${FILE}" "${BACKUPDIR}/${FILE}"
done
printf "done\n"
printf "Calculationg md5sum..."
for FOLDER in $(find . -type d); do
mkdir -p "${MD5DIR}/${FOLDER}"
done
for FILE in $(find . -type f); do
md5sum "${FILE}" |cut -d' ' -f1 > "${MD5DIR}/${FILE}"
done
printf "done\n"
printf "All done.\n"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment