"cp -a" can't copy the files with "." as the prefix,
and "cp -r -a" can do it. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6791 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
461c236542
commit
4f80ea942c
@ -275,8 +275,8 @@ sub process_request {
|
||||
my $name = $rootimg_dir . $tmpc[2];
|
||||
|
||||
if (-e $name) {
|
||||
$verbose && $callback->({info=>["cp -a $name $rootimg_dir.statebackup$f"]});
|
||||
xCAT::Utils->runcmd("cp -a $name $rootimg_dir.statebackup$f");
|
||||
$verbose && $callback->({info=>["cp -r -a $name $rootimg_dir.statebackup$f"]});
|
||||
xCAT::Utils->runcmd("cp -r -a $name $rootimg_dir.statebackup$f");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ sub process_request {
|
||||
|
||||
if ( -e $srcf ) {
|
||||
$verbose && $callback->({info=>["recovering from $srcf to $destf"]});
|
||||
xCAT::Utils->runcmd("cp -a $destf $srcf", 0, 1);
|
||||
xCAT::Utils->runcmd("cp -r -a $destf $srcf", 0, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -468,8 +468,8 @@ sub liteMe {
|
||||
}
|
||||
|
||||
# copy the file in place.
|
||||
$verbose && $callback->({info=>["cp -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -a $rif $rootimg_dir/.default$d");
|
||||
$verbose && $callback->({info=>["cp -r -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -r -a $rif $rootimg_dir/.default$d");
|
||||
}
|
||||
|
||||
# this loop creates symbolic links for each of the files in the sync list.
|
||||
@ -502,8 +502,8 @@ sub liteMe {
|
||||
system("mkdir -p $rootimg_dir/.default$d");
|
||||
|
||||
# copy the file in place.
|
||||
$verbose && $callback->({info=>["cp -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -a $rif $rootimg_dir/.default$d");
|
||||
$verbose && $callback->({info=>["cp -r -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -r -a $rif $rootimg_dir/.default$d");
|
||||
|
||||
# remove the real file
|
||||
$verbose && $callback->({info=>["rm -rf $rif"]});
|
||||
@ -716,7 +716,7 @@ sub recoverFiles {
|
||||
xCAT::Utils->runcmd("rm -rf $target", 0, 1);
|
||||
my $default = $rootimg_dir . "/.default" . $f;
|
||||
if( -e $default) {
|
||||
xCAT::Utils->runcmd("cp -a $default $target", 0, 1);
|
||||
xCAT::Utils->runcmd("cp -r -a $default $target", 0, 1);
|
||||
}else { # maybe someone deletes the copy in .default directory
|
||||
xCAT::Utils->runcmd("touch $target", 0, 1);
|
||||
}
|
||||
@ -729,7 +729,7 @@ sub recoverFiles {
|
||||
xCAT::Utils->runcmd("rm -rf $target", 0, 1);
|
||||
my $default = $rootimg_dir . "/.default" . $f;
|
||||
if( -e $default) {
|
||||
xCAT::Utils->runcmd("cp -a $default $target", 0, 1);
|
||||
xCAT::Utils->runcmd("cp -r -a $default $target", 0, 1);
|
||||
} else {
|
||||
xCAT::Utils->runcmd("mkdir $target", 0, 1);
|
||||
}
|
||||
@ -784,8 +784,8 @@ sub liteItem {
|
||||
}
|
||||
|
||||
# copy the file to /.defaults
|
||||
$verbose && $callback->({info=>["cp -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -a $rif $rootimg_dir/.default$d");
|
||||
$verbose && $callback->({info=>["cp -r -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -r -a $rif $rootimg_dir/.default$d");
|
||||
|
||||
}else {
|
||||
# 1. copy original contents if they exist to .default directory
|
||||
@ -811,8 +811,8 @@ sub liteItem {
|
||||
system("mkdir -p $rootimg_dir/.default$d");
|
||||
|
||||
# copy the file in place.
|
||||
$verbose && $callback->({info=>["cp -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -a $rif $rootimg_dir/.default$d");
|
||||
$verbose && $callback->({info=>["cp -r -a $rif $rootimg_dir/.default$d"]});
|
||||
system("cp -r -a $rif $rootimg_dir/.default$d");
|
||||
|
||||
# remove the real file
|
||||
$verbose && $callback->({info=>["rm -rf $rif"]});
|
||||
|
@ -201,11 +201,11 @@ ProcessType () {
|
||||
case "${3}" in
|
||||
tmpfs,rw)
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
cp -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
cp -a ${1} ${TMPFS}${2}
|
||||
echo "cp -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
# the link will already be in place on the image, so nothing else to do!
|
||||
#mount -n --bind ${TMPFS}${2} ${1}
|
||||
@ -220,11 +220,11 @@ ProcessType () {
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
cp -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
cp -a ${1} ${TMPFS}${2}
|
||||
echo "cp -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
|
||||
if [ "$isChild" = "0" ]; then
|
||||
@ -242,8 +242,8 @@ ProcessType () {
|
||||
# if the file doesn't exist, then copy it over to persistent
|
||||
if [ ! -e ${PERSISTENT}${2} ]
|
||||
then
|
||||
echo "cp -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
echo "cp -r -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -r -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
fi
|
||||
|
||||
ORIG=`echo ${2} | sed -e 's/\/$//'`
|
||||
@ -268,8 +268,8 @@ ProcessType () {
|
||||
then
|
||||
#ln -s ${1} ${PERSISTENT}/${2}
|
||||
# if its not there, then take it from something else
|
||||
echo "cp -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
echo "cp -r -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -r -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
|
||||
#mount -n --bind ${TMPFS}${2} ${1}
|
||||
fi
|
||||
@ -376,5 +376,5 @@ ResolveLinks
|
||||
ln -sf /proc/mounts ${TMPFS}/etc/mtab
|
||||
|
||||
# catch all hack for debugging:
|
||||
#cp -a ${DEFAULT}/* /.snapshot/tmpfs/
|
||||
#cp -r -a ${DEFAULT}/* /.snapshot/tmpfs/
|
||||
# foo
|
||||
|
@ -201,11 +201,11 @@ ProcessType () {
|
||||
case "${3}" in
|
||||
tmpfs,rw)
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
cp -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
cp -a ${1} ${TMPFS}${2}
|
||||
echo "cp -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
# the link will already be in place on the image, so nothing else to do!
|
||||
#mount -n --bind ${TMPFS}${2} ${1}
|
||||
@ -220,11 +220,11 @@ ProcessType () {
|
||||
TARGET=`echo ${1}`
|
||||
|
||||
if [ -d ${TMPFS}${2} ]; then
|
||||
cp -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1}* ${TMPFS}${2}
|
||||
echo "cp -r -a ${1}* ${TMPFS}${2}" >>$LOG
|
||||
else
|
||||
cp -a ${1} ${TMPFS}${2}
|
||||
echo "cp -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
cp -r -a ${1} ${TMPFS}${2}
|
||||
echo "cp -r -a ${1} ${TMPFS}${2}" >>$LOG
|
||||
fi
|
||||
|
||||
if [ "$isChild" = "0" ]; then
|
||||
@ -242,8 +242,8 @@ ProcessType () {
|
||||
# if the file doesn't exist, then copy it over to persistent
|
||||
if [ ! -e ${PERSISTENT}${2} ]
|
||||
then
|
||||
echo "cp -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
echo "cp -r -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -r -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
fi
|
||||
|
||||
ORIG=`echo ${2} | sed -e 's/\/$//'`
|
||||
@ -268,8 +268,8 @@ ProcessType () {
|
||||
then
|
||||
#ln -s ${1} ${PERSISTENT}/${2}
|
||||
# if its not there, then take it from something else
|
||||
echo "cp -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
echo "cp -r -a ${1} ${PERSISTENT}${2}" >>$LOG
|
||||
cp -r -a ${1} ${PERSISTENT}${2} 2>&1 >>$LOG
|
||||
|
||||
#mount -n --bind ${TMPFS}${2} ${1}
|
||||
fi
|
||||
@ -376,5 +376,5 @@ ResolveLinks
|
||||
ln -sf /proc/mounts ${TMPFS}/etc/mtab
|
||||
|
||||
# catch all hack for debugging:
|
||||
#cp -a ${DEFAULT}/* /.snapshot/tmpfs/
|
||||
#cp -r -a ${DEFAULT}/* /.snapshot/tmpfs/
|
||||
# foo
|
||||
|
Loading…
Reference in New Issue
Block a user