Skip to content

Commit

Permalink
Fix preupdate wallpaper
Browse files Browse the repository at this point in the history
  • Loading branch information
procount committed May 10, 2024
1 parent fc0913c commit aa11679
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 33 deletions.
27 changes: 14 additions & 13 deletions recovery/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4635,19 +4635,6 @@ int MainWindow::updatePinn()
//First we'll extract these 2 files to /tmp to automate hte update process
readexec(1,"unzip /tmp/pinn-lite.zip -o exclude.txt updatepinn preupdate -d /tmp",dummy);

if (QFile::exists("/tmp/exclude.txt"))
{
//exclude.txt can avoid extracting addtional files to RECOVERY that we don't want updating
QString contents = getFileContents("/tmp/exclude.txt");
QStringList fileList = contents.split("\n");
foreach (QString file, fileList)
{
//Add each filename to the list of file extraction exclusios
file=file.trimmed();
if (file.length()>0)
exclusions += " -x "+file;
}
}

//Save the existing installation in case of failure
if (_qpdup)
Expand All @@ -4669,6 +4656,20 @@ int MainWindow::updatePinn()
}
if (!error)
{

if (QFile::exists("/tmp/exclude.txt"))
{
//exclude.txt can avoid extracting addtional files to RECOVERY that we don't want updating
QString contents = getFileContents("/tmp/exclude.txt");
QStringList fileList = contents.split("\n");
foreach (QString file, fileList)
{
//Add each filename to the list of file extraction exclusios
file=file.trimmed();
if (file.length()>0)
exclusions += " -x "+file;
}
}
//Extract all the files to Recovery, except our excluded set
if (_qpdup)
((QProgressDialog*)_qpdup)->setLabel( new QLabel(tr("Extracting update")));
Expand Down
30 changes: 10 additions & 20 deletions sdcontent/preupdate
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

set -x
orgsize=65535 # orignal 63M size of Pi4 partition

#get size of the /mnt partition
Expand All @@ -12,6 +13,7 @@ if [ $mntsize -lt $orgsize ]; then
unzip /tmp/pinn-lite.zip wallpaper2.jpg
mv wallpaper2.jpg wallpaper.jpg
echo "wallpaper.jpg" >>/tmp/exclude.txt
sync
fi

if [ -f recovery.rfs ]; then
Expand All @@ -24,39 +26,25 @@ if [ -f recovery.rfs ]; then
mv recovery.img kernel.img
mv recovery7.img kernel7.img
mv recovery7l.img kernel7l.img
mv recovery.cmdline cmdline.txt
mv recovery.cmdline cmdline.txt

rm recovery.rfs
rm changefirmware
rm firmware.tar.gz

fi

#record pertinent configurations to avoid loss of remote connection
vncshare=""
ssh=""
forcetrigger=""

grep "vncshare" cmdline.txt >/dev/null
if [ $? -eq 0 ]; then vncshare="vncshare"; fi

grep "ssh" cmdline.txt >/dev/null
if [ $? -eq 0 ]; then ssh="ssh"; fi

grep "forcetrigger" cmdline.txt >/dev/null
if [ $? -eq 0 ]; then forcetrigger="forcetrigger"; fi


#Backup these configurations, just in case
mv config.txt config.bak
mv cmdline.txt cmdline.bak
cp cmdline.txt cmdline.bak


#Update the new configurations with saved info
unzip -o /tmp/pinn-lite.zip config.txt
unzip -o /tmp/pinn-lite.zip cmdline.txt
read a <cmdline.txt
echo $vncshare $ssh $forcetrigger " " $a >cmdline.txt

#Just change the ramdisk_size
sed -i -e 's|runinstaller||' cmdline.txt
sed -i -e "s|ramdisk_size=32768|ramdisk_size=65536|" cmdline.txt

#Find out how much space we need for unzip
cd /tmp
Expand All @@ -68,6 +56,8 @@ while read a; do
done < /tmp/exclude.txt
pi5minsize=$(expr 1520 + $(unzip -l /tmp/pinn-lite.zip $exclude |tail -n1 | sed 's|\s\+| |g'| sed 's|^ ||' | cut -d ' ' -f 1) / 1024)

sync

if [ $mntsize -lt $pi5minsize ]; then
echo "Partition size Too small"
exit 1
Expand Down

0 comments on commit aa11679

Please sign in to comment.