Continuing the topic. Initial post was just an idea - make tce-update handle .tcz.md5.txt files containing both .tcz and .tcz.dep sums. Proposed in the initial post workaround was wrong. Here is the next attempt. Attached tce-update supposed to provide the handling of extended .tcz.md5.txt files. It is tested updating the working TC13 x86 system - successfully.
Here is the diff:
--- tce-update.orig 2022-05-08 15:39:05.000000000 +0300
+++ tce-update 2023-03-23 17:24:42.618946654 +0200
@@ -16,6 +16,7 @@
fetch(){
[ -f "$1" ] && rm -f "$1"
wget -cq "$MIRROR"/"$1"
+ wget -cq "$MIRROR"/"$1".dep
}
fetchzsync(){
[ -f "$1" ] && rm -f "$1"
@@ -23,13 +24,14 @@
rm -f "$1".zs-old
else
wget -cq "$MIRROR"/"$1" # Either there was no zsync file on the server, or it failed
+ wget -cq "$MIRROR"/"$1".dep
fi
}
chkMd5Only(){
MYMD5=`cat "$F"`
TARGET="$(getbasefile "$F" 2)"
- REPO=`grep -w " $TARGET" md5.db`
+ REPO=`grep " $TARGET" md5.db`
if [ -n "$REPO" ]; then
[ "$MYMD5" == "$REPO" ] || echo $(basename "${F%.md5.txt}")
else
@@ -37,9 +39,18 @@
fi
}
+slice(){
+ while [ "$*" ]
+ do
+ echo $1" "$2
+ shift
+ shift
+ done
+}
+
upgrade(){
TARGET="$(getbasefile "$F" 2)"
- REPO=`grep -w " $TARGET" md5.db`
+ REPO=`grep " $TARGET" md5.db`
if [ -n "$REPO" ]; then
MYMD5=`cat "$F"`
if [ "$MYMD5" != "$REPO" ]; then
@@ -52,11 +63,10 @@
else
fetch "$TARGET" 2>/dev/null
fi
- echo "$REPO" > "$TARGET".md5.txt
+ slice $REPO > "$TARGET".md5.txt
md5sum -cs "$TARGET".md5.txt
if [ "$?" == 0 ]; then
- fetch "$TARGET".dep 2>/dev/null
- if [ "$?" == 0 ]; then
+ if [ -f /tmp/"$TARGET".dep ]; then
dep_vars /tmp/"$TARGET".dep
mv /tmp/"$TARGET".dep "$TARGET_DIR"/.
fi
@@ -86,7 +96,7 @@
for F in $DEPS; do
for TARGET in `cat "$F"`; do
if [ ! -f "$UPGRADE_DIR"/"$TARGET" ] && [ ! -f "$UPGRADE_DIR"/upgrade/"$TARGET" ]; then
- REPO=`grep -w "$TARGET" md5.db`
+ REPO=`grep " $TARGET" md5.db`
if [ -n "$REPO" ]; then
echo -n "Fetching required dependency: $TARGET "
if [ -n "$USEZSYNC" ]; then
@@ -94,7 +104,7 @@
else
fetch "$TARGET" 2>/dev/null
fi
- echo "$REPO" > "$TARGET".md5.txt
+ slice $REPO > "$TARGET".md5.txt
md5sum -cs "$TARGET".md5.txt
if [ "$?" == 0 ]; then
mv /tmp/"$TARGET".md5.txt "$TARGET_DIR"/. 2>/dev/null
Some comments.
1. fetch() and fetchzsync() now load both .tcz and .tcz.dep
2. REPO variable may contain two records, that's why function slice() is used to separate them
3. "-w" option for grep is not used. Leading space in " $TARGET" allows to select both .tcz and .tcz.dep (if present)