]> Sergey Matveev's repositories - godlighty.git/commitdiff
More portable zstd instead of bsdiff
authorSergey Matveev <stargrave@stargrave.org>
Thu, 20 Feb 2025 12:06:03 +0000 (15:06 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 20 Feb 2025 12:06:21 +0000 (15:06 +0300)
doc/index.texi
make-update

index 65cbe8da654f872f14129d88300cb2140d6463d4..b0b51ab29f9677e73feed89fc0c5079115afbe0c 100644 (file)
@@ -62,7 +62,8 @@ Can drop (UID, GID, groups) privileges.
 Basically all configuration is done directly inside source code. You
 have to recompile it every time configuration changes. Is it a problem?
 I doubt, because Go is very fast. But it produces huge statically linked
-executables, you say! Use @command{bsdiff}/@command{bspatch}!
+executables, you say! Use either @command{bsdiff}/@command{bspatch} or
+@command{zstd --patch-from}!
 
 It is created exclusively to drive my own websites, but if you are
 interested, then @code{git clone git://git.stargrave.org/godlighty.git} it.
index 325444f1cab6a6c399bed8e68b8cb3aec271e13a..7d56c114168e3a1a9a4190d39a95edf2523f4d80 100755 (executable)
@@ -10,26 +10,26 @@ mkdir -p updates
     mv $w updates/$w.old
     exit
 }
-bsdiff updates/$w.old $w updates/$w.bsdiff
+zstd -19 --patch-from updates/$w.old -o updates/$w.patch.zst $w
 mv updates/$w.old updates/$w.older
 mv $w updates/$w.old
-cat > updates/$w-update.sh <<EOF
+cat >updates/$w-update.sh <<EOF
 #!/bin/sh -ex
 w=\$1
 [ -n "\$w" ]
-their_hash=\`sha512 < \$w\`
-our_hash=`sha512 < updates/$w.older`
+their_hash=\`sha512 <\$w\`
+our_hash=`sha512 <updates/$w.older`
 [ "\$their_hash" = "\$our_hash" ]
-b64decode -o \$w.bsdiff < \$0
-bspatch \$w \$w.new \$w.bsdiff
-their_hash=\`sha512 < \$w.new\`
-our_hash=`sha512 < updates/$w.old`
+b64decode -o \$w.patch.zst <\$0
+zstd -d -D \$w -o \$w.new \$w.patch.zst
+their_hash=\`sha512 <\$w.new\`
+our_hash=`sha512 <updates/$w.old`
 [ "\$their_hash" = "\$our_hash" ]
 chown \`stat -f %u:%g \$w\` \$w.new
 chmod \`stat -f %Mp%Lp \$w\` \$w.new
-rm \$w.bsdiff
+rm \$w.patch.zst
 mv -f \$w.new \$w
 exit
 EOF
-b64encode updates/$w.bsdiff < updates/$w.bsdiff >> updates/$w-update.sh
+b64encode updates/$w.patch.zst <updates/$w.patch.zst >>updates/$w-update.sh
 chmod +x updates/$w-update.sh