summaryrefslogtreecommitdiffstats
path: root/src/utils/legacy.py
Commit message (Collapse)AuthorAgeFilesLines
* utils: remove repository change in restoreImageCustomOpenGnSys Support Team2024-02-151-4/+0
| | | | this is broken, it uses default uses and password, remove it.
* src: ogChangeRepo returns zero on success and -1 on errorOpenGnSys Support Team2024-02-151-7/+10
| | | | | | | | | | | | | | | | | | | | do not return the returncode, instead return an integer. do not use except CalledProcessError as e: it causes a another exception while handling exception. Remount the original image repository. it should be possible to simplify this further by: - stacking mounts, no need to umount initial repo and mount it again when switching to the new repo, because remount back initial repo might fail (!) - use check=False and simply check for x.returncode
* src: improve error check in image_create and image_restoreAlejandro Sirgo Rica2024-02-141-5/+5
| | | | | | | | | cover more error cases where exceptions need to be raised. check return code in the invoked subprocess. restoreImageCustom has been intentionally left behind, it is unclear what this custom script returns on success and error.
* utils: use f-string in raise ValueError in run_lzop_partcloneinfo()OpenGnSys Support Team2023-12-151-1/+1
| | | | | | Otherwise it shows: ValueError: Unable to process image {image_path}
* live: report permissions and last update when creating imagev1.3.2-3OpenGnSys Support Team2023-12-121-0/+2
| | | | add .permissions and .lastupdate to json to report to ogserver.
* live: report image size when creating imageOpenGnSys Support Team2023-12-121-0/+1
| | | | add .size json field to report the real size of the image file.
* src: add missing copyright noticesv1.2.8Jose M. Guisado2023-04-181-0/+8
|
* legacy: improve readability of ogGetImageInfo helper functionsJose M. Guisado2023-03-101-14/+13
| | | | | | | | | | | | | | | | | | | | Change the name of the helper functions used when getting opengnsys image information (legacy ogGetImageInfo bash script). As of now the process consist of decompressing the image file with lzop and feeding that output to partclone.info. Prefer a more explicit function name rather than "process_image_*" Add comment about skipping the first two lines of partclone.info output. Usually, partclone.info starts printing out these two lines that are not related to the partclone image information: Partclone v0.3.23 http://partclone.org Showing info of image (-) As long as partclone.info output doesn't change we'll be fine, but we should not depend on human readable output. This might change in the future (i.e. adding json output format to partclone.info).
* legacy: rewrite ogGetImageInfoJose M. Guisado2023-03-021-14/+104
| | | | | | | | | | | | | | | | | | | | Rewrites this legacy script behavior using native Python code, using subprocess module when executing programs like partclone.info or lzop ogGetImageInfo is a bash script that retrieves information regarding an OpenGnsys partition image, specifically: - clonator - compressor - filesystem - datasize (size of the partition image) This rewrite only supports partclone and lzop compressed images. This is standard behavior, we have no reports of other programs or compression algorithms in use. Keep this legacy function with hungarian notation to emphasize this is still a legacy component that may be replaced in the future.
* legacy: rewrite ogChangeRepoJose M. Guisado2023-03-021-6/+52
| | | | | | | | | | | | | | | | Drop ogChangeRepo Bash script in favor of a native Python approach. Use only necessary subprocess calls instead of bringing all the logic of this function into a Bash script black box. ogChangeRepo unmounts the current OpenGnsys image samba folder (/opt/opengnsys/images) and mounts (connects to) a new directory using the new provided ip address. Keeping access mode from previous mount. If anything goes wrong when mounting the new directory, it will fallback to mounting the previous directory. If no previous OpenGnsys image samba directory is detected, this functions tries to mount the new directory anyway. In this case, it will raise CalledProcessError if something goes wrong.
* legacy: improve readability of cambiar_accessoJose M. Guisado2023-03-021-10/+10
| | | | | Expand function docstring and do not use CalledProcessError handling to return True or False. Just checking for returncode value is simpler.
* live: rewrite image_restoreJose M. Guisado2022-09-141-0/+46
| | | | | | | | Integrates image restore command into native ogClient code. Further reduces the need for external Bash scripts. After a succesful image restore, OS configuration is still using external Bash script "osConfigure/osConfigureCustom".
* image_restore: fix ogCopyEfiBootLoaderJose M. Guisado2022-09-141-3/+4
| | | | | | | | | ogCopyEfiBootloader is an invalid legacy bash function name. Rename to the correct function name 'ogCopyEfiBootLoader' and rename utility python wrapper too. Fixes: 0bd037c1a409c65fbcb01355ee0dd6dca770330e
* image_create: add legacy ogCopyEfiBootloaderJose M. Guisado2022-09-141-0/+10
| | | | | | | | | | | | | | Use legacy script that saves the Windows-specific content from the ESP to the image target filesystem. Current image restore solution from OpenGnsys scripts expect the EFI partition to be stored in the target system partition. (Only for Windows 10) For example, storing the ESP in the NTFS partition of a Windows image. Expect use of bash script ogCopyEfiBootloader until further integration is merged.
* image_create: partial integration into pythonv1.2.2Jose M. Guisado2022-08-241-0/+55
Integrates some parts of this operation into native code, eg: the md5 checksum computation. Wraps non native processes and commands using the subprocess module. For example, legacy.py stores bash commands pending integration. Supports python >=3.6, expected until more modern ogLives are put into production environments.