Skip to content

Commit

Permalink
support replace easy-*.img with new name
Browse files Browse the repository at this point in the history
  • Loading branch information
bkauler committed Mar 5, 2023
1 parent f331826 commit 8b553bd
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 76 deletions.
68 changes: 35 additions & 33 deletions easyos/easy-code/3buildeasydistro
Expand Up @@ -289,7 +289,7 @@
#20230222 major rethink /usr/share/locale.in only exist in rootfs-skeleton. fix applications.in
#20230224 merge applications.in into applications 20230225 fix. 20230226 fix.
#20230304 support distro name other than "EasyOS" and "Easy".
#20230305 tweaks. replace "easy.sfs"
#20230305 tweaks. support rename "easy.sfs". support "easy-*.img" rename.

export LANG=C #faster.

Expand Down Expand Up @@ -567,6 +567,19 @@ else
SKELETON_NAME="${DISTRO_SKELETON_IMAGE%.img}"
fi

#20230305 rename "easy-..."
if [ "${DISTRO_NAME_SHORT,,}" != "easy" ];then
oldSKEL="$SKELETON_NAME"
SKELETON_NAME="$(echo -n "$oldSKEL" | sed -e "s%^easy%${DISTRO_NAME_SHORT,,}%")"
mv -f sandbox3/${oldSKEL}.img sandbox3/${SKELETON_NAME}.img
if [ "${DISTRO_SKELETON_IMAGE/*.img./}" == "gz" ];then
DISTRO_SKELETON_IMAGE="${SKELETON_NAME}.img.gz"
else
DISTRO_SKELETON_IMAGE="${SKELETON_NAME}.img"
fi
#also fix DISTRO_SKELETON_IMAGE in rootfs-complete/etc/DISTRO_SPECS, see below
fi

#20220511 detect sizes of partitions in img... 20220622
PARTINFO="$(fdisk -l ${SKELETON_NAME}.img | grep '^easy-skeleton' | grep -o ' [0-9].*')" #ex: 1572864 1581055 8192 4M 83 Linux
P1M="$(echo "$PARTINFO" | grep -o '[0-9]*M' | head -n 1)"
Expand Down Expand Up @@ -1567,6 +1580,15 @@ if [ "$DISTRO_NAME_SHORT" != "Easy" ];then
echo
fi

#20230305 DISTRO_SKELETON_IMAGE name got modified above, update in DISTRO_SPECS...
if [ "$DISTRO_NAME_SHORT" != "Easy" ];then
sed -i -e "s%^DISTRO_SKELETON_IMAGE=.*%DISTRO_SKELETON_IMAGE='${DISTRO_SKELETON_IMAGE}'%" rootfs-complete/etc/DISTRO_SPECS
#also, update mime db for easy-*.img renamed to ${DISTRO_NAME_SHORT,,}-*.img
sed -i -e "s%<glob pattern=\"easy\-\*\.img\"%<glob pattern=\"${DISTRO_NAME_SHORT,,}-*.img\"/>\n <glob pattern=\"easy-*.img\"%" rootfs-complete/usr/share/mime/packages/puppy.xml
#note, update-mime-database is run further down...
fi



cd .. #20230111

Expand Down Expand Up @@ -6010,48 +6032,28 @@ if [ "$WOOF_TARGETARCH" == "x86" ];then #20220801
sync
fi

#200929 more meaningful to change easy- to easy-${DISTRO_COMPAT_VERSION}- 20201117 revert...

[ -f easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img ] && rm -f easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img
[ -f easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img.gz ] && rm -f easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img.gz
[ -f easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img ] && rm -f easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img #190112
[ -f easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img.gz ] && rm -f easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img.gz #190112
#20230305 easy-*.img rename to ${DISTRO_NAME_SHORT,,}-*.img ...
[ -f ${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img ] && rm -f ${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img

#20220512 do not compress...
if [ "$DEFAULTLANG1" == "en" ];then #190107
mv -f ${SKELETON_NAME}.img easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img
md5sum easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img > md5sum-en.txt
sync
echo "easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img has been created..."
# #200727 "--rsyncable" to make downloads with rsync more efficient...
# gzip --rsyncable easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img
# sync
echo
echo "easy-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img has been created. this may be written to"
echo "any flash-stick or sd-card, 8GB or greater. 16GB minimum recommended."
else
mv -f ${SKELETON_NAME}.img easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img
md5sum easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img > md5sum-${DEFAULTLANG1}.txt
sync
echo "easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img has been created..."
# gzip --rsyncable easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img #200727
# sync
# echo
echo "easy-${DISTRO_VERSION}-${DEFAULTLANG1}-${DISTRO_TARGETARCH}.img has been created. this may be written to"
echo "any flash-stick or sd-card, 2GB or greater. 4GB minimum recommended."
fi
mv -f ${SKELETON_NAME}.img ${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img
md5sum ${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img > md5sum-en.txt
sync
echo "${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img has been created..."
echo
echo "${DISTRO_NAME_SHORT,,}-${DISTRO_VERSION}-${DISTRO_TARGETARCH}.img has been created. this may be written to"
echo "any flash-stick or sd-card, 8GB or greater. 16GB minimum recommended."

[ "${DEFAULTLANG/_*/}" != "en" ] && exit #20220624 moved up.

#20220623 create .delta files. 20220624 fix.
#20220623 create .delta files. 20220624 fix. 20230305 also check for old easy-*.img
#format: oldimg___latestimg.delta
#need to find all prior version .img files. um, maybe just do the previous version...
echo "Creating delta files:"
rm -rf deltas 2>/dev/null
mkdir -p deltas
xDISTRO_VERSION="$(echo -n "$DISTRO_VERSION" | sed -e 's%\.%\\.%g')"
NEWIMGS="$(find . -mindepth 1 -maxdepth 1 -type f -name 'easy-*.img' | grep "\-${xDISTRO_VERSION}\-" | tr '\n' ' ')"
OLDIMGS="$(find . -mindepth 1 -maxdepth 1 -type f -name 'easy-*.img' | grep -v "\-${xDISTRO_VERSION}\-" | tr '\n' ' ')"
NEWIMGS="$(find . -mindepth 1 -maxdepth 1 -type f -name '${DISTRO_NAME_SHORT,,}-*.img' | grep "\-${xDISTRO_VERSION}\-" | tr '\n' ' ')"
OLDIMGS="$(find . -mindepth 1 -maxdepth 1 -type f -name '${DISTRO_NAME_SHORT,,}-*.img' -o -name 'easy-*.img' | grep -v "\-${xDISTRO_VERSION}\-" | tr '\n' ' ')"
for aNEW in $NEWIMGS
do
aNEW="${aNEW#./}"
Expand Down
77 changes: 44 additions & 33 deletions easyos/easy-code/rootfs-skeleton/usr/local/easy_version/easy-update
Expand Up @@ -29,6 +29,7 @@
#20220628 check md5sum of local image file. 20220629
#20220728 remove .delta after update.
#20230221 no longer have language-specific .img files.
#20230305 easy-*.img may have a different name. note: "easy.sfs" changed in 3buildeasydistro

export TEXTDOMAIN=easy-update
export OUTPUT_CHARSET=UTF-8
Expand All @@ -44,6 +45,10 @@ PARENT="${$}"
. /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION DISTRO_TARGETARCH
. /root/.packages/DISTRO_PET_REPOS #has PET_REPOS, PACKAGELISTS_PET_ORDER, SFS_REPOS

if [ ! "$DISTRO_NAME_SHORT" ];then #20230305 test if not defined in DISTRO_SPECS
DISTRO_NAME_SHORT='Easy'
fi

if [ -d /boot/device-tree ];then #20220621 rpi
#this is a hack...
BOOT_DEV="${WKG_DEV%%[1-9]}1"
Expand Down Expand Up @@ -174,20 +179,20 @@ echo
#get rid of any old compressed...
rm -f easy-*.img.gz 2>/dev/null

#see if already downloaded new version...
#see if already downloaded new version... 20230305
askdl='download'
HAVEDELTA='no'
if [ -f easy-${latestVER}-${DISTRO_TARGETARCH}.img ];then
if [ -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img ];then
sync
mv -f easy-${latestVER}-${DISTRO_TARGETARCH}.img XXXeasy-${latestVER}-${DISTRO_TARGETARCH}.img
rm -f easy-*.img 2>/dev/null #get rid of any others.
mv -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img XXX${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img
rm -f ${DISTRO_NAME_SHORT,,}-*.img 2>/dev/null #get rid of any others.
sync
mv -f XXXeasy-${latestVER}-${DISTRO_TARGETARCH}.img easy-${latestVER}-${DISTRO_TARGETARCH}.img
mv -f XXX${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img

echo
echo -en '\033[1;35m' #bright magenta
echo "$(gettext 'The latest image file has already been downloaded:')"
echo " easy-${latestVER}-${DISTRO_TARGETARCH}.img"
echo " ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img"
echo "$(gettext 'Do you want to install it, or re-download it?')"
echo -n "$(gettext 'Press ENTER only to install, any other char to re-download:')"
echo -en '\033[0;39m' #reset.
Expand All @@ -196,23 +201,28 @@ if [ -f easy-${latestVER}-${DISTRO_TARGETARCH}.img ];then
echo " $(gettext '...have chosen to install existing image file')"
else
echo " $(gettext '...have chosen to erase the image file and re-download it')"
rm -f easy-${latestVER}-${DISTRO_TARGETARCH}.img
rm -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img
fi
else #20220623
#rm -f easy-*.img 2>/dev/null #get rid of any others.
#20220623 no, keep latest version, maybe there is a .delta online
LASTIMG="$(ls -1 easy-*.img 2>/dev/null | sort -V -t "-" | tail -n 1)"
#sortedVERS="$(echo "$VERS" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n)" #lowest to highest. or, could use full sort "-V" option.
#latestVER="$(echo "$sortedVERS" | tail -n 1)"
# ...nah, using sort -V
if [ "${DISTRO_NAME_SHORT}" == "Easy" ];then #20230305
LASTIMG="$(ls -1 easy-*.img 2>/dev/null | sort -V -t "-" | tail -n 1)"
else
LASTIMG="$(ls -1 easy-*.img ${DISTRO_NAME_SHORT,,}-*.img 2>/dev/null | sort -V -t "-" -k 2,2 | tail -n 1)"
fi
if [ "$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}
echo "$(gettext 'You have this local file:') ${LASTIMG}"
echo "$(gettext 'Looking online to see if a delta file exists...')"
wget -4 -S --spider https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/deltas/${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta > /tmp/easy-update-delta-probe 2>&1
wget -4 -S --spider https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/deltas/${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta > /tmp/easy-update-delta-probe 2>&1
grep -q 'HTTP/1\.1 200 OK' /tmp/easy-update-delta-probe
if [ $? -ne 0 ];then
echo " $(gettext '...no it does not. will have to download full-size latest version.')"
Expand Down Expand Up @@ -276,11 +286,11 @@ if [ "$HAVEDELTA" == "yes" ];then
exit 9
fi

rm -f ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
download_file https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/deltas/${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta
rm -f ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
download_file https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/deltas/${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta
RET=$?
if [ $RET -eq 0 ];then
MD5SUM="$(md5sum ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta | cut -f 1 -d ' ')"
MD5SUM="$(md5sum ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta | cut -f 1 -d ' ')"
grep -q "$MD5SUM" md5sums.txt
if [ $? -ne 0 ];then
rm -f md5sums.txt 2>/dev/null
Expand All @@ -292,38 +302,38 @@ if [ "$HAVEDELTA" == "yes" ];then
echo "$(gettext 'Something went wrong with the download. Aborting')"
echo -en '\033[0;39m' #reset.
rm -f md5sums.txt 2>/dev/null
rm -f ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
rm -f ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
rm -rf ./.cache 2>/dev/null
echo -e "\033[1;31m${MSGexit}\033[0;39m"
exit 9
fi
sync
chown root:root ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta
chown root:root ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta
echo "$(gettext 'Download successful, generating the latest image file...')"
xdelta3 -d -s ${LASTIMG} ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta easy-${latestVER}-${DISTRO_TARGETARCH}.img
xdelta3 -d -s ${LASTIMG} ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img
if [ $? -ne 0 ];then
echo -en '\033[1;31m' #bright red.
echo "$(gettext 'Something went wrong. Maybe the .delta file is corrupted. Aborting.')"
echo -en '\033[0;39m' #reset.
rm -f md5sums.txt 2>/dev/null
rm -f ${LASTIMG}___easy-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
rm -f easy-${latestVER}-${DISTRO_TARGETARCH}.img 2>/dev/null
rm -f ${LASTIMG}___${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img.delta 2>/dev/null
rm -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img 2>/dev/null
rm -rf ./.cache 2>/dev/null
echo -e "\033[1;31m${MSGexit}\033[0;39m"
exit 9
else
echo "$(gettext 'Yippee, the new image file has been generated!')"
echo
rm -f md5sums.txt 2>/dev/null
md5sum easy-${latestVER}-${DISTRO_TARGETARCH}.img > md5sum.txt
md5sum ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img > md5sum.txt
fi
fi

if [ "$askdl" != "" ];then
#download latest, full-size image file...
echo
echo -en '\033[1;35m' #bright magenta
echo "$(gettext 'Downloading') easy-${latestVER}-${DISTRO_TARGETARCH}.img ..."
echo "$(gettext 'Downloading') ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img ..."
echo -en '\033[0;39m' #reset.

#20220625 get md5sum... 20230221
Expand All @@ -338,11 +348,11 @@ if [ "$askdl" != "" ];then
echo -e "\033[1;31m${MSGexit}\033[0;39m"
exit 9
fi
download_file https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/easy-${latestVER}-${DISTRO_TARGETARCH}.img
download_file https://distro.ibiblio.org/easyos/${DISTRO_TARGETARCH}/releases/${DISTRO_COMPAT_VERSION}${DEEPER}/${YEAR}/${latestVER}/${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img
RETVAL=$?

if [ $RETVAL -eq 0 ];then #20220625
MD5SUM="$(md5sum easy-${latestVER}-${DISTRO_TARGETARCH}.img | cut -f 1 -d ' ')"
MD5SUM="$(md5sum ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img | cut -f 1 -d ' ')"
grep -q "$MD5SUM" md5sum.txt
if [ $? -ne 0 ];then
rm -f md5sum.txt 2>/dev/null
Expand All @@ -354,7 +364,7 @@ if [ "$askdl" != "" ];then
echo -en '\033[1;31m' #bright red.
echo "$(gettext 'Something went wrong with the download. Aborting')"
echo -en '\033[0;39m' #reset.
rm -f easy-${latestVER}-${DISTRO_TARGETARCH}.img 2>/dev/null #20220512 only remove aborted update .img
rm -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img 2>/dev/null #20220512 only remove aborted update .img
rm -rf ./.cache 2>/dev/null
rm -f md5sum.txt 2>/dev/null
echo -e "\033[1;31m${MSGexit}\033[0;39m"
Expand All @@ -363,12 +373,12 @@ if [ "$askdl" != "" ];then
fi

#20210425 fedora: has strange group:owner
chown root:root /mnt/${WKG_DEV}/${WKG_DIR}easy-${latestVER}-${DISTRO_TARGETARCH}.img
chown root:root /mnt/${WKG_DEV}/${WKG_DIR}${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img

#offer to install...
echo -en '\033[1;35m' #bright magenta
echo "$(gettext 'This file has been downloaded:')"
echo "/mnt/${WKG_DEV}/${WKG_DIR}easy-${latestVER}-${DISTRO_TARGETARCH}.img"
echo "/mnt/${WKG_DEV}/${WKG_DIR}${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img"
if [ "$KERNAME" == "kernel8.img" ];then #20210125 rpi 20210701
echo "$(gettext 'You may do a manual update, by clicking on the file to open it up, drag kernel8.img, initrd and the device-tree files to the boot-partition, and easy.sfs to the working-partition, then click on initrd to fix the BOOT_SPECS file. These steps are documented online.')" | fold -s -w ${COLUMNS}
else
Expand All @@ -393,7 +403,7 @@ echo -en '\033[0;39m' #reset.
sync

rm -rf /tmp/mount-img-* 2>/dev/null
mount-img easy-${latestVER}-${DISTRO_TARGETARCH}.img quiet
mount-img ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img quiet
CNT=$? #number of partitions mounted.
#...should have folders /tmp/mount-img-${CNT}-${aFS}-${LOOPn##*/}
# /tmp/mount-img-1-vfat-loop<n> and /tmp/mount-img-2-ext4-loop<m>
Expand All @@ -418,7 +428,7 @@ if [ $CNT -ne 2 ];then
CNT=$(($CNT+1))
done

rm -f easy-${latestVER}-${DISTRO_TARGETARCH}.img
rm -f ${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img
echo -e "\033[1;31m${MSGexit}\033[0;39m"
exit 11
fi
Expand Down Expand Up @@ -455,11 +465,11 @@ while [ 1 ];do #200826 sanity checks...
sync
busybox cmp -s ${MNTPT2}/easyos/initrd /mnt/${WKG_DEV}/${WKG_DIR}initrd
if [ $? -eq 0 ];then
echo -n ' easy.sfs PLEASE WAIT...'
cp -a -f ${MNTPT2}/easyos/easy.sfs /mnt/${WKG_DEV}/${WKG_DIR}
echo -n ' easy.sfs PLEASE WAIT...' #note 3buidleasydistro substitutes easy.sfs
cp -a -f ${MNTPT2}/easyos/${DISTRO_NAME_SHORT,,}.sfs /mnt/${WKG_DEV}/${WKG_DIR}
sync
busybox cmp -s ${MNTPT2}/easyos/easy.sfs /mnt/${WKG_DEV}/${WKG_DIR}easy.sfs
[ $? -ne 0 ] && FAILED='easy.sfs'
busybox cmp -s ${MNTPT2}/easyos/${DISTRO_NAME_SHORT,,}.sfs /mnt/${WKG_DEV}/${WKG_DIR}${DISTRO_NAME_SHORT,,}.sfs
[ $? -ne 0 ] && FAILED="easy.sfs"
else
FAILED='initrd'
fi
Expand Down Expand Up @@ -501,7 +511,7 @@ if [ -d /boot/device-tree ];then #20210125 rpi
echo "$(gettext 'The new easy.sfs has the latest device-tree files in it, extracting and copying them to the boot partition...')" | fold -s -w ${COLUMNS}
echo -en '\033[0;39m' #reset.
mkdir mntpt2
busybox mount -t squashfs -o loop,ro /mnt/${WKG_DEV}/${WKG_DIR}easy.sfs mntpt2
busybox mount -t squashfs -o loop,ro /mnt/${WKG_DEV}/${WKG_DIR}${DISTRO_NAME_SHORT,,}.sfs mntpt2
if [ -d mntpt2/boot/device-tree ];then
cp -a -f mntpt2/boot/device-tree/* /mnt/${BOOT_DEV}/${BOOT_DIR}
fi
Expand All @@ -518,6 +528,7 @@ fi

#20220728 remove .delta file...
rm -f easy*.delta 2>/dev/null
rm -f ${DISTRO_NAME_SHORT,,}*.delta 2>/dev/null

#maybe unmount boot-partition... for rpi4
[ $BOOTflg -eq 1 ] && umount /mnt/${BOOT_DEV}
Expand All @@ -534,15 +545,15 @@ if [ "$KERNAME" == "kernel8.img" ];then
else
echo "$(gettext 'Which has the new files vmlinuz and initrd')"
fi
echo "$(gettext 'Which has the new file easy.sfs')"
echo "$(gettext ' and has the new file easy.sfs')"
echo "$(gettext 'The new version will be:') ${latestVER}"
echo -n "$(gettext 'All that you have to do is reboot!')"
echo -e '\033[0;39m\033[49m' #reset. 20211221

echo
echo -en '\033[1;34m' #blue
echo "$(gettext 'This is the downloaded file:')"
echo "/mnt/${WKG_DEV}/${WKG_DIR}easy-${latestVER}-${DISTRO_TARGETARCH}.img"
echo "/mnt/${WKG_DEV}/${WKG_DIR}${DISTRO_NAME_SHORT,,}-${latestVER}-${DISTRO_TARGETARCH}.img"
echo "$(gettext 'It is not needed anymore. You can delete it or archive it somewhere.')"
echo "$(gettext 'However, at the next update, this file can be used for a smaller difference-file download, so recommend leave it where it is.')" | fold -s -w ${COLUMNS}
echo
Expand Down
10 changes: 8 additions & 2 deletions easyos/easy-code/rootfs-skeleton/usr/sbin/filemnt
Expand Up @@ -26,10 +26,16 @@
# see /etc/xdg/rox.sourceforge.net/MIME-types/application_easy-disk-image
# see /usr/sbin/build-rox-sendto, /usr/share/applications/mount-img.desktop
#20220624 easy*.img, call mount-img
#20230305 easy-*.img may have a different name.

. /etc/DISTRO_SPECS #20230305
if [ ! "$DISTRO_NAME_SHORT" ];then
DISTRO_NAME_SHORT='Easy'
fi

imgFile="$1"
case "${imgFile##*/}" in #20220624
easy-*.img)
case "${imgFile##*/}" in #20220624 20230305
${DISTRO_NAME_SHORT,,}-*.img)
exec mount-img "$1"
;;
esac
Expand Down
Expand Up @@ -95,11 +95,3 @@

</mime-info>









0 comments on commit 8b553bd

Please sign in to comment.