How Magic Wand Works

- On
boot and if enabled in the fullcount config file, the fullcount-checkforupdates.service
runs update_checker.sh, which pulls down the latest current_release
file and updateos.sh script.
- update_checker.sh checks
whether FCCURRENT in current_release is higher than the
running OS version found in /etc/FC-release.
- If it
is a higher version, it downloads the new squashfs based on the device_name
file's DEVICE variable.
- It
checks the SHA1 variable from the current_release file
against the actual SHA1 of the downloaded squashfs, and if they
match, it writes a file that flags posapp into generating the user-invoked
update button in the Support Drawer.

- Once a
new image is downloaded, and a user is ready to update via the Support
Drawer button (or FC_OS_UPDATE_FORCE is enabled), the updateos.sh
script starts.
- First
it finds the active partition and volume group. If it is a first-time
update, it creates a new partition of 30GB (and expands the original to
30GB), and if it is a subsequent update, it selects the inactive partition
as the target.
- Next,
the script unzips the squashfs to extract the .raw filesystem which
already contains its own LVM volume group.
- It
then copies the new .raw filesystem to the new partition and imports the
new volume group and activates it.
- Next,
the script mounts the new operating system, updates the fstab, copies
system files (config file, NetworkManager settings, product model, serial
number) to the new OS.
- Then,
it extracts and generates the new GRUB entry name from the squashfs
installer file, rebuilds GRUB using commands from the new OS, adjusts the
Boot Order and adds the fallback entry.
- Finally,
it removes the update entry that notified posapp to generate the update
button, extends/resizes the filesystem, disables the update service on the
old OS (to pervent a boot-loop scenario where the old OS loads and FC_OS_UPDATE_FORCE
is enabled), and reboots into the new OS.
If there is a problem for whatever reason, the old version
of the OS will remain as a fallback that is available to boot into by attaching
a keyboard and selecting the "Fullcount Terminal XXXXX Previous
(Fallback)" option on the GRUB screen. This will not persist on reboot
unless GRUB gets rebuilt on that OS.

Creating a Compatible Squashfs Update File
- Create
a new .iso using Kiwi
- Copy
the .iso to a Windows machine.
- Right-click
on the .iso and select Mount. A new window will appear showing the
contents of the .iso image.
- Inside
the image, a file with a .squashfs extension will exist. Drag the
.squashfs to a directory onto the Windows machine.
- The
image file will need to be renamed. For exmple, fullcount-terminal-a5term.raw.squashfs
will need to be renamed to fullcount-terminal-a5term.x86_64-7.5.0.install.squashfs.
Same name as the .iso, but with a squashfs extension instead.
- Copy
the new squashfs to
updatesprod0X.fullcount.net/srv/www/htdocs/updates.fullcount.net/osupdater/DEVICENAME
- Get
the SHA1 with
'sha1sum fullcount-terminal-DEVICENAME.x86_64-7.5.0.install.squashfs'
- Copy
the SHA1 and edit the current_release file to include the
new SHA1. Also update the FCCURRENT variable to match the new
image
Example below:
updatesprod02:/srv/www/htdocs/updates.fullcount.net/osupdater/a5term
# cat current_release
FCCURRENT=7.6.0
INSTALLER=fullcount-terminal-a5term.x86_64-${FCCURRENT}.install.squashfs
SHA1=e33a3eaa0ea48fe610a02a3732fc1e256677e167
Known Issues:
1. Occasionally, an update can change the boot order to an
incorrect one, where the UEFI boot menu entry is below the non-UEFI boot
option. To fix this, connect a keyboard, enter the BIOS, navigate to the BOOT
tab, and bump the UEFI hard disk option to Boot Option #1.