Commit bee49534 authored by Dmitri Konstantinov's avatar Dmitri Konstantinov
Browse files

modification of post-install.sh: creation a filtered list containing actual paths to be replaced

parent c3daa172
Pipeline #2386791 passed with stage
in 7 minutes and 30 seconds
......@@ -27,6 +27,26 @@ fi
echo "Replacing $OLDINSTALLDIR -> $INSTALLDIR [or $LCGRELEASES] ..."
# prepare package list for replacing
# This part quicly checks using grep if the path is inside of any file, and creates shofter list called "filteredPaths".
ALLMYFILES=$(cat $PREFIX/$listname | grep -v -- '->' | while read myfile; do
test "$myfile" = ".filelist" && continue # skip .filelist
echo ${myfile}
done)
ALLMYFILES=$(echo $ALLMYFILES | tr '\n' ' ' )
ALLMYFILES=$(echo $ALLMYFILES | tr -s " " )
filteredPaths=$(cat $PREFIX/$listname | grep -- '->'| while read name; do
dir2test="$(echo $name | grep -- '->'| awk -F'->' '{print $1}')"
dir2test=$(echo $dir2test | tr '\n' ' ' )
dir2test=$(echo $dir2test | tr -s " ")
IFS=' '
grep -q -- "$dir2test" ${ALLMYFILES}
retVal=$?
if [ $retVal -eq 0 ]; then
echo ${name}
fi
done)
# loop over files (lines without '->')
cat $PREFIX/$listname | grep -v -- '->' | while read name; do
......@@ -34,10 +54,12 @@ cat $PREFIX/$listname | grep -v -- '->' | while read name; do
#old=$(mktemp -t lcg.XXXXX)
#cp -f "$PREFIX/$name" "$old"
# loop over all target paths (after '->' delimiter)
cat $PREFIX/$listname | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
# cat $PREFIX/$listname | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
echo $filteredPaths | grep -- '->' | awk -F'->' '{print $2}'| sort | uniq | while read newpath; do
# loop over all source paths for given target path, use sorting by path length to resolve issues like /var/build/... and /build/...
# 1 target path is related with multiple (at least 2 -- real and 'usual') source paths
cat $PREFIX/$listname | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
# cat $PREFIX/$listname | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
echo $filteredPaths | grep -- '->' | grep -- "$newpath" | awk -F'->' '{ print length($1) " " $0; }' | sort -r -n | cut -d ' ' -f 2- | while read line; do
olddir="$(echo $line | awk -F'->' '{print $1}')"
for install_dir in $INSTALLDIR $LCGRELEASES; do
if test -z "$NIGHTLY_MODE"; then
......
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