Simplification of version update
When you click the "update" icon on the desktop, there is a check to see if there is a later version of EasyOS online. If yes, then there is a check to see if there is a delta file, which looks like "easy-7.5-amd64.img___easy-7.5.1-amd64.img.delta"; if so, then the delta file is downloaded, instead of the full "easy-7.5.1-amd64.img", which is about 1.1GB.
However, ibiblio.org has an rsync server, and rsync has the ability to generate a delta-difference between an online file and a local file. This will do it:
rsync --progress -av rsync.ibiblio.org::easyos/amd64/releases/excalibur/7.5.2/easy-7.5.2-amd64.img ./easy-7.5.1-amd64.img
rsync is very clever, it will figure out a delta difference and only download that, so instead of 1.1Gb, the download will be considerably smaller, say about 200MB, depending on how different the online and local files are.
Doing away with delta files and using rsync results in a huge simplification of the download scripts. This is part of /usr/local/easy_version/easy-update:
#20261110
#find out if any .img, delete any others...
LASTIMG="$(ls -1 easy-*.img 2>/dev/null | sort -V -t "-" -k 2,2 | tail -n 1)"
if [ -n "$LASTIMG" ];then
mv -f ${LASTIMG} XXX${LASTIMG}
rm -f easy-*.img 2>/dev/null #get rid of any others.
rm -f ${DISTRO_NAME_SHORT,,}-*.img 2>/dev/null #20230305
sync
mv -f XXX${LASTIMG} ${LASTIMG}
else
#create a temporary img file...
echo
echo -en '\033[1;35m' #bright magenta
echo "$(gettext 'Creating a temporary .img file...')"
echo -en '\033[0;39m' #reset.
/usr/local/easy_version/create-temp-img
#...creates /mnt/wkg/easy-temp.img
LASTIMG='easy-temp.img'
fi
#20261110 now use rsync to download...
echo
echo -en '\033[1;35m' #bright magenta
echo "$(gettext 'Downloading') ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img ..."
echo -en '\033[0;39m' #reset.
rsync --progress -av rsync.ibiblio.org::easyos/${DISTRO_TARGETARCH}/releases/excalibur/${DISTRO_VERSION}/easy-${latestVER}-${DISTRO_TARGETARCH}.img ./${LASTIMG}
if [ $? -eq 0 ];then
mv -f ${LASTIMG} easy-${latestVER}-${DISTRO_TARGETARCH}.img
else
#fail.
echo
echo -en '\033[1;31m' #bright red.
echo "$(gettext 'Something went wrong with the download. Aborting')"
echo -en '\033[0;39m' #reset.
rm -rf ./.cache 2>/dev/null
echo -e "\033[1;31m${MSGexit}\033[0;39m"
exit 9
fi
There is also /usr/local/easy_version/easy-update-devx that does the same thing.
Notice in the above code, there is a call to /usr/local/easy_version/create-temp-img. This is a new script that will create a .img file, by grabbing vmlinuz, initrd and easy*.sfs, so initially it won't matter if you haven't got a .img file at /mnt/wkg, one will be created. Then rsync will do the delta thing to create the .img of the latest version.
It is a real neat mechanism, very simple. From the user's point
of view, there is less to think about, you don't even need to keep
a /mnt/wkg/easy-<version>-amd64.img, as it will get
auto-generated if not there.
Tags: easy