Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #4596: Avoid using "cp -a" on AIX systems #256

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions rudder-agent/SOURCES/check-rudder-agent
Expand Up @@ -28,6 +28,13 @@ CFE_DIR=/var/rudder/cfengine-community
CFE_BIN_DIR=${CFE_DIR}/bin
CFE_DISABLE_FILE=/opt/rudder/etc/disable-agent

# If we are on AIX, use an alternative cp syntax
if [ "z$(uname -s)" == "zAIX" ]; then
CP_A="cp -hpPr"
else
CP_A="cp -a"
fi

# Detect the correct ps tool to use
# Supported tools are ps, vzps, and the rudder supplied vzps.py
PS=ps
Expand Down Expand Up @@ -98,7 +105,7 @@ if [ ! -e ${UUID_FILE} ]; then
fi
if [ -f ${LATEST_BACKUPED_UUID} ]; then
echo -n "WARNING: The UUID of the node does not exist. The lastest backup (${LATEST_BACKUPED_UUID}) will be recovered..."
cp -a ${LATEST_BACKUPED_UUID} ${UUID_FILE} >/dev/null 2>&1
${CP_A} ${LATEST_BACKUPED_UUID} ${UUID_FILE} >/dev/null 2>&1
echo " Done"
else
echo -n "WARNING: The UUID of the node does not exist and no backup exist. A new one will be generated..."
Expand Down Expand Up @@ -134,7 +141,7 @@ if [ ! -e ${FILE_TO_RESTORE} ]; then
fi
if [ -f ${LATEST_BACKUPED_FILES} ]; then
echo -n "WARNING: The file ${FILE_TO_RESTORE} does not exist. The lastest backup (${LATEST_BACKUPED_FILES}) will be recovered..."
cp -a ${LATEST_BACKUPED_FILES} ${FILE_TO_RESTORE} >/dev/null 2>&1
${CP_A} ${LATEST_BACKUPED_FILES} ${FILE_TO_RESTORE} >/dev/null 2>&1
echo " Done"
else
echo "WARNING: The file ${FILE_TO_RESTORE} does not exist and no backup exist. Please reinstall the rudder-agent package"
Expand Down
16 changes: 9 additions & 7 deletions rudder-agent/SOURCES/perl-prepare.sh
Expand Up @@ -49,6 +49,13 @@ NO_CLEANUP=0
OLD_PATH=$PATH
NO_PERL_REBUILD=0

# If we are on AIX, use an alternative cp syntax
if [ "z${OS}" == "zAIX" ]; then
CP_A="cp -hpPr"
else
CP_A="cp -a"
fi

buildDmidecode () {
cd $TMP
gunzip < $FILEDIR/dmidecode-$DMIDECODE_VERSION.tar.gz | tar xvf -
Expand Down Expand Up @@ -148,17 +155,12 @@ done

cd $PWD/../../fusioninventory-agent

mkdir -p $TMP/perl$PERL_PREFIX/share/fusion-utils && cp -a share/* $TMP/perl$PERL_PREFIX/share/fusion-utils
mkdir -p $TMP/perl$PERL_PREFIX/share/fusion-utils && ${CP_A} share/* $TMP/perl$PERL_PREFIX/share/fusion-utils

PERL_MM_USE_DEFAULT=1 $TMP/perl$PERL_PREFIX/bin/perl Makefile.PL --default PREFIX=$PERL_PREFIX
$MAKE install DESTDIR=$TMP/perl

# If we are on AIX, use an alternative cp syntax
if [ "z${OS}" == "zAIX" ]; then
cp -hpPr lib/FusionInventory $TMP/perl$PERL_PREFIX/lib/perl5/
else
cp -a lib/FusionInventory $TMP/perl$PERL_PREFIX/lib/perl5/
fi
${CP_A} lib/FusionInventory $TMP/perl$PERL_PREFIX/lib/perl5/

#Restoring PATH
PATH=$OLD_PATH
Expand Down