Skip to content

Commit

Permalink
updateFileSets fixed: creating symlinks in new version sometimes fails
Browse files Browse the repository at this point in the history
  • Loading branch information
kwindrem committed Oct 18, 2023
1 parent 8331fe8 commit 1812182
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
2 changes: 1 addition & 1 deletion blindInstall/SetupHelperVersion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.8
v5.9
3 changes: 3 additions & 0 deletions changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v5.9:
updateFileSets fixed: creating symlinks in new version sometimes fails

v5.8:
fixed bugs in updateFileSets introduced in v5.7

Expand Down
40 changes: 31 additions & 9 deletions updateFileSets
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ for package in $packageList; do
fi

clearProgress
outputProgress "$package $version1 "
outputProgress "$package: $version1 "
if [ ! -d "$fileSet1" ]; then
mkdir "$fileSet1"
touch "$fileSet1/NEW_FILE_SET"
Expand All @@ -269,6 +269,8 @@ for package in $packageList; do
replacementFile1="$fileSet1/$baseName"
origFile1="$fileSet1/$baseName.orig"

outputProgress "."

# remove any existing symlinks for original files - they aren't needed
if [ -L "$origFile1" ]; then
rm -f "$origFile1"
Expand All @@ -277,8 +279,6 @@ for package in $packageList; do
# skip if this file matched one in a prevous scan
if [ -f "$origFile1.MATCHES_PREVIOUS" ]; then
continue
else
outputProgress "."
fi

# use alternate original if present
Expand Down Expand Up @@ -323,7 +323,7 @@ for package in $packageList; do
origFile2="$fileSet2/$baseName.orig"

stockFilesMatch=false
# stock files exist

if [ -d "$stockFiles/$version2" ]; then
# select appropriate original file
if $useAltOrig ; then
Expand Down Expand Up @@ -375,13 +375,33 @@ for package in $packageList; do
fi
fi
fi
# created links for fs 2
if $stockFilesMatch ; then
done # for entry2

# make another fs 2 pass to fill in sym links
# this needs to be done AFTER files are moved to their new location
for entry2 in ${allVersions[@]} ; do
IFS=':' read version2 version2number <<< "$entry2"
if (( "$version2number" == "$version1number" )); then
continue
fi
fileSet2="$packageFiles/$version2"
replacementFile2="$fileSet2/$baseName"
origFile2="$fileSet2/$baseName.orig"
# select appropriate original file
if $useAltOrig ; then
stockFile2="$stockFiles/$version2$altOrigFile"
else
stockFile2="$stockFiles/$version2$file"
fi
cmp -s "$stockFile2" "$stockFile1" > /dev/null
# stock files match - create sym links for fs 2
if [ $? -eq 0 ]; then
if [ -f "$replacementFile1" ] && [ ! -L "$replacementFile1" ]; then
ln -sf "../$version1/$baseName" "$replacementFile2"
rm -f "$replacementFile2.USE_ORIGINAL"
elif [ -f "$replacementFile1.USE_ORIGINAL" ]; then
touch "$replacementFile2.USE_ORIGINAL"
rm -f "$replacementFile2"
# no replacement in fs 1
else
# remove any inappropriate sym link
Expand All @@ -393,7 +413,7 @@ for package in $packageList; do
touch "$fileSet2/INCOMPLETE"
fi
fi
done # for version2
done # for entry2 -- again

# only change file set if orig does not exist or it does NOT match the file from StockFiles
if [ -f "$origFile1" ]; then
Expand Down Expand Up @@ -431,7 +451,10 @@ for package in $packageList; do
versionList1=($(ls -d "$packageFiles"/v* 2> /dev/null))

# check to see if a non-versioned file is appropriate
clearProgress
outputProgress "$package: check for version-independent files "
for file in $fileList ; do
outputProgress "."
realFileCount=0
baseName=$(basename "$file")
# file must be a stock file
Expand Down Expand Up @@ -464,13 +487,12 @@ for package in $packageList; do
fi
done


# cleanup file sets
linksOnlyVersions=()
for fileSet in ${versionList1[@]} ; do
version=$(basename $fileSet)
clearProgress
outputProgress "$package $version cleanup"
outputProgress "$package: $version cleanup"
if [ ! -d "$fileSet" ]; then
continue
fi
Expand Down
Binary file modified venus-data.UninstallPackages.tgz
Binary file not shown.
Binary file modified venus-data.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.8
v5.9

0 comments on commit 1812182

Please sign in to comment.