Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
setup: reduce platform specific code and enhancements
Browse files Browse the repository at this point in the history
As before, the setup script copies the Bareos source code from the BAREOS_SOURCE
directory to the build directory.
By this change, the setup will no longer update the source code in the BAREOS_SOURCE directory by git pull.
Instead it will update the local copy in the build directory.

Another change is, that setup will no longer delete build/.git/ directory.
The build directory is also used as source directory for backup jobs.
While removing the build/.git/ directory reduces the required space,
keeping the directory makes it easier to examine the Bareos
source after regression tests did run.
  • Loading branch information
joergsteffens committed Dec 30, 2016
1 parent e11204c commit 6e82544
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 42 deletions.
2 changes: 1 addition & 1 deletion scripts/cleanup
Expand Up @@ -7,7 +7,7 @@
. ./config
. scripts/functions

if ! [ -f ${working}/CLEANUPMARKER ]; then
if [ ! -f ${working}/CLEANUPMARKER ]; then
print_debug "SKIPPED: cleanup. Looks like it is already clean."
exit 0
fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/create_sparse_file.sh
Expand Up @@ -14,7 +14,7 @@ printf "$filename created.\n"
printf "size=%s\n" "$size"
printf "realsize=%s\n" "$realsize"

if ! [ "$realsize" -lt "$size" ]; then
if [ "$realsize" -gt "$size" ]; then
printf "ERROR: realsize has to be smaller than size.\n"
exit 1
fi
57 changes: 21 additions & 36 deletions scripts/setup
Expand Up @@ -31,45 +31,30 @@ rm -rf build bin
#
# See if this is a git clone
#
if [ -f .git/config ]; then
if [ -f .git/config ] && type git >/dev/null 2>&1; then
#
# See if we have git available.
#
GIT=`which git 2>/dev/null`
if [ ! -z "${GIT}" ] ; then
${GIT} pull

#
# If the source dir is a seperate git repo update it now to the latest source
#
if [ -f ${BAREOS_SOURCE}/.git/config ]; then
(cd ${BAREOS_SOURCE}; ${GIT} pull)
fi

#
# Copy new source
#
echo "Copying source from ${BAREOS_SOURCE}"
cp -rp ${BAREOS_SOURCE} build

${GIT} show HEAD | grep commit | head -1 | awk '{print $2}' > build/git-version
else
#
# Copy new source
#
echo "Copying source from ${BAREOS_SOURCE}"
cp -rp ${BAREOS_SOURCE} build

echo "Git not found." > build/git-version
fi
else
#
# Copy new source
#
echo "Copying source from ${BAREOS_SOURCE}"
cp -rp ${BAREOS_SOURCE} build
git pull
fi

echo "Not a Git repository." > build/git-version
#
# Copy the source
#
echo "Copying source from ${BAREOS_SOURCE}"
cp -rp ${BAREOS_SOURCE} build

if [ -f build/.git/config ] && type git >/dev/null 2>&1; then
#
# update bareos sources
#
(
cd build;
git pull;
git show HEAD | grep commit | head -1 | awk '{print $2}' > git-version
)
else
echo "Git not available." > build/git-version
fi

scripts/create_sed
Expand All @@ -85,7 +70,7 @@ cp tmp/o$$ build/src/include/version.h
# Remove unneeded directories
#
rm -rf build/txt build/src/testprogs
rm -rf build/.git
#rm -rf build/.git
sed -f tmp/sed_tmp scripts/regress-config.in >scripts/regress-config
chmod 755 scripts/regress-config
cp scripts/regress-config build
Expand Down
2 changes: 1 addition & 1 deletion tests/1-example-test
Expand Up @@ -82,7 +82,7 @@ check_two_logs
check_restore_diff ${BackupDirectory}

# do some manual testing
if ! [ -d ${BackupDirectory} ]; then
if [ ! -d ${BackupDirectory} ]; then
set_error "Directory ${BackupDirectory} does not exists any more."
fi

Expand Down
2 changes: 1 addition & 1 deletion tests/always-incremental-test
Expand Up @@ -114,7 +114,7 @@ check_two_logs
check_restore_diff ${BackupDirectory}

# do some manual testing
if ! [ -d ${BackupDirectory} ]; then
if [ ! -d ${BackupDirectory} ]; then
set_error "Directory ${BackupDirectory} does not exists any more."
fi

Expand Down
2 changes: 1 addition & 1 deletion tests/sparse-encrypt-test
Expand Up @@ -28,7 +28,7 @@ if [ $? != 0 ]; then
exit 1
fi

if ! [ -e "${SPARSEFILE}" ]; then
if [ ! -e "${SPARSEFILE}" ]; then
set_error "Failed to create sparse file."
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion tests/sparse-file-test
Expand Up @@ -32,7 +32,7 @@ if [ $? != 0 ]; then
exit 1
fi

if ! [ -e "${SPARSEFILE}" ]; then
if [ ! -e "${SPARSEFILE}" ]; then
set_error "Failed to create sparse file."
exit 1
fi
Expand Down

0 comments on commit 6e82544

Please sign in to comment.