Commit Graph

27 Commits

Author SHA1 Message Date
Itxaka
88df028e6d
Allow setting root to RW (#53)
This patch allows setting the root mount as RW indicated by setting
rd.cos.debugrw in the cmdline

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-17 09:54:23 +01:00
Itxaka
91d6fa6945 Add version command and fix commit version
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-16 15:43:33 +01:00
Itxaka
ad014e9f22
Full rework (#41)
* Full rework

 - Extract steps to a different file
 - Simplify dag for easy understanding
 - Load dag based on our boot process
 - Simplify steps to not depend on useless stuff
 - Better logging

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Move sentinel file to the dag

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Adapt tests

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-15 22:30:08 +01:00
Itxaka
28e6cfbff8 Do not do anything if rd.cos.disable its on the cmdline
That means we dont want to run any immutable stuff, for netboot and
cdrom

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-15 10:53:48 +01:00
Itxaka
220641df60 Improvements
- Set debug from ENV var as well
 - Only set sentinel if we are not on a dry-run so we can examine the
   DAG
 - Set the DAG with Init so tmpfs is part of it

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 13:48:57 +01:00
Itxaka
3ef3ac0251 Always mount tmpfs
Even on cd boot. Also delay the cdboot check a bit so we can mount tmpfs
also on cdboot

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 12:26:04 +01:00
Itxaka
2aee7ab5a0 Symlink /sysroot/oem to /oem so we can run rootfs stage
Looks like we need to have the oem partition loaded for some cases, and
during rootfs we should pick it up.

Currently we only mount it under /sysroot/oem. IIRC in
cos-immutable-rootfs it was mounted under /oem directly, the rootfs
stage service run and then when cos-layout was launched it made sure to
unmount /oem so it could mount it under /sysroot/oem

In our case its a bit more complicated, we may need to mount it under
/oem before the rootfs run, then unmount it and mount it in the proper
place. Im hoping we can get away with just creating the symlink

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-14 09:51:51 +01:00
Itxaka
076bba95dc Set the sentinel file from immucore directly
Also add a missing livecd sentinel file

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
2023-02-13 21:42:45 +01:00
Itxaka
109c1c745f Several fixes
- Set global debug log
 - Set caller in the log if debug
 - Fatal if cannot get target image
 - clean up slices from cos-layoout.env
 - Add generic log with more context info
 - dump runtime to log on start
 - Set proper default paths if overlay is empty (fixes recovery)
 - Fix ErrAlreadyMounted to not trigger failures

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 15:16:53 +01:00
Itxaka
cf69cffa4b Drop isrecovery from state struct
Only needed in one place, can be made into a function

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-09 08:54:16 +01:00
Itxaka
c5e686883e Significantly drop logging
It was nice when things break all over but its much more stable now.
Lets add logging with head and with proper enrichment of the data being
sent

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 23:27:53 +01:00
Itxaka
f490b08587 Several fixes
- set debug level via cmdline
 - set default RW paths needed ALWAYS to boot a working system, even
   with no config files(recovery)
 - Check for loop device before mounting it to avoid duplicated mounts
 - Force overlay and bind arrays to uniqueness
 - Rename OverlayDir to OverlayDirs to better represent the content

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 22:54:17 +01:00
Itxaka
0bf7b5f760 Check cdboot the first thing
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:58:02 +01:00
Itxaka
99cd455ce8 Fixes recovery
- Add isRecovery to state
 - Get the TargetImage from cmdline
 - Add isrecovery to conditions

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 18:51:53 +01:00
Itxaka
4407bef252 return proper multierror or nil, print dag after execution
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 15:40:18 +01:00
Itxaka
98a2506859 check mount status in mountoperation.run not on bind mountpoint
preparation

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-08 14:43:58 +01:00
Itxaka
f98954367f several improvements
- drop vfs
 - less hardcoded stuff, use the runtime status
 - Remove things that syscalls dont understand (defaults, auto)

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 16:20:18 +01:00
mudler
13e11fca24 Use SDK to get machine state 2023-02-06 14:49:35 +01:00
Itxaka
4ade174057 dont do anything if booting from CD
We leave dracut to do its own thing and mount the CD properly

Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 11:31:46 +01:00
Itxaka
73b3f56af5 move to cli v2
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 09:43:54 +01:00
Itxaka
459f9bf349 Add dry-run flag
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-06 09:37:38 +01:00
Itxaka
8a916f4999 Error handling on dag creation
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-04 11:18:13 +01:00
Itxaka
93ceae89a2 Give a logger to State and add debug logs
Signed-off-by: Itxaka <itxaka@spectrocloud.com>
2023-02-04 10:33:58 +01:00
mudler
d767523565 Add simple test suite 2023-02-02 15:12:33 +01:00
mudler
74fbe7bae2 reorder deps 2023-02-02 14:00:44 +01:00
mudler
de01370653 Reorg flow 2023-02-01 18:01:58 +01:00
mudler
2b6de44b9d Initial import 2023-01-12 19:10:10 +01:00