From 7cfe62cec8d467fcb997bf5e77b8275ccb5b7e9c Mon Sep 17 00:00:00 2001 From: "(Holloway) Chew, Kean Ho" Date: Fri, 21 Jun 2024 17:17:04 +0800 Subject: [PATCH] root: added DOTNET's nupkg implementations Since DOTNET's nupkg is quite simple to create and to upstream, it's best we support it from the start. Besides, the Chocolatey is one of the nupkg implementations so no worries. This patch adds DOTNET's nupkg implementations in root repository. Co-authored-by: Shuralyov, Jean Co-authored-by: Galyna, Cory Co-authored-by: (Holloway) Chew, Kean Ho Signed-off-by: (Holloway) Chew, Kean Ho --- .gitignore | 5 + CONFIG.toml | 377 ++-- automataCI/SECRETS-template.toml | 11 + ...ckage-assemble-default-content_unix-any.sh | 234 +++ ...e-assemble-default-content_windows-any.ps1 | 235 +++ automataCI/_package-archive_unix-any.sh | 480 ++++- automataCI/_package-archive_windows-any.ps1 | 555 ++++- automataCI/_package-cargo_unix-any.sh | 125 -- automataCI/_package-cargo_windows-any.ps1 | 116 -- automataCI/_package-changelog_unix-any.sh | 89 - automataCI/_package-changelog_windows-any.ps1 | 90 - automataCI/_package-chocolatey_unix-any.sh | 151 -- .../_package-chocolatey_windows-any.ps1 | 141 -- automataCI/_package-citation_unix-any.sh | 60 - automataCI/_package-citation_windows-any.ps1 | 60 - automataCI/_package-consolidate_unix-any.sh | 84 + .../_package-consolidate_windows-any.ps1 | 88 + automataCI/_package-homebrew_unix-any.sh | 90 - automataCI/_package-homebrew_windows-any.ps1 | 83 - automataCI/_package-lib_unix-any.sh | 80 - automataCI/_package-lib_windows-any.ps1 | 73 - automataCI/_package-msi_unix-any.sh | 744 ------- automataCI/_package-msi_windows-any.ps1 | 843 -------- automataCI/_package-pdf_unix-any.sh | 80 - automataCI/_package-pdf_windows-any.ps1 | 73 - automataCI/_package-pypi_unix-any.sh | 164 -- automataCI/_package-pypi_windows-any.ps1 | 155 -- automataCI/_package-single_unix-any.sh | 85 + automataCI/_package-single_windows-any.ps1 | 88 + automataCI/_package-sourcing_unix-any.sh | 70 - automataCI/_package-sourcing_windows-any.ps1 | 142 -- automataCI/_package-windows_unix-any.sh | 241 +++ automataCI/_package-windows_windows-any.ps1 | 226 ++ automataCI/_release-checksum_unix-any.sh | 8 + automataCI/_release-citation_unix-any.sh | 4 +- automataCI/_release-citation_windows-any.ps1 | 4 +- automataCI/_release-lib_unix-any.sh | 16 +- automataCI/_release-lib_windows-any.ps1 | 18 +- automataCI/_release-nupkg_unix-any.sh | 56 + automataCI/_release-nupkg_windows-any.ps1 | 60 + automataCI/_release-research_unix-any.sh | 3 +- automataCI/_release-research_windows-any.ps1 | 3 +- automataCI/package_unix-any.sh | 798 +++---- automataCI/package_windows-any.ps1 | 933 +++++---- automataCI/release_unix-any.sh | 7 + automataCI/release_windows-any.ps1 | 6 + automataCI/services/compilers/deb.ps1 | 4 +- automataCI/services/compilers/deb.sh | 6 +- .../hestiaCHANGELOG/Assemble_DEB.sh.ps1 | 254 +++ .../hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1 | 248 +++ .../hestiaCHANGELOG/Assemble_RPM.sh.ps1 | 264 +++ .../services/hestiaCHANGELOG/Vanilla.sh.ps1 | 58 + .../services/hestiaCHOCOLATEY/Install.sh.ps1 | 117 ++ .../hestiaCHOCOLATEY/Is_Available.sh.ps1 | 86 + .../services/hestiaCHOCOLATEY/Vanilla.sh.ps1 | 56 + .../services/hestiaCITATION/Assemble.sh.ps1 | 578 ++++++ .../services/hestiaCITATION/Vanilla.sh.ps1 | 54 + automataCI/services/hestiaCONSOLE/Log.sh.ps1 | 220 ++ .../hestiaCONSOLE/Log_Assemble.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Assemble_Failed.sh.ps1 | 100 + .../Log_Assemble_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Check.sh.ps1 | 96 + .../Log_Check_Availability.sh.ps1 | 98 + .../hestiaCONSOLE/Log_Check_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Check_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Check_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Create.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Create_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Create_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Create_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Merge.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Merge_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Merge_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Merge_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Package.sh.ps1 | 98 + .../hestiaCONSOLE/Log_Package_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Package_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Package_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Publish.sh.ps1 | 98 + .../hestiaCONSOLE/Log_Publish_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Publish_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Publish_Skipped.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Recreate.sh.ps1 | 98 + .../hestiaCONSOLE/Log_Recreate_Failed.sh.ps1 | 100 + .../Log_Recreate_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Run.sh.ps1 | 98 + .../hestiaCONSOLE/Log_Run_Failed.sh.ps1 | 100 + .../hestiaCONSOLE/Log_Run_Simulate.sh.ps1 | 96 + .../hestiaCONSOLE/Log_Run_Skipped.sh.ps1 | 100 + .../services/hestiaCONSOLE/Log_Success.sh.ps1 | 90 + .../services/hestiaCONSOLE/Vanilla.sh.ps1 | 122 ++ .../hestiaCRYPTO/Create_Random_Binary.sh.ps1 | 79 + .../hestiaCRYPTO/Create_Random_Data.sh.ps1 | 165 ++ .../hestiaCRYPTO/Create_Random_Decimal.sh.ps1 | 79 + .../hestiaCRYPTO/Create_Random_Hex.sh.ps1 | 79 + .../hestiaCRYPTO/Create_Random_String.sh.ps1 | 91 + .../hestiaCRYPTO/Create_Random_UUID.sh.ps1 | 169 ++ .../services/hestiaCRYPTO/Vanilla.sh.ps1 | 64 + .../services/hestiaFS/Append_Byte_File.sh.ps1 | 146 ++ .../services/hestiaFS/Append_File.sh.ps1 | 104 + .../services/hestiaFS/Append_Text_File.sh.ps1 | 144 ++ automataCI/services/hestiaFS/Copy.sh.ps1 | 149 ++ .../services/hestiaFS/Copy_Directory.sh.ps1 | 138 ++ automataCI/services/hestiaFS/Copy_File.sh.ps1 | 148 ++ .../services/hestiaFS/Copy_Socket.sh.ps1 | 139 ++ .../hestiaFS/Copy_Symbolic_Link.sh.ps1 | 167 ++ .../services/hestiaFS/Create_Directory.sh.ps1 | 137 ++ .../services/hestiaFS/Get_Directory.sh.ps1 | 97 + automataCI/services/hestiaFS/Get_File.sh.ps1 | 97 + .../hestiaFS/Get_Relative_Path.sh.ps1 | 110 + automataCI/services/hestiaFS/Get_Size.sh.ps1 | 245 +++ .../services/hestiaFS/Is_Directory.sh.ps1 | 107 + .../hestiaFS/Is_Directory_Empty.sh.ps1 | 124 ++ automataCI/services/hestiaFS/Is_Exist.sh.ps1 | 160 ++ automataCI/services/hestiaFS/Is_File.sh.ps1 | 107 + .../services/hestiaFS/Is_Filename_Has.sh.ps1 | 118 ++ automataCI/services/hestiaFS/Is_Socket.sh.ps1 | 94 + .../services/hestiaFS/Is_Symbolic_Link.sh.ps1 | 124 ++ automataCI/services/hestiaFS/List.sh.ps1 | 168 ++ .../hestiaFS/Merge_Directories.sh.ps1 | 179 ++ automataCI/services/hestiaFS/Move.sh.ps1 | 144 ++ .../hestiaFS/Recreate_Directory.sh.ps1 | 122 ++ automataCI/services/hestiaFS/Remove.sh.ps1 | 126 ++ .../hestiaFS/Replace_Extension.sh.ps1 | 190 ++ automataCI/services/hestiaFS/Vanilla.sh.ps1 | 108 + .../services/hestiaFS/Write_Byte_File.sh.ps1 | 140 ++ .../services/hestiaFS/Write_File.sh.ps1 | 104 + .../services/hestiaFS/Write_Text_File.sh.ps1 | 138 ++ .../services/hestiaGIT/Change_Branch.sh.ps1 | 154 ++ automataCI/services/hestiaGIT/Clone.sh.ps1 | 156 ++ .../services/hestiaGIT/Is_Available.sh.ps1 | 86 + automataCI/services/hestiaGIT/Vanilla.sh.ps1 | 58 + automataCI/services/hestiaGZ/Compress.sh.ps1 | 142 ++ automataCI/services/hestiaGZ/Deflate.sh.ps1 | 140 ++ .../services/hestiaGZ/Is_Available.sh.ps1 | 93 + .../services/hestiaGZ/Is_Target_Valid.sh.ps1 | 120 ++ automataCI/services/hestiaGZ/Vanilla.sh.ps1 | 60 + .../services/hestiaHOMEBREW/Install.sh.ps1 | 117 ++ .../hestiaHOMEBREW/Is_Available.sh.ps1 | 86 + .../services/hestiaHOMEBREW/Package.sh.ps1 | 504 +++++ .../services/hestiaHOMEBREW/Vanilla.sh.ps1 | 58 + automataCI/services/hestiaHTTP/Call.sh.ps1 | 272 +++ .../services/hestiaHTTP/Download.sh.ps1 | 195 ++ .../services/hestiaHTTP/Is_Available.sh.ps1 | 84 + automataCI/services/hestiaHTTP/Setup.sh.ps1 | 108 + automataCI/services/hestiaHTTP/Vanilla.sh.ps1 | 60 + .../hestiaI18N/Get_Languages_List.sh.ps1 | 2 +- ...anslate_All_Components_Description.sh.ps1} | 40 +- ... => Translate_All_Components_Title.sh.ps1} | 40 +- ...> Translate_Already_Latest_Version.sh.ps1} | 41 +- .../hestiaI18N/Translate_Assemble.sh.ps1 | 96 + .../Translate_Assemble_Failed.sh.ps1 | 84 + .../Translate_Assemble_Simulate.sh.ps1 | 83 + .../Translate_Assemble_Skipped.sh.ps1 | 84 + ...Translate_Bin_Component_Description.sh.ps1 | 84 + .../Translate_Bin_Component_Title.sh.ps1 | 84 + .../hestiaI18N/Translate_Check.sh.ps1 | 90 + .../Translate_Check_Availability.sh.ps1 | 90 + ...e.sh.ps1 => Translate_Check_Failed.sh.ps1} | 42 +- .../Translate_Check_Simulate.sh.ps1 | 83 + .../hestiaI18N/Translate_Check_Skipped.sh.ps1 | 84 + .../hestiaI18N/Translate_Create.sh.ps1 | 90 + .../hestiaI18N/Translate_Create_Failed.sh.ps1 | 84 + .../Translate_Create_Simulate.sh.ps1 | 83 + ...sh.ps1 => Translate_Create_Skipped.sh.ps1} | 42 +- ...Translate_Doc_Component_Description.sh.ps1 | 84 + .../Translate_Doc_Component_Title.sh.ps1 | 84 + ...nts-Title.sh.ps1 => Translate_Done.sh.ps1} | 42 +- ...ts-Title.sh.ps1 => Translate_Error.sh.ps1} | 42 +- ...Translate_Etc_Component_Description.sh.ps1 | 84 + .../Translate_Etc_Component_Title.sh.ps1 | 84 + ...nts-Title.sh.ps1 => Translate_Info.sh.ps1} | 42 +- ...ranslate_Lib_Component_Description.sh.ps1} | 42 +- .../Translate_Lib_Component_Title.sh.ps1 | 84 + ...anslate_Main_Component_Description.sh.ps1} | 42 +- .../Translate_Main_Component_Title.sh.ps1 | 84 + .../hestiaI18N/Translate_Merge.sh.ps1 | 96 + .../hestiaI18N/Translate_Merge_Failed.sh.ps1 | 84 + ...sh.ps1 => Translate_Merge_Simulate.sh.ps1} | 42 +- .../hestiaI18N/Translate_Merge_Skipped.sh.ps1 | 84 + .../services/hestiaI18N/Translate_Note.sh.ps1 | 84 + .../services/hestiaI18N/Translate_OK.sh.ps1 | 84 + ... Translate_Only_Install_On_Windows.sh.ps1} | 130 +- .../hestiaI18N/Translate_Package.sh.ps1 | 90 + .../Translate_Package_Failed.sh.ps1 | 84 + .../Translate_Package_Simulate.sh.ps1 | 84 + .../Translate_Package_Skipped.sh.ps1 | 84 + .../hestiaI18N/Translate_Publish.sh.ps1 | 86 + .../Translate_Publish_Failed.sh.ps1 | 84 + ....ps1 => Translate_Publish_Simulate.sh.ps1} | 42 +- .../Translate_Publish_Skipped.sh.ps1 | 84 + .../hestiaI18N/Translate_Recreate.sh.ps1 | 90 + .../Translate_Recreate_Failed.sh.ps1 | 84 + .../Translate_Recreate_Simulate.sh.ps1 | 83 + .../Translate_Recreate_Skipped.sh.ps1 | 84 + .../services/hestiaI18N/Translate_Run.sh.ps1 | 90 + ...tle.sh.ps1 => Translate_Run_Failed.sh.ps1} | 42 +- .../hestiaI18N/Translate_Run_Simulate.sh.ps1 | 84 + .../hestiaI18N/Translate_Run_Skipped.sh.ps1 | 84 + .../hestiaI18N/Translate_Success.sh.ps1 | 84 + .../hestiaI18N/Translate_Warning.sh.ps1 | 84 + automataCI/services/hestiaI18N/Vanilla.sh.ps1 | 136 +- .../services/hestiaKERNEL/Error_Codes.sh.ps1 | 621 ++++++ .../hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1 | 339 +++ .../services/hestiaKERNEL/Vanilla.sh.ps1 | 56 + .../{Get-LCID.sh.ps1 => Get_LCID.sh.ps1} | 62 +- .../services/hestiaLOCALE/Get_Lang.sh.ps1 | 105 + .../services/hestiaLOCALE/Vanilla.sh.ps1 | 6 +- automataCI/services/hestiaMSI/Compile.sh.ps1 | 175 ++ .../services/hestiaMSI/Get_Culture.sh.ps1 | 283 +++ .../Get_Program_Files_Directory.sh.ps1 | 85 + .../services/hestiaMSI/Install_Quietly.sh.ps1 | 129 ++ .../services/hestiaMSI/Is_Available.sh.ps1 | 97 + .../services/hestiaMSI/Is_Target_Valid.sh.ps1 | 111 + automataCI/services/hestiaMSI/Package.sh.ps1 | 1406 +++++++++++++ automataCI/services/hestiaMSI/Setup.sh.ps1 | 108 + automataCI/services/hestiaMSI/Vanilla.sh.ps1 | 68 + .../services/hestiaNPM/Is_Target_Valid.sh.ps1 | 129 ++ automataCI/services/hestiaNPM/Vanilla.sh.ps1 | 54 + .../hestiaNUPKG/Activate_Environment.sh.ps1 | 126 ++ automataCI/services/hestiaNUPKG/Get.sh.ps1 | 383 ++++ .../services/hestiaNUPKG/Install.sh.ps1 | 140 ++ .../services/hestiaNUPKG/Is_Activated.sh.ps1 | 103 + .../services/hestiaNUPKG/Is_Available.sh.ps1 | 114 + .../hestiaNUPKG/Is_Target_Valid.sh.ps1 | 122 ++ .../services/hestiaNUPKG/Package.sh.ps1 | 438 ++++ .../services/hestiaNUPKG/Publish.sh.ps1 | 133 ++ automataCI/services/hestiaNUPKG/Setup.sh.ps1 | 148 ++ .../services/hestiaNUPKG/Vanilla.sh.ps1 | 70 + .../services/hestiaNUPKG/dotnet-install.ps1 | 1569 ++++++++++++++ .../services/hestiaNUPKG/dotnet-install.sh | 1830 +++++++++++++++++ automataCI/services/hestiaOS/Exec.sh.ps1 | 207 ++ automataCI/services/hestiaOS/Get_Arch.sh.ps1 | 79 + .../hestiaOS/Is_Command_Available.sh.ps1 | 108 + .../hestiaOS/Is_Simulation_Mode.sh.ps1 | 84 + automataCI/services/hestiaOS/To_Arch.sh.ps1 | 106 + .../services/hestiaOS/To_Arch_MSFT.sh.ps1 | 116 ++ .../services/hestiaOS/To_Arch_UNIX.sh.ps1 | 132 ++ automataCI/services/hestiaOS/Vanilla.sh.ps1 | 66 + .../services/hestiaPDF/Is_Target_Valid.sh.ps1 | 111 + automataCI/services/hestiaPDF/Vanilla.sh.ps1 | 54 + .../hestiaRUST/Is_Target_Valid.sh.ps1 | 111 + automataCI/services/hestiaRUST/Vanilla.sh.ps1 | 54 + .../hestiaSHASUM/Create_From_File.sh.ps1 | 150 ++ .../services/hestiaSHASUM/Is_Available.sh.ps1 | 92 + .../services/hestiaSHASUM/Vanilla.sh.ps1 | 56 + automataCI/services/hestiaSTRING/Has.sh.ps1 | 116 ++ .../services/hestiaSTRING/Is_Empty.sh.ps1 | 92 + .../services/hestiaSTRING/To_Lowercase.sh.ps1 | 77 + .../services/hestiaSTRING/To_Titlecase.sh.ps1 | 156 ++ .../services/hestiaSTRING/To_Uppercase.sh.ps1 | 77 + .../services/hestiaSTRING/Vanilla.sh.ps1 | 62 + .../services/hestiaTAR/Is_Available.sh.ps1 | 85 + .../services/hestiaTAR/Is_Target_Valid.sh.ps1 | 121 ++ automataCI/services/hestiaTAR/Pack.sh.ps1 | 306 +++ automataCI/services/hestiaTAR/Unpack.sh.ps1 | 173 ++ automataCI/services/hestiaTAR/Vanilla.sh.ps1 | 60 + .../hestiaTIME/Format_Date_ISO8601.sh.ps1 | 107 + .../hestiaTIME/Format_Date_RPM.sh.ps1 | 107 + .../hestiaTIME/Format_Datetime_RFC5322.sh.ps1 | 107 + .../Format_Datetime_RFC5322_UTC.sh.ps1 | 107 + .../services/hestiaTIME/Is_Available.sh.ps1 | 73 + automataCI/services/hestiaTIME/Now.sh.ps1 | 76 + automataCI/services/hestiaTIME/Vanilla.sh.ps1 | 64 + .../hestiaWASM/Is_Target_Valid.sh.ps1 | 115 ++ .../hestiaWASM/Is_Target_Valid_JS.sh.ps1 | 122 ++ automataCI/services/hestiaWASM/Vanilla.sh.ps1 | 56 + automataCI/services/hestiaXZ/Compress.sh.ps1 | 128 ++ automataCI/services/hestiaXZ/Deflate.sh.ps1 | 126 ++ .../services/hestiaXZ/Is_Available.sh.ps1 | 84 + .../services/hestiaXZ/Is_Target_Valid.sh.ps1 | 120 ++ automataCI/services/hestiaXZ/Vanilla.sh.ps1 | 60 + .../services/hestiaZIP/Is_Available.sh.ps1 | 81 + .../services/hestiaZIP/Is_Target_Valid.sh.ps1 | 128 ++ automataCI/services/hestiaZIP/Pack.sh.ps1 | 231 +++ automataCI/services/hestiaZIP/Unpack.sh.ps1 | 151 ++ automataCI/services/hestiaZIP/Vanilla.sh.ps1 | 60 + automataCI/services/io/fs.sh | 2 + automataCI/services/publishers/chocolatey.ps1 | 8 +- automataCI/x-package_unix-any.sh | 113 + automataCI/x-package_windows-any.ps1 | 107 + src/.ci/_package-archive_unix-any.sh | 144 -- src/.ci/_package-archive_windows-any.ps1 | 139 -- src/.ci/_package-cargo_unix-any.sh | 36 - src/.ci/_package-cargo_windows-any.ps1 | 37 - src/.ci/_package-chocolatey_unix-any.sh | 256 --- src/.ci/_package-chocolatey_windows-any.ps1 | 263 --- src/.ci/_package-homebrew_unix-any.sh | 130 -- src/.ci/_package-homebrew_windows-any.ps1 | 128 -- src/.ci/_package-lib_unix-any.sh | 244 --- src/.ci/_package-lib_windows-any.ps1 | 246 --- src/.ci/_package-msi_unix-any.sh | 238 --- src/.ci/_package-msi_windows-any.ps1 | 235 --- src/.ci/_package-pdf_unix-any.sh | 54 - src/.ci/_package-pdf_windows-any.ps1 | 55 - src/.ci/_package-pypi_unix-any.sh | 36 - src/.ci/_package-pypi_windows-any.ps1 | 37 - src/.ci/package-archive_unix-any.sh | 74 + src/.ci/package-archive_windows-any.ps1 | 80 + src/.ci/package-consolidate_unix-any.sh | 54 + src/.ci/package-consolidate_windows-any.ps1 | 52 + src/.ci/package-single_unix-any.sh | 54 + src/.ci/package-single_windows-any.ps1 | 52 + src/.ci/package-windows_unix-any.sh | 54 + src/.ci/package-windows_windows-any.ps1 | 52 + src/.ci/package_unix-any.sh | 41 - src/.ci/package_windows-any.ps1 | 40 - .../tools/ChocolateyBeforeModify.ps1 | 1 + .../chocolatey/tools/ChocolateyInstall.ps1 | 1 + .../chocolatey/tools/ChocolateyUninstall.ps1 | 1 + src/data/unix/control/post-install.sh | 1 + src/data/unix/control/post-remove.sh | 1 + src/data/unix/control/pre-install.sh | 1 + src/data/unix/control/pre-remove.sh | 1 + srcRESEARCH/.ci/build_unix-any.sh | 2 +- srcRESEARCH/.ci/build_windows-any.ps1 | 2 +- 318 files changed, 34521 insertions(+), 7496 deletions(-) create mode 100644 automataCI/__package-assemble-default-content_unix-any.sh create mode 100644 automataCI/__package-assemble-default-content_windows-any.ps1 delete mode 100644 automataCI/_package-cargo_unix-any.sh delete mode 100644 automataCI/_package-cargo_windows-any.ps1 delete mode 100644 automataCI/_package-changelog_unix-any.sh delete mode 100644 automataCI/_package-changelog_windows-any.ps1 delete mode 100644 automataCI/_package-chocolatey_unix-any.sh delete mode 100644 automataCI/_package-chocolatey_windows-any.ps1 delete mode 100644 automataCI/_package-citation_unix-any.sh delete mode 100644 automataCI/_package-citation_windows-any.ps1 create mode 100644 automataCI/_package-consolidate_unix-any.sh create mode 100644 automataCI/_package-consolidate_windows-any.ps1 delete mode 100644 automataCI/_package-homebrew_unix-any.sh delete mode 100644 automataCI/_package-homebrew_windows-any.ps1 delete mode 100644 automataCI/_package-lib_unix-any.sh delete mode 100644 automataCI/_package-lib_windows-any.ps1 delete mode 100644 automataCI/_package-msi_unix-any.sh delete mode 100644 automataCI/_package-msi_windows-any.ps1 delete mode 100644 automataCI/_package-pdf_unix-any.sh delete mode 100644 automataCI/_package-pdf_windows-any.ps1 delete mode 100644 automataCI/_package-pypi_unix-any.sh delete mode 100644 automataCI/_package-pypi_windows-any.ps1 create mode 100644 automataCI/_package-single_unix-any.sh create mode 100644 automataCI/_package-single_windows-any.ps1 delete mode 100644 automataCI/_package-sourcing_unix-any.sh delete mode 100644 automataCI/_package-sourcing_windows-any.ps1 create mode 100644 automataCI/_package-windows_unix-any.sh create mode 100644 automataCI/_package-windows_windows-any.ps1 create mode 100644 automataCI/_release-nupkg_unix-any.sh create mode 100644 automataCI/_release-nupkg_windows-any.ps1 create mode 100644 automataCI/services/hestiaCHANGELOG/Assemble_DEB.sh.ps1 create mode 100644 automataCI/services/hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1 create mode 100644 automataCI/services/hestiaCHANGELOG/Assemble_RPM.sh.ps1 create mode 100644 automataCI/services/hestiaCHANGELOG/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaCHOCOLATEY/Install.sh.ps1 create mode 100644 automataCI/services/hestiaCHOCOLATEY/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaCHOCOLATEY/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaCITATION/Assemble.sh.ps1 create mode 100644 automataCI/services/hestiaCITATION/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Assemble.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Assemble_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Assemble_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Check.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Check_Availability.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Check_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Check_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Check_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Create.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Create_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Create_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Create_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Merge.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Merge_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Merge_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Merge_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Package.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Package_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Package_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Package_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Publish.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Publish_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Publish_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Publish_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Recreate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Recreate_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Recreate_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Run.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Run_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Run_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Run_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Log_Success.sh.ps1 create mode 100644 automataCI/services/hestiaCONSOLE/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_Binary.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_Data.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_Decimal.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_Hex.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_String.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Create_Random_UUID.sh.ps1 create mode 100644 automataCI/services/hestiaCRYPTO/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Append_Byte_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Append_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Append_Text_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Copy.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Copy_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Copy_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Copy_Socket.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Copy_Symbolic_Link.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Create_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Get_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Get_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Get_Relative_Path.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Get_Size.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Directory_Empty.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Exist.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Filename_Has.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Socket.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Is_Symbolic_Link.sh.ps1 create mode 100644 automataCI/services/hestiaFS/List.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Merge_Directories.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Move.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Recreate_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Remove.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Replace_Extension.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Write_Byte_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Write_File.sh.ps1 create mode 100644 automataCI/services/hestiaFS/Write_Text_File.sh.ps1 create mode 100644 automataCI/services/hestiaGIT/Change_Branch.sh.ps1 create mode 100644 automataCI/services/hestiaGIT/Clone.sh.ps1 create mode 100644 automataCI/services/hestiaGIT/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaGIT/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaGZ/Compress.sh.ps1 create mode 100644 automataCI/services/hestiaGZ/Deflate.sh.ps1 create mode 100644 automataCI/services/hestiaGZ/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaGZ/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaGZ/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaHOMEBREW/Install.sh.ps1 create mode 100644 automataCI/services/hestiaHOMEBREW/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaHOMEBREW/Package.sh.ps1 create mode 100644 automataCI/services/hestiaHOMEBREW/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaHTTP/Call.sh.ps1 create mode 100644 automataCI/services/hestiaHTTP/Download.sh.ps1 create mode 100644 automataCI/services/hestiaHTTP/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaHTTP/Setup.sh.ps1 create mode 100644 automataCI/services/hestiaHTTP/Vanilla.sh.ps1 mode change 100755 => 100644 automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-All-Components-Description.sh.ps1 => Translate_All_Components_Description.sh.ps1} (80%) mode change 100755 => 100644 rename automataCI/services/hestiaI18N/{Translate-All-Components-Title.sh.ps1 => Translate_All_Components_Title.sh.ps1} (82%) mode change 100755 => 100644 rename automataCI/services/hestiaI18N/{Translate-Already-Latest-Version.sh.ps1 => Translate_Already_Latest_Version.sh.ps1} (78%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Assemble.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Assemble_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Assemble_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Assemble_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Bin_Component_Description.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Bin_Component_Title.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Check.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Check_Availability.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Docs-Components-Title.sh.ps1 => Translate_Check_Failed.sh.ps1} (81%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Check_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Check_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Create.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Create_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Create_Simulate.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Config-Components-Description.sh.ps1 => Translate_Create_Skipped.sh.ps1} (80%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Doc_Component_Description.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Doc_Component_Title.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Main-Components-Title.sh.ps1 => Translate_Done.sh.ps1} (82%) mode change 100755 => 100644 rename automataCI/services/hestiaI18N/{Translate-Bin-Components-Title.sh.ps1 => Translate_Error.sh.ps1} (81%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Etc_Component_Description.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Etc_Component_Title.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Config-Components-Title.sh.ps1 => Translate_Info.sh.ps1} (81%) mode change 100755 => 100644 rename automataCI/services/hestiaI18N/{Translate-Lib-Components-Description.sh.ps1 => Translate_Lib_Component_Description.sh.ps1} (78%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Lib_Component_Title.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Main-Components-Description.sh.ps1 => Translate_Main_Component_Description.sh.ps1} (78%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Main_Component_Title.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Merge.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Merge_Failed.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Docs-Components-Description.sh.ps1 => Translate_Merge_Simulate.sh.ps1} (78%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Merge_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Note.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_OK.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Only-Install-On-Windows.sh.ps1 => Translate_Only_Install_On_Windows.sh.ps1} (73%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Package.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Package_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Package_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Package_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Publish.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Publish_Failed.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Bin-Components-Description.sh.ps1 => Translate_Publish_Simulate.sh.ps1} (79%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Publish_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Recreate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Recreate_Failed.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Recreate_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Recreate_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Run.sh.ps1 rename automataCI/services/hestiaI18N/{Translate-Lib-Components-Title.sh.ps1 => Translate_Run_Failed.sh.ps1} (81%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaI18N/Translate_Run_Simulate.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Run_Skipped.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Success.sh.ps1 create mode 100644 automataCI/services/hestiaI18N/Translate_Warning.sh.ps1 mode change 100755 => 100644 automataCI/services/hestiaI18N/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaKERNEL/Error_Codes.sh.ps1 create mode 100644 automataCI/services/hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1 create mode 100644 automataCI/services/hestiaKERNEL/Vanilla.sh.ps1 rename automataCI/services/hestiaLOCALE/{Get-LCID.sh.ps1 => Get_LCID.sh.ps1} (79%) mode change 100755 => 100644 create mode 100644 automataCI/services/hestiaLOCALE/Get_Lang.sh.ps1 mode change 100755 => 100644 automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Compile.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Get_Culture.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Get_Program_Files_Directory.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Install_Quietly.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Package.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Setup.sh.ps1 create mode 100644 automataCI/services/hestiaMSI/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaNPM/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaNPM/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Activate_Environment.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Get.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Install.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Is_Activated.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Package.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Publish.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Setup.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaNUPKG/dotnet-install.ps1 create mode 100644 automataCI/services/hestiaNUPKG/dotnet-install.sh create mode 100644 automataCI/services/hestiaOS/Exec.sh.ps1 create mode 100644 automataCI/services/hestiaOS/Get_Arch.sh.ps1 create mode 100644 automataCI/services/hestiaOS/Is_Command_Available.sh.ps1 create mode 100644 automataCI/services/hestiaOS/Is_Simulation_Mode.sh.ps1 create mode 100644 automataCI/services/hestiaOS/To_Arch.sh.ps1 create mode 100644 automataCI/services/hestiaOS/To_Arch_MSFT.sh.ps1 create mode 100644 automataCI/services/hestiaOS/To_Arch_UNIX.sh.ps1 create mode 100644 automataCI/services/hestiaOS/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaPDF/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaPDF/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaRUST/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaRUST/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaSHASUM/Create_From_File.sh.ps1 create mode 100644 automataCI/services/hestiaSHASUM/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaSHASUM/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/Has.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/Is_Empty.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/To_Lowercase.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/To_Titlecase.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/To_Uppercase.sh.ps1 create mode 100644 automataCI/services/hestiaSTRING/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaTAR/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaTAR/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaTAR/Pack.sh.ps1 create mode 100644 automataCI/services/hestiaTAR/Unpack.sh.ps1 create mode 100644 automataCI/services/hestiaTAR/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Format_Date_ISO8601.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Format_Date_RPM.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Format_Datetime_RFC5322.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Format_Datetime_RFC5322_UTC.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Now.sh.ps1 create mode 100644 automataCI/services/hestiaTIME/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaWASM/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaWASM/Is_Target_Valid_JS.sh.ps1 create mode 100644 automataCI/services/hestiaWASM/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaXZ/Compress.sh.ps1 create mode 100644 automataCI/services/hestiaXZ/Deflate.sh.ps1 create mode 100644 automataCI/services/hestiaXZ/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaXZ/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaXZ/Vanilla.sh.ps1 create mode 100644 automataCI/services/hestiaZIP/Is_Available.sh.ps1 create mode 100644 automataCI/services/hestiaZIP/Is_Target_Valid.sh.ps1 create mode 100644 automataCI/services/hestiaZIP/Pack.sh.ps1 create mode 100644 automataCI/services/hestiaZIP/Unpack.sh.ps1 create mode 100644 automataCI/services/hestiaZIP/Vanilla.sh.ps1 create mode 100644 automataCI/x-package_unix-any.sh create mode 100644 automataCI/x-package_windows-any.ps1 delete mode 100644 src/.ci/_package-archive_unix-any.sh delete mode 100644 src/.ci/_package-archive_windows-any.ps1 delete mode 100644 src/.ci/_package-cargo_unix-any.sh delete mode 100644 src/.ci/_package-cargo_windows-any.ps1 delete mode 100644 src/.ci/_package-chocolatey_unix-any.sh delete mode 100644 src/.ci/_package-chocolatey_windows-any.ps1 delete mode 100644 src/.ci/_package-homebrew_unix-any.sh delete mode 100644 src/.ci/_package-homebrew_windows-any.ps1 delete mode 100644 src/.ci/_package-lib_unix-any.sh delete mode 100644 src/.ci/_package-lib_windows-any.ps1 delete mode 100644 src/.ci/_package-msi_unix-any.sh delete mode 100644 src/.ci/_package-msi_windows-any.ps1 delete mode 100644 src/.ci/_package-pdf_unix-any.sh delete mode 100644 src/.ci/_package-pdf_windows-any.ps1 delete mode 100644 src/.ci/_package-pypi_unix-any.sh delete mode 100644 src/.ci/_package-pypi_windows-any.ps1 create mode 100644 src/.ci/package-archive_unix-any.sh create mode 100644 src/.ci/package-archive_windows-any.ps1 create mode 100644 src/.ci/package-consolidate_unix-any.sh create mode 100644 src/.ci/package-consolidate_windows-any.ps1 create mode 100644 src/.ci/package-single_unix-any.sh create mode 100644 src/.ci/package-single_windows-any.ps1 create mode 100644 src/.ci/package-windows_unix-any.sh create mode 100644 src/.ci/package-windows_windows-any.ps1 delete mode 100644 src/.ci/package_unix-any.sh delete mode 100644 src/.ci/package_windows-any.ps1 create mode 100644 src/data/chocolatey/tools/ChocolateyBeforeModify.ps1 create mode 100644 src/data/chocolatey/tools/ChocolateyInstall.ps1 create mode 100644 src/data/chocolatey/tools/ChocolateyUninstall.ps1 create mode 100755 src/data/unix/control/post-install.sh create mode 100755 src/data/unix/control/post-remove.sh create mode 100755 src/data/unix/control/pre-install.sh create mode 100755 src/data/unix/control/pre-remove.sh diff --git a/.gitignore b/.gitignore index 5b53a62..60b2383 100644 --- a/.gitignore +++ b/.gitignore @@ -140,6 +140,11 @@ gh-pages/ ##################### *.log +##################### +# GNU +##################### +.gsf-save* + ##################### # MacOS specifics ##################### diff --git a/CONFIG.toml b/CONFIG.toml index da0396e..ba3f211 100644 --- a/CONFIG.toml +++ b/CONFIG.toml @@ -268,14 +268,15 @@ PROJECT_BOOK = 'srcBOOK' PROJECT_C = 'srcC' -# PROJECT_C_BRANCH_TAG +# PROJECT_C_ID # This is for technology tagging purposes such as but not limited to release # branches identification. The value shall always be lowercase, short, and -# directly identify it is C technology. +# directly identify as a C-based technology. +# +# This field shall not be EMPTY. # # Default is: 'c' -# To disable: set it empty '' -PROJECT_C_BRANCH_TAG = 'c' +PROJECT_C_ID = 'c' @@ -301,66 +302,6 @@ PROJECT_CITATION_TYPE='software' -###################### -# DOTNET TECHNOLOGY # -###################### -# PROJECT_DOTNET -# This is a control variable used for enabling .NET technology in the -# repository. Unlike other technologies, due to .NET nature, it is basically -# a passive library located in the following directory: -# ${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS/${PROJECT_PATH_DOTNET_ENGINE} -# -# IMPORTANT NOTE: .NET is always enabled for Windows OS due to other -# dependencies like MSI wix toolkits and etc. This variable only affects UNIX -# side of stuffs. -# -# WARNING: installing .NET can increase setup time dramatically (e.g. ~+2mins -# in GitHub Actions). Only include when it's absolutely used or needed. -# -# To enable it: simply supply the path (e.g. default is 'true'). -# To disable it: simply supply an empty path (e.g. default is ''). -PROJECT_DOTNET = '' - - -# PROJECT_PATH_DOTNET_ENGINE -# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for -# setting up .NET localized directory. -PROJECT_PATH_DOTNET_ENGINE = 'dotnet-engine' - - -# PROJECT_DOTNET_CHANNEL -# This is to configure the .NET version to be installed by AutomataCI. It SHALL -# NOT be empty. -# -# Refer the following doc "channel" section to learn more: -# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script -# -# When in doubt, use "LTS" -PROJECT_DOTNET_CHANNEL = 'LTS' - - -# DOTNET_CLI_TELEMETRY_OPTOUT -# .NET default telemetry setting that will transmit its usage data back to -# Microsoft. -# -# To preserve privacy and considering UNIX environments, it is enabled by -# default. -# -# To enable: "1" -# To disable: commit it out. -DOTNET_CLI_TELEMETRY_OPTOUT = '1' - - -# PROJECT_PATH_NUPKG -# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS + -# PROJECT_PATH_DOTNET_ENGINE for for housing .NET nupkg packages. At AutomataCI, -# .nupkg (a zip file) can be downloaded without depending on downloading the -# entire .Net framework. -PROJECT_PATH_NUPKG = 'nupkg' - - - - ###################### # GOOGLE AI # ###################### @@ -628,14 +569,15 @@ PROJECT_NODE_VERSION = 'v22.2.0' PROJECT_NODE_NPM_REGISTRY = 'https://npm.pkg.github.com' -# PROJECT_NODE_BRANCH_TAG +# PROJECT_NODE_NPM_ID # This is for technology tagging purposes such as but not limited to release # branches identification. The value shall always be lowercase, short, and -# directly identify it is Node technology. +# directly identify as a Node NPM technology. +# +# This field shall not be EMPTY. # # Default is: 'npm' -# To disable: set it empty '' -PROJECT_NODE_BRANCH_TAG = 'npm' +PROJECT_NODE_NPM_ID = 'npm' @@ -695,16 +637,16 @@ PROJECT_PYPI_README_MIME = 'text/markdown' PROJECT_RESEARCH = 'srcRESEARCH' -# PROJECT_RESEARCH_IDENTIFIER -# The file identifier for the compiled output paper file from its peers with the +# PROJECT_RESEARCH_ID +# The identifier for the compiled output paper file from its peers with the # same formats (e.g. a bunch of PDFs). This is suffix-ed within the filename # itself like: # -# pattern: '${PROJECT_SKU}-${PROJECT_RESEARCH_IDENTIFIER}_v${PROJECT_VERSION}_any-any.pdf' +# pattern: '${PROJECT_SKU}-${PROJECT_RESEARCH_ID}_v${PROJECT_VERSION}_any-any.pdf' # example: 'automataci-RESEARCH_v100.00.100_any-any.pdf' # # default is: 'RESEARCH' -PROJECT_RESEARCH_IDENTIFIER = 'RESEARCH' +PROJECT_RESEARCH_ID = 'RESEARCH' @@ -888,8 +830,6 @@ PROJECT_RELEASE_IPK = 'enabled' PROJECT_CHOCOLATEY_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/latest/download' - - # PROJECT_CHOCOLATEY_VERSION # The Chocolatey version as a dependency. This field SHALL NOT BE EMPTY. # @@ -897,6 +837,18 @@ PROJECT_CHOCOLATEY_URL = 'https://github.com/ChewKeanHo/AutomataCI/releases/late PROJECT_CHOCOLATEY_VERSION = '0.9.8.21' +# PROJECT_CHOCOLATEY_ID +# This is for technology tagging purposes such as but not limited to release +# branches identification. The value shall always be lowercase, short, and +# directly identify as Chocolatey technology (including away from the original +# DOTNET nupkg). +# +# This field shall not be EMPTY. +# +# Default is: 'chocolatey' +PROJECT_CHOCOLATEY_ID = 'chocolatey' + + ############################# @@ -1211,6 +1163,17 @@ PROJECT_DOCS_REPO_KEY = 'origin' PROJECT_DOCS_REPO_BRANCH = 'gh-pages' +# PROJECT_DOCS_ID +# This is for technology tagging purposes such as but not limited to release +# branches identification. The value shall always be lowercase, short, and +# directly identify as a documentation parcel. +# +# This field shall not be EMPTY. +# +# Default is: 'docs' +PROJECT_DOCS_ID = 'docs' + + ########################## @@ -1373,55 +1336,41 @@ PROJECT_HOMEBREW_REPO_KEY = 'origin' PROJECT_HOMEBREW_REPO_BRANCH = 'main' +# PROJECT_HOMEBREW_ID +# This is for technology tagging purposes such as but not limited to release +# branches identification. The value shall always be lowercase, short, and +# directly identify as a Homebrew distribution technology. +# +# This field shall not be EMPTY. +# +# Default is: 'homebrew' +PROJECT_HOMEBREW_ID = 'homebrew' + + ########################### # DISTRIBUTION - MSI # ########################### -# PROJECT_MSI_INSTALL_DIRECTORY -# Defines the primary directory installation value for installer execute -# sequences ('InstallExecuteSequence'). The value can only be 'INSTALLDIR' -# (controlled value). +# PROJECT_MSI_CODEPAGE +# Defines the charset of the installer. # # This field also acts as the flag for enabling or disabling the homebrew # pipeline. # -# To enable it: set the value as 'INSTALLDIR' +# To enable it: set a value. # To disable it: set it empty. # -# Default is: 'INSTALLDIR' (enabled) -PROJECT_MSI_INSTALL_DIRECTORY = 'INSTALLDIR' - - -# PROJECT_MSI_ARP_INSTALL_LOCATION -# Defines the CustomAction's ID for installer execute sequences -# ('InstallExecuteSequence'). The value can only be 'ARPINSTALLLOCATION' -# (controlled value). -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'ARPINSTALLLOCATION' -PROJECT_MSI_ARP_INSTALL_LOCATION = 'ARPINSTALLLOCATION' - - -# PROJECT_MSI_COMPRESSED_MODE -# Defines the compress mode for the installer. It STRICTLY accepts lowercase -# 'yes' or 'no' only. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'yes' -PROJECT_MSI_COMPRESSED_MODE = 'yes' +# Default is: '65001' (UTF-8) +PROJECT_MSI_CODEPAGE = '65001' # PROJECT_MSI_INSTALLER_VERSION_UNIX -# Defines the MSI installer version for unix workspace (where WiX is not used). +# Defines the MSI installer version for unix workspace (where msitools is used). # # This field CANNOT BE LEFT EMPTY and is only for unix packagers. # -# Default is: '400' (Windows Installer 4.0 - included in Vista) +# Default is: '400' (MSITools - Windows Installer 4.0 - included in Vista) PROJECT_MSI_INSTALLER_VERSION_UNIX = '400' @@ -1434,16 +1383,6 @@ PROJECT_MSI_INSTALLER_VERSION_UNIX = '400' PROJECT_MSI_INSTALLER_VERSION_WINDOWS = '500' -# PROJECT_MSI_CODEPAGE -# Defines the charset of the installer. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: '65001' (UTF-8) -PROJECT_MSI_CODEPAGE = '65001' - - # PROJECT_MSI_INSTALLER_SCOPE # Defines the installer scope. # @@ -1454,17 +1393,6 @@ PROJECT_MSI_CODEPAGE = '65001' PROJECT_MSI_INSTALLER_SCOPE = 'perMachine' -# PROJECT_MSI_REGISTRY_NAME -# Defines the name of the registry. Unless aboslute needed, it's best to leave -# this as it is. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'InstallLocation' -PROJECT_MSI_REGISTRY_NAME = 'InstallLocation' - - # PROJECT_MSI_REGISTRY_KEY # Defines the location of the registry. # @@ -1478,39 +1406,6 @@ PROJECT_MSI_REGISTRY_NAME = 'InstallLocation' PROJECT_MSI_REGISTRY_KEY = '' -# PROJECT_MSI_FEATURES_ID -# The ID for the entire installer's feature list. This the the root of the list -# consisting of main feature list, optional features list, and etc. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'FeaturesAll' -PROJECT_MSI_FEATURES_ID = 'FeaturesAll' - - -# PROJECT_MSI_MAIN_FEATURE_ID -# The ID for the compulsory features list. This consists of all the MUST HAVE -# components to be installed at the client side. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'FeaturesMain' -PROJECT_MSI_MAIN_FEATURE_ID = 'FeaturesMain' - - -# PROJECT_MSI_REGISTRIES_ID -# The ID for the compulsory main registries component. This handles the main -# registeries internal implementations. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'RegValInstallLocation_comp' -PROJECT_MSI_REGISTRIES_ID = 'RegValInstallLocation_comp' - - # PROJECT_MSI_REGISTRIES_GUID # The unique GUID for the compulsory main registries component. Its value is # similar to a UUID type. @@ -1524,27 +1419,6 @@ PROJECT_MSI_REGISTRIES_ID = 'RegValInstallLocation_comp' PROJECT_MSI_REGISTRIES_GUID = '7E665EAF-446B-7738-84D9-FE18BE039400' -# PROJECT_MSI_BIN_FEATURE_ID -# The ID for the executables features list. When available, the executables will -# be in this component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'FeaturesBin' -PROJECT_MSI_BIN_FEATURE_ID = 'FeaturesBin' - - -# PROJECT_MSI_BIN_COMPONENT_ID -# The ID for the executables component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'ComponentBin' -PROJECT_MSI_BIN_COMPONENT_ID = 'ComponentBin' - - # PROJECT_MSI_BIN_COMPONENT_GUID # The unique GUID for the executables component. Its value is similar to an UUID # type. @@ -1558,28 +1432,7 @@ PROJECT_MSI_BIN_COMPONENT_ID = 'ComponentBin' PROJECT_MSI_BIN_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039401' -# PROJECT_MSI_CONFIG_FEATURE_ID -# The ID for the config files features list. When available, the config files -# will be in this component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'FeaturesBin' -PROJECT_MSI_CONFIG_FEATURE_ID = 'FeaturesConfig' - - -# PROJECT_MSI_CONFIG_COMPONENT_ID -# The ID for the config files component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'ComponentConfig' -PROJECT_MSI_CONFIG_COMPONENT_ID = 'ComponentConfig' - - -# PROJECT_MSI_CONFIG_COMPONENT_GUID +# PROJECT_MSI_ETC_COMPONENT_GUID # The unique GUID for the config files component. Its value is similar to # an UUID type. # @@ -1589,28 +1442,7 @@ PROJECT_MSI_CONFIG_COMPONENT_ID = 'ComponentConfig' # When in doubt, use the PROJECT_UUID and play with the last 6 characters. # # Default is: '*' - in some cases may fail. -PROJECT_MSI_CONFIG_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039402' - - -# PROJECT_MSI_LIB_FEATURE_ID -# The ID for the libraries features list. When available, the libraries will -# be in this component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'FeaturesLib' -PROJECT_MSI_LIB_FEATURE_ID = 'FeaturesLib' - - -# PROJECT_MSI_LIB_COMPONENT_ID -# The ID for the libraries component. -# -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. -# -# Default is: 'ComponentLib' -PROJECT_MSI_LIB_COMPONENT_ID = 'ComponentLib' +PROJECT_MSI_ETC_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039402' # PROJECT_MSI_LIB_COMPONENT_GUID @@ -1626,9 +1458,9 @@ PROJECT_MSI_LIB_COMPONENT_ID = 'ComponentLib' PROJECT_MSI_LIB_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039403' -# PROJECT_MSI_DOCS_FEATURE_ID -# The ID for the documenations features list. When available, the documents will -# be in this component. +# PROJECT_MSI_DOC_COMPONENT_GUID +# The unique GUID for the documentations component. Its value is similar to an +# UUID type. # # This field CANNOT BE LEFT EMPTY and is shared for both unix and windows # packagers. @@ -1636,30 +1468,89 @@ PROJECT_MSI_LIB_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039403' # When in doubt, use the PROJECT_UUID and play with the last 6 characters. # # Default is: '*' - in some cases may fail. -PROJECT_MSI_DOCS_FEATURE_ID = 'FeaturesDocs' +PROJECT_MSI_DOC_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039404' + -# PROJECT_MSI_DOCS_COMPONENT_ID -# The ID for the documentations component. + +########################## +# DISTRIBUTION - NUPKG # +########################## +# PROJECT_DOTNET +# This is a control variable used for enabling .NET technology in the +# repository. Unlike other technologies, due to .NET nature, it is basically +# a passive library located in the following directory: +# ${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS/${PROJECT_PATH_DOTNET_ENGINE} # -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. +# IMPORTANT NOTE: .NET is always enabled for Windows OS due to other critical +# dependencies (specifically MSI packager). Hence, this variable only affects +# UNIX side of things. +# +# Installing .NET can increase setup time dramatically (e.g. ~+2mins in some +# CI service providers like GitHub Actions. Hence, you should only include it +# when .NET is absolutely in use. Otherwise, disable it. +# +# This variable shall not affect AutomataCI's capability of packaging .nupkg +# format. For that, the control variable is $PROJECT_NUPKG_URL. # -# Default is: 'ComponentDocs' -PROJECT_MSI_DOCS_COMPONENT_ID = 'ComponentDocs' +# To enable it: simply supply the path (e.g. default is 'true'). +# To disable it: simply supply an empty path (e.g. default is ''). +PROJECT_DOTNET = '' -# PROJECT_MSI_DOCS_COMPONENT_GUID -# The unique GUID for the documentations component. Its value is similar to an -# UUID type. +# PROJECT_NUPKG_URL +# The registry url for publishing the DOTNET .nupkg package file. More info: +# (1) https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry +# (2) https://learn.microsoft.com/en-us/nuget/api/package-publish-resource +# (3) https://learn.microsoft.com/en-us/nuget/api/overview # -# This field CANNOT BE LEFT EMPTY and is shared for both unix and windows -# packagers. +# Some examples: +# (1) GitHub Package: 'https://nuget.pkg.github.com/[USERNAME]' +# (2) Nuget.org : 'https://www.nuget.org/api/v2/package' # -# When in doubt, use the PROJECT_UUID and play with the last 6 characters. +# This field also acts as the flag for enabling or disabling the nupkg +# production pipeline. # -# Default is: '*' - in some cases may fail. -PROJECT_MSI_DOCS_COMPONENT_GUID = '7E665EAF-446B-7738-84D9-FE18BE039404' +# To enable : fill in the end-user downloadable URL without ending slash. +# To disable: leave this field empty (''). +# +# !! IMPORTANT !! - Please avoid ending with the URL slash. +PROJECT_NUPKG_URL = 'https://nuget.pkg.github.com/ChewKeanHo' + + +# PROJECT_DOTNET_CHANNEL +# This is to configure the .NET version to be installed by AutomataCI. It SHALL +# NOT be empty. +# +# Refer the following doc "channel" section to learn more: +# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script +# +# When in doubt, use "LTS" +PROJECT_DOTNET_CHANNEL = 'LTS' + + +# DOTNET_CLI_TELEMETRY_OPTOUT +# .NET default telemetry setting that will transmit its usage data back to +# Microsoft. +# +# To preserve privacy and considering UNIX environments, it is enabled by +# default. +# +# To enable: "1" +# To disable: commit it out. +DOTNET_CLI_TELEMETRY_OPTOUT = '1' + + +# PROJECT_PATH_DOTNET_ENGINE +# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS for +# setting up .NET localized directory. +PROJECT_PATH_DOTNET_ENGINE = 'dotnet-engine' + + +# PROJECT_PATH_NUPKG +# This is a relative pathing to PROJECT_PATH_ROOT + PROJECT_PATH_TOOLS + +# PROJECT_PATH_DOTNET_ENGINE for for housing .NET nupkg packages. +PROJECT_PATH_NUPKG = 'nupkg' diff --git a/automataCI/SECRETS-template.toml b/automataCI/SECRETS-template.toml index f45f490..ad8263c 100644 --- a/automataCI/SECRETS-template.toml +++ b/automataCI/SECRETS-template.toml @@ -124,6 +124,17 @@ NPM_TOKEN = "" +###################### +# NUPKG TECHNOLOGY # +###################### +# NUPKG_TOKEN +# The Authentication token (e.g. 'Authentication: ' or 'X-NuGet-ApiKey: ') for +# logging into the corresponding NUPKG registry defined in the CONFIG.toml. +NUPKG_TOKEN = "" + + + + ###################### # PYTHON TECHNOLOGY # ###################### diff --git a/automataCI/__package-assemble-default-content_unix-any.sh b/automataCI/__package-assemble-default-content_unix-any.sh new file mode 100644 index 0000000..8086e9c --- /dev/null +++ b/automataCI/__package-assemble-default-content_unix-any.sh @@ -0,0 +1,234 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNPM/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaPDF/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaRUST/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaTAR/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaWASM/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaZIP/Vanilla.sh.ps1" + + + + +PACKAGE_Assemble_Default_Content() { + #_target="$1" + #_directory="$2" + #_target_name="$3" + #_target_os="$4" + #_target_arch="$5" + #_exclude_docs="$6" + + + + + # validate input + if [ $(hestiaWASM_Is_Target_Valid_JS "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_CANCELLED # not applicable + fi + + + + + # assemble single file type + if [ $(hestiaPDF_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + # determine unpack destination + __dest="${2}/$(hestiaFS_Get_File "$1")" + if [ $(hestiaFS_Is_Filename_Has "$1" "$PROJECT_RESEARCH_ID") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="${2}/${PROJECT_SKU}-${PROJECT_RESEARCH_ID}_any-any.pdf" + fi + + + # assemble the file + hestiaCONSOLE_Log_Assemble "$__dest" "$1" + hestiaFS_Copy_File "$__dest" "$1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # return since it's done + return $hestiaKERNEL_ERROR_OK + fi + + + + + # determine unpack destination based on level-1 Filesystem Hierarchy Standard + # only the following are used: + # (1) bin/ - holds executables + # (2) lib/ - holds libraries + # (3) etc/ - holds configurations + # (4) share/doc/ - holds documentations + if [ $(hestiaFS_Is_Filename_Has "$1" "-docs") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="${2}/share/doc" + elif [ $(hestiaFS_Is_Filename_Has "$1" "lib") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="${2}/lib" + + if [ $(hestiaNPM_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaRUST_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="$2" # distribution oriented libraries + fi + elif [ $(hestiaWASM_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="${2}/lib" + else + __dest="${2}/bin" + + if [ $(hestiaTAR_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaZIP_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="$2" # manually override + fi + fi + + + + + # assemble payload based on target's nature + if [ $(hestiaTAR_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + # unpack tar* + hestiaCONSOLE_Log_Assemble "$__dest" "$1" + hestiaFS_Create_Directory "$__dest" + hestiaTAR_Unpack "$__dest" "$1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + elif [ $(hestiaZIP_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + # unpack zip + hestiaCONSOLE_Log_Assemble "$__dest" "$1" + hestiaFS_Create_Directory "$__dest" + hestiaZIP_Unpack "$__dest" "$1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + else + # assemble standalone file + ___filename="$(hestiaFS_Get_File "$1")" + hestiaCONSOLE_Log_Assemble "${__dest}/${___filename}" "$1" + hestiaFS_Create_Directory "$__dest" + hestiaFS_Copy_File "${__dest}/${___filename}" "$1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + # if it is WASM artifact, then check for its gluing js script + # whenever available. + if [ $(hestiaWASM_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + __source="$(hestiaFS_Replace_Extension "$1" ".wasm" ".js")" + if [ $(hestiaFS_Is_File "$__source") -eq $hestiaKERNEL_ERROR_OK ]; then + __dest="${__dest}/$(hestiaFS_Get_File "$__source")" + hestiaCONSOLE_Log_Assemble "$__dest" "$1" + hestiaFS_Copy_File "${__dest}/$(hestiaFS_Get_File "$1")" "$1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + fi + fi + + + + + # sanitize check before proceeding + hestiaCONSOLE_Log_Check "$2" + if [ $(hestiaFS_Is_Directory_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # return early if documents are requested not to be included + if [ $(hestiaSTRING_Is_Empty "$6") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + + + # copy user guide files for all languages + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do + if [ $(hestiaFS_Is_Exist "$__source") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + __dest="${2}/$(hestiaFS_Get_File "$__source")" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done + + + + + # copy license files for all languages + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do + if [ $(hestiaFS_Is_Exist "$__source") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + __dest="${2}/$(hestiaFS_Get_File "$__source")" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done + + + + + # copy icon.png + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" + __dest="${2}/icon.png" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/automataCI/__package-assemble-default-content_windows-any.ps1 b/automataCI/__package-assemble-default-content_windows-any.ps1 new file mode 100644 index 0000000..1667d35 --- /dev/null +++ b/automataCI/__package-assemble-default-content_windows-any.ps1 @@ -0,0 +1,235 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNPM\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaPDF\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaRUST\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaTAR\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaWASM\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaZIP\Vanilla.sh.ps1" + + + + +function PACKAGE-Assemble-Default-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch, + [string]$_exclude_docs + ) + + + + + # validate input + if ($(hestiaWASM-Is-Target-Valid-JS $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_CANCELLED} # not applicable + } + + + + + # assemble single file type + if ($(hestiaPDF-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # determine unpack destination + $__dest = "${_directory}\${env:PROJECT_SKU}_any-any.pdf" + if ($(hestiaFS-Is-Filename-Has $_target ${env:PROJECT_RESEARCH_ID}) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__dest = "${_directory}\${env:PROJECT_SKU}-${env:PROJECT_RESEARCH_ID}_any-any.pdf" + } + + + # assemble the file + $null = hestiaCONSOLE-Log-Assemble $__dest $_target + $___process = hestiaFS-Copy-File $__dest $_target + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # return since it's done + return ${env:hestiaKERNEL_ERROR_OK} + } + + + + + # determine unpack destination based on level-1 Filesystem Hierarchy Standard + # only the following are used: + # (1) bin/ - holds executables + # (2) lib/ - holds libraries + # (3) etc/ - holds configurations + # (4) docs/ - holds documentations + if ($(hestiaFS-Is-Filename-Has $_target "-docs") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__dest = "${_directory}\docs" + } elseif (($(hestiaFS-Is-Filename-Has $_target "lib") -eq ${env:hestiaKERNEL_ERROR_OK})) { + $__dest = "${_directory}\lib" + + if ( + ($(hestiaNPM-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaRUST-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + $__dest = $_directory # distribution oriented libraries + } + } elseif ($(hestiaWASM-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__dest = "${_directory}\etc" + } else { + $__dest = "${_directory}\bin" + if ( + ($(hestiaTAR-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaZIP-Is-Target-Valid $_target) -eq $hestiaKERNEL_ERROR_OK) + ) { + $__dest = $_directory + } + } + + + + + # assemble based on target's nature + if ($(hestiaTAR-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # unpack tar* + $null = hestiaCONSOLE-Log-Assemble $__dest $_target + $null = hestiaFS-Create-Directory $__dest + $___process = hestiaTAR-Unpack $__dest $_target + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } elseif ($(hestiaZIP-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # unpack zip + $null = hestiaCONSOLE-Log-Assemble $__dest $_target + $null = hestiaFS-Create-Directory $__dest + $___process = hestiaZIP-Unpack $__dest $_target + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } else { + # assemble standalone file + $___filename = hestiaFS-Get-File $_target + $null = hestiaCONSOLE-Log-Assemble "${__dest}\${___filename}" $_target + $null = hestiaFS-Create-Directory $__dest + $___process = hestiaFS-Copy-File "${__dest}\${___filename}" $_target + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return $hestiaKERNEL_ERROR_BAD_EXEC + } + + # if it is WASM artifact, then check for its gluing js script + # whenever available. + if ($(hestiaWASM-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__source = "$(hestiaFS-Replace-Extension $_target ".wasm" ".js")" + if ($(hestiaFS-Is-File $__source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__dest = "${__dest}\$(hestiaFS-Get-File $__source)" + $null = hestiaCONSOLE-Log-Assemble $__dest $_target + $___process = hestiaFS-Copy-File ` + "${__dest}\$(hestiaFS-Get-File $_target)" ` + $_target + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + } + + + + + # sanitize check before proceeding + $null = hestiaCONSOLE-Log-Check $_directory + if ($(hestiaFS-Is-Directory-Empty $_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # return early if documents are requested not to be included + if ($(hestiaSTRING-Is-Empty $_exclude_docs) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + + + # copy user guide files for all languages + foreach ($__source in ( + Get-ChildItem -File ` + -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` + -Filter "USER-GUIDES*.pdf" + )) { + $__dest = "${_directory}\$(hestiaFS-Get-File $__source)" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # copy license files for all languages + foreach ($__source in ( + Get-ChildItem -File ` + -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + -Filter "LICENSE*.pdf" + )) { + $__dest = "${_directory}\$(hestiaFS-Get-File $__source)" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # copy icon.png + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" + $__dest = "${_directory}\icon.png" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/automataCI/_package-archive_unix-any.sh b/automataCI/_package-archive_unix-any.sh index 24a54b6..23f6750 100644 --- a/automataCI/_package-archive_unix-any.sh +++ b/automataCI/_package-archive_unix-any.sh @@ -10,11 +10,15 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/archive/tar.sh" -. "${LIBS_AUTOMATACI}/services/archive/zip.sh" +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNUPKG/Package.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNPM/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaRUST/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaTAR/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaZIP/Vanilla.sh.ps1" @@ -28,113 +32,435 @@ fi -PACKAGE_Run_ARCHIVE() { - #__line="$1" +PACKAGE_ARCHIVE() { + #__filename="$1" + #__target="$2" + #__target_os="$3" + #__target_arch="$4" + #__package_time="$5" + #__directory_output="$6" + #__arguments="$7" - # parse input - __line="$1" - _dest="${__line%%|*}" - __line="${__line#*|}" - _target="${__line%%|*}" - __line="${__line#*|}" + # validate input + hestiaCONSOLE_Log_Check_Availability "TAR" + if [ $(hestiaTAR_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi - _target_filename="${__line%%|*}" - __line="${__line#*|}" + hestiaCONSOLE_Log_Check_Availability "ZIP" + if [ $(hestiaZIP_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi - _target_os="${__line%%|*}" - __line="${__line#*|}" - _target_arch="${__line%%|*}" - __line="${__line#*|}" - # validate input - I18N_Check_Availability "TAR" - TAR_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 + # prepare workspace and required values + __package_sku="$PROJECT_SKU" + if [ $(hestiaFS_Is_Filename_Has "$2" "$PROJECT_DOCS_ID") -eq $hestiaKERNEL_ERROR_OK ]; then + __package_sku="${PROJECT_SKU}-${PROJECT_DOCS_ID}" + elif [ $(hestiaFS_Is_Filename_Has "$2" "lib") -eq $hestiaKERNEL_ERROR_OK ]; then + __package_sku="lib${PROJECT_SKU}" + if [ $(hestiaNPM_Is_Target_Valid "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + # npm package + __package_sku="${PROJECT_SKU}-${PROJECT_NODE_NPM_ID}" + elif [ $(hestiaRUST_Is_Target_Valid "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + # rust crate package + __package_sku="${PROJECT_SKU}-${PROJECT_RUST_ID}" + elif [ $(hestiaFS_Is_Filename_Has "$2" "$PROJECT_C_ID") -eq $hestiaKERNEL_ERROR_OK ]; then + # complied c package + __package_sku="lib${PROJECT_SKU}-${PROJECT_C_ID}" + fi fi - I18N_Check_Availability "ZIP" - TAR_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - # prepare workspace and required values - I18N_Create_Package "ARCHIVE" - _src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}" - _target_path="${_dest}/${_src}" + + # remake workspace + _src="${__package_sku}_${3}-${4}" _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-archive-${_src}" - I18N_Remake "$_src" - FS_Remake_Directory "$_src" - if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 + hestiaCONSOLE_Log_Recreate "$_src" + hestiaFS_Recreate_Directory "$_src" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_ARCHIVE_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 + + + # import external assembly function + __cmd="PACKAGE_Assemble_ARCHIVE_Content" + hestiaCONSOLE_Log_Check_Availability "$__cmd" + + __file_assembly="${PROJECT_PATH_CI}/package-archive_unix-any.sh" + __file_assembly="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${__file_assembly}" + if [ $(hestiaFS_Is_File "$__file_assembly") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + . "$__file_assembly" + + if [ $(hestiaOS_Is_Command_Available "$__cmd") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC fi - I18N_Assemble_Package - "$cmd" "$_target" "$_src" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - FS_Remove_Silently "$_src" - return 0 + + + + # execute assembly function + hestiaCONSOLE_Log_Run "$__cmd" + "$__cmd" "$2" "$_src" "$1" "$3" "$4" + ___process=$? + case "$___process" in + $hestiaKERNEL_ERROR_CANCELLED) + hestiaCONSOLE_Log_Run_Skipped "$___process" + return $hestiaKERNEL_ERROR_OK ;; - 0) + $hestiaKERNEL_ERROR_OK) ;; *) - I18N_Assemble_Failed - return 1 + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC ;; esac - # change location into the workspace - __current_path="$PWD" && cd "$_src" # archive the assembled payload - case "$_target_os" in - windows) - _target_path="${_target_path}.zip" - I18N_Package "$_target_path" - ZIP_Create "$_target_path" "." + __package="${__package_sku}_${PROJECT_VERSION}_${3}-${4}" + + + + + # assemble project README file + __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" + __dest="${_src}/${PROJECT_README}" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + if [ $(hestiaFS_Is_File "$__dest") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" ___process=$? - ;; - *) - _target_path="${_target_path}.tar.xz" - I18N_Package "$_target_path" - TAR_Create_XZ "$_target_path" "." + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # assemble project LICENSE file + __source="${PROJECT_PATH_ROOT}/${PROJECT_LICENSE_FILE}" + __dest="${_src}/${PROJECT_LICENSE_FILE}" + if [ $(hestiaFS_Is_File "$__dest") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" ___process=$? - ;; - esac + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi - # head back to current directory - cd "$__current_path" && unset __current_path - # report status - if [ $___process -ne 0 ]; then - return 1 + # package npm package when detected + if [ $(hestiaNPM_Is_Target_Valid "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "$PROJECT_NODE_NPM_ID") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK # disabled explicitly + fi + + # package npm.tgz + __dest="${6}/${__package_sku}_${PROJECT_VERSION}_${3}-${4}.tgz" + hestiaCONSOLE_Log_Package "$__dest" + hestiaTAR_Pack "$__dest" "$_src" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + # can't be packaged as something else - report status + return $hestiaKERNEL_ERROR_OK + fi + + + + + # package crate package when detected + if [ $(hestiaRUST_Is_Target_Valid "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + # package .crate + # TODO during Rust porting + + + # can't be packaged as something else - report status + return $hestiaKERNEL_ERROR_OK + fi + + + + + # package coventional archive files + if [ $(hestiaSTRING_Is_Empty "$PROJECT_RELEASE_ARCHIVE") -ne $hestiaKERNEL_ERROR_OK ]; then + # package tar.xz + __dest="${6}/${__package}.tar.xz" + hestiaCONSOLE_Log_Package "$__dest" + hestiaTAR_Pack "$__dest" "$_src" "xz" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + # package zip + __dest="${6}/${__package}.zip" + hestiaCONSOLE_Log_Package "$__dest" + hestiaZIP_Pack "$__dest" "$_src" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # package chocolatey nupkg + if ([ "$3" = "any" ] || [ "$3" = "windows" ]) && + [ $(hestiaSTRING_Is_Empty "$PROJECT_CHOCOLATEY_URL") -ne $hestiaKERNEL_ERROR_OK ]; then + # create required tools/ directory + hestiaFS_Create_Directory "${_src}/tools" + + + # create required tools/ChocolateyBeforeModify.ps1 + __source="tools/ChocolateyBeforeModify.ps1" + __dest="${_src}/${__source}" + hestiaCONSOLE_Log_Create "$__dest" + if [ $(hestiaFS_Is_File "$__dest") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + hestiaFS_Write_File "$__dest" "\ +# REQUIRED - BEGIN EXECUTION +Write-Host \"Performing pre-configurations...\" +" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/chocolatey/${__source}" + if [ $(hestiaFS_Is_File "$__source") -eq $hestiaKERNEL_ERROR_OK ]; then + __old_IFS="$IFS" + while IFS= read -r __line || [ -n "$__line" ]; do + if [ $(hestiaSTRING_Has "$__line" "Done by AutomataCI") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "$__dest" "${__line}\n" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "$__source" + IFS="$__old_IFS" && unset __old_IFS + fi + + + # create required tools/ChocolateyInstall.ps1 + __source="tools/ChocolateyInstall.ps1" + __dest="${_src}/${__source}" + hestiaCONSOLE_Log_Create "$__dest" + if [ $(hestiaFS_Is_File "$__dest") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + hestiaFS_Write_File "$__dest" "\ +# REQUIRED - PREPARING INSTALLATION +Write-Host \"Installing ${__package_sku} (${PROJECT_VERSION})...\" +" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/chocolatey/${__source}" + if [ $(hestiaFS_Is_File "$__source") -eq $hestiaKERNEL_ERROR_OK ]; then + __old_IFS="$IFS" + while IFS= read -r __line || [ -n "$__line" ]; do + if [ $(hestiaSTRING_Has "$__line" "Done by AutomataCI") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "$__dest" "${__line}\n" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "$__source" + IFS="$__old_IFS" && unset __old_IFS + fi + + + # create required tools/ChocolateyUninstall.ps1 + __source="tools/ChocolateyUninstall.ps1" + __dest="${_src}/${__source}" + hestiaCONSOLE_Log_Create "$__dest" + if [ $(hestiaFS_Is_File "$__dest") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + hestiaFS_Write_File "$__dest" "\ +# REQUIRED - PREPARING UNINSTALLATION +Write-Host \"Uninstalling ${__package_sku} (${PROJECT_VERSION})...\" +" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/chocolatey/${__source}" + if [ $(hestiaFS_Is_File "$__source") -eq $hestiaKERNEL_ERROR_OK ]; then + __old_IFS="$IFS" + while IFS= read -r __line || [ -n "$__line" ]; do + if [ $(hestiaSTRING_Has "$__line" "Done by AutomataCI") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "$__dest" "${__line}\n" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Create_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "$__source" + IFS="$__old_IFS" && unset __old_IFS + fi + + + # create chocolatey nuspec files + # IMPORTANT: Chocolatey specifically mentions only use + # dash (-) as the separator and not others + # including the nupkg's dot (.) specification. + # Please comply for consistencies and + # compatibilities purposes. + # + # The default pattern here considers the + # possibility of facilitating cross-compilation + # services at the guest side. + __id="${PROJECT_SCOPE}-${__package_sku}-${3}-${4}" + __id="${__id}-${PROJECT_CHOCOLATEY_ID}" + __title="${PROJECT_NAME} (${__package_sku} ${3}-${4})" + + __dest="${__id}_${PROJECT_VERSION}_${3}-${4}.nupkg" + __dest="${6}/${__dest}" + hestiaCONSOLE_Log_Package "$__dest" + hestiaNUPKG_Package \ + "$__dest" \ + "$_src" \ + "$__id" \ + "$PROJECT_VERSION" \ + "$PROJECT_PITCH" \ + "$PROJECT_CONTACT_NAME" \ + "$PROJECT_CONTACT_WEBSITE" \ + "$PROJECT_LICENSE_FILE" \ + "icon.png" \ + "$PROJECT_README" \ + "$PROJECT_LICENSE_ACCEPTANCE_REQUIRED" \ + "$PROJECT_SOURCE_URL" \ + "$__title" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # clean up chocolatey's artifacts + hestiaFS_Remove "${_src}/tools/ChocolateyBeforeModify.ps1" + hestiaFS_Remove "${_src}/tools/ChocolateyInstall.ps1" + hestiaFS_Remove "${_src}/tools/ChocolateyUninstall.ps1" + if [ "$(hestiaFS_Is_Directory_Empty "${_src}/tools")" -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "${_src}/tools" fi - return 0 + for __nuspec in "${_src}/"*.nuspec; do + hestiaFS_Remove "$__nuspec" + done + + + + + # package DOTNET nupkg + if [ $(hestiaSTRING_Is_Empty "$PROJECT_NUPKG_URL") -ne $hestiaKERNEL_ERROR_OK ]; then + # IMPORTANT: Nupkg specifically mentions the current practice + # is to use dot (.) namespacing as ID. Please + # comply for consistencies and compatibilities + # purposes. + # + # The default pattern here considers the + # possibility of facilitating cross-compilation + # services at the guest side. + __id="${PROJECT_SCOPE}.${__package_sku}.${3}.${4}" + __title="${PROJECT_NAME} (${__package_sku} ${3}-${4})" + + __dest="${__package}.nupkg" + __dest="${6}/${__dest}" + hestiaCONSOLE_Log_Package "$__dest" + hestiaNUPKG_Package \ + "$__dest" \ + "$_src" \ + "$__id" \ + "$PROJECT_VERSION" \ + "$PROJECT_PITCH" \ + "$PROJECT_CONTACT_NAME" \ + "$PROJECT_CONTACT_WEBSITE" \ + "$PROJECT_LICENSE_FILE" \ + "icon.png" \ + "$PROJECT_README" \ + "$PROJECT_LICENSE_ACCEPTANCE_REQUIRED" \ + "$PROJECT_SOURCE_URL" \ + "$__title" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # clean up from DOTNET nupkg + for __nuspec in "${_src}/"*.nuspec; do + hestiaFS_Remove "$__nuspec" + done + + + + + # report status + return $hestiaKERNEL_ERROR_OK } diff --git a/automataCI/_package-archive_windows-any.ps1 b/automataCI/_package-archive_windows-any.ps1 index 49da491..ea8655d 100644 --- a/automataCI/_package-archive_windows-any.ps1 +++ b/automataCI/_package-archive_windows-any.ps1 @@ -1,132 +1,459 @@ +#!/bin/sh # Copyright 2023 (Holloway) Chew, Kean Ho # # Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" -. "${env:LIBS_AUTOMATACI}\services\archive\zip.ps1" +# License for the specific language governing permissions and limitations under +# the License. +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNUPKG\Package.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNPM\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Is_Command_Available.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaRUST\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaTAR\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaZIP\Vanilla.sh.ps1" # initialize if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataIC\ci.sh.ps1 instead!`n" - return + Write-Error "[ ERROR ] - Please run from automataIC\ci.sh.ps1 instead!`n" + return } -function PACKAGE-Run-ARCHIVE { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # validate input - $null = I18N-Check-Availability "TAR" - $___process = TAR-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Check-Availability "ZIP" - $___process = ZIP-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # prepare workspace and required values - $null = I18N-Create-Package "ARCHIVE" - $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" - $_target_path = "${_dest}\${_src}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-archive-${_src}" - $null = I18N-Remake "${_src}" - $___process = FS-Remake-Directory "${_src}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-ARCHIVE-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-ARCHIVE-Content ` - ${_target} ` - ${_src} ` - ${_target_filename} ` - ${_target_os} ` - ${_target_arch} - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - $null = FS-Remove-Silently "${_src}" - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # change location into the workspace - $__current_path = Get-Location - $null = Set-Location -Path "${_src}" - - - # archive the assembled payload - switch ($_target_os) { - windows { - $_target_path = "${_target_path}.zip" - $null = I18N-Package "${_target_path}" - $___process = ZIP-Create "${_target_path}" "." - } Default { - $_target_path = "${_target_path}.tar.xz" - $null = I18N-Package "${_target_path}" - $___process = TAR-Create-XZ "${_target_path}" "." - }} - - - # head back to current directory - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - - - # report status - if ($___process -ne 0) { - return 1 - } - - return 0 +function PACKAGE-ARCHIVE { + param ( + [string]$_filename, + [string]$_target, + [string]$_target_os, + [string]$_target_arch, + [string]$_package_time, + [string]$_directory_output, + [string]$_arguments + ) + + + + + # validate input + $null = hestiaCONSOLE-Log-Check-Availability "TAR" + if ($(hestiaTAR-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $null = hestiaCONSOLE-Log-Check-Availability "ZIP" + if ($(hestiaZIP-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # prepare workspace and required values + $__package_sku = ${env:PROJECT_SKU} + if ($(hestiaFS-Is-Filename-Has $_target ${env:PROJECT_DOCS_ID}) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__package_sku = "${env:PROJECT_SKU}-${env:PROJECT_DOCS_ID}" + } elseif ($(hestiaFS-Is-Filename-Has $_target "lib") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $__package_sku = "lib${env:PROJECT_SKU}" + + if ($(hestiaNPM-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # npm package + $__package_sku = "${env:PROJECT_SKU}-${env:PROJECT_NODE_NPM_ID}" + } elseif ($(hestiaRUST-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # rust crate package + $__package_sku = "${env:PROJECT_SKU}-${env:PROJECT_RUST_ID}" + } elseif ($(hestiaFS-Is-Filename-Has $_target ${env:PROJECT_C_ID}) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # complied c package + $__package_sku = "lib${env:PROJECT_SKU}-${env:PROJECT_C_ID}" + } + } + + + + + # remake workspace + $_src = "${__package_sku}_${_target_os}-${_target_arch}" + $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-archive-${_src}" + $null = hestiaCONSOLE-Log-Recreate $_src + $___process = hestiaFS-Recreate-Directory $_src + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # assemble project specified files to the workspace + $__cmd = "PACKAGE-Assemble-ARCHIVE-Content" + $null = hestiaCONSOLE-Log-Check-Availability $__cmd + + $__file_assembly = "${env:PROJECT_PATH_CI}\package-archive_windows-any.ps1" + $__file_assembly = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${__file_assembly}" + if ($(hestiaFS-Is-File $__file_assembly) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + . $__file_assembly + + if ($(hestiaOS-Is-Command-Available $__cmd) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # execute assembly function + $null = hestiaCONSOLE-Log-Run $__cmd + $___process = PACKAGE-Assemble-ARCHIVE-Content ` + $_target ` + $_src ` + $_target_filename ` + $_target_os ` + $_target_arch + switch ($___process) { + ${env:hestiaKERNEL_ERROR_CANCELLED} { + $null = hestiaCONSOLE-Log-Run-Skipped $___process + return ${env:hestiaKERNEL_ERROR_OK} + } ${env:hestiaKERNEL_ERROR_OK} { + # proceed further + } default { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + }} + + + + + # archive the assembled payload + $__package = "${__package_sku}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" + + + + + # assemble project README file + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" + $__dest = "${_src}\${env:PROJECT_README}" + if ($(hestiaFS-Is-File $__dest) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # assemble project LICENSE file + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_LICENSE_FILE}" + $__dest = "${_src}\${env:PROJECT_LICENSE_FILE}" + if ($(hestiaFS-Is-File $__dest) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # package npm package when detected + if ($(hestiaNPM-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaSTRING-Is-Empty ${env:PROJECT_NODE_NPM_ID}) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} # disabled explictly + } + + + # package npm.tgz + $__dest = "${__package_sku}_${env:PROJECT_VERSION}" + $__dest = "${_directory_output}\${__dest}_${_target_os}-${_target_arch}.tgz" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaTAR-Pack $__dest $_src + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # can't be packaged as something else - report status + return ${env:hestiaKERNEL_ERROR_OK} + } + + + + + # package crate package when detected + if ($(hestiaRUST-Is-Target-Valid $_target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # package .crate + # TODO during Rust porting + + + # can't be packaged as something else - report status + return ${env:hestiaKERNEL_ERROR_OK} + } + + + + + # package coventional archive files + if ($(hestiaSTRING-Is-Empty ${env:PROJECT_RELEASE_ARCHIVE}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + # package tar.xz + $__dest = "${_directory_output}\${__package}.tar.xz" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaTAR-Pack $__dest $_src "xz" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # package zip + $__dest = "${_directory_output}\${__package}.zip" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaZIP-Pack $__dest $_src + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # package chocolatey nupkg + if ( + (($_target_os -eq "any") -or ($_target_os -eq "windows")) -and + ($(hestiaSTRING-Is-Empty ${env:PROJECT_CHOCOLATEY_URL}) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + # create required tools\ directory + $null = hestiaFS-Create-Directory "${_src}\tools" + + + # create required tools\ChocolateyBeforeModify.ps1 + $__source = "tools\ChocolateyBeforeModify.ps1" + $__dest = "${_src}\${__source}" + $null = hestiaCONSOLE-Log-Create $__dest + if ($(hestiaFS-Is-File $__dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___process = hestiaFS-Write-File $__dest @" +# REQUIRED - BEGIN EXECUTION +Write-Host "Performing pre-configurations..." + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\data\chocolatey\${__source}" + if ($(hestiaFS-Is-File $__source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($__line in (Get-Content -Path $__source)) { + if ($(hestiaSTRING-Has $__line "Done by AutomataCI") -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___process = hestiaFS-Append-File $__dest "${__line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + + + # create required tools\ChocolateyInstall.ps1 + $__source = "tools\ChocolateyInstall.ps1" + $__dest = "${_src}\${__source}" + $null = hestiaCONSOLE-Log-Create $__dest + if ($(hestiaFS-Is-File $__dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___process = hestiaFS-Write-File $__dest @" +# REQUIRED - PREPARING INSTALLATION +Write-Host "Installing ${__package_sku} (${env:PROJECT_VERSION})..." + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\data\chocolatey\${__source}" + if ($(hestiaFS-Is-File $__source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($__line in (Get-Content -Path $__source)) { + if ($(hestiaSTRING-Has $__line "Done by AutomataCI") -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___process = hestiaFS-Append-File $__dest "${__line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + + + # create required tools\ChocolateyUninstall.ps1 + $__source = "tools\ChocolateyUninstall.ps1" + $__dest = "${_src}\${__source}" + $null = hestiaCONSOLE-Log-Create $__dest + if ($(hestiaFS-Is-File $__dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___process = hestiaFS-Write-File $__dest @" +# REQUIRED - PREPARING UNINSTALLATION +Write-Host "Uninstalling ${__package_sku} (${env:PROJECT_VERSION})..." + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\data\chocolatey\${__source}" + if ($(hestiaFS-Is-File $__source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($__line in (Get-Content -Path $__source)) { + if ($(hestiaSTRING-Has $__line "Done by AutomataCI") -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___process = hestiaFS-Append-File $__dest "${__line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Create-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + + + # create chocolatey nuspec files + # IMPORTANT: Chocolatey specifically mentions only use + # dash (-) as the separator and not others + # including the nupkg's dot (.) specification. + # Please comply for consistencies and + # compatibilities purposes. + # + # The default pattern here considers the + # possibility of facilitating cross-compilation + # services at the guest side. + $__id = "${env:PROJECT_SCOPE}-${__package_sku}-${_target_os}-${_target_arch}" + $__id = "${__id}-${env:PROJECT_CHOCOLATEY_ID}" + $__title = "${env:PROJECT_NAME} (${__package_sku} ${_target_os}-${_target_arch})" + + $__dest = "${__id}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" + $__dest = "${_directory_output}\${__dest}" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaNUPKG-Package ` + $__dest ` + $_src ` + $__id ` + ${env:PROJECT_VERSION} ` + ${env:PROJECT_PITCH} ` + ${env:PROJECT_CONTACT_NAME} ` + ${env:PROJECT_CONTACT_WEBSITE} ` + ${env:PROJECT_LICENSE_FILE} ` + "icon.png" ` + ${env:PROJECT_README} ` + ${env:PROJECT_LICENSE_ACCEPTANCE_REQUIRED} ` + ${env:PROJECT_SOURCE_URL} ` + $__title + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # clean up chocolatey's artifacts + $null = hestiaFS-Remove "${_src}\tools\ChocolateyBeforeModify.ps1" + $null = hestiaFS-Remove "${_src}\tools\ChocolateyInstall.ps1" + $null = hestiaFS-Remove "${_src}\tools\ChocolateyUninstall.ps1" + if ($(hestiaFS-Is-Directory-Empty "${_src}\tools") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove "${_src}\tools" + } + + foreach ($__nuspec in (Get-ChildItem -File -Path $_src -Filter "*.nuspec")) { + $null = hestiaFS-Remove $__nuspec + } + + + + + # package DOTNET nupkg + if ($(hestiaSTRING-Is-Empty ${env:PROJECT_NUPKG_URL}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + # IMPORTANT: Nupkg specifically mentions the current practice + # is to use dot (.) namespacing as ID. Please + # comply for consistencies and compatibilities + # purposes. + # + # The default pattern here considers the + # possibility of facilitating cross-compilation + # services at the guest side. + $__id = "${env:PROJECT_SCOPE}.${__package_sku}.${_target_os}.${_target_arch}" + $__title = "${env:PROJECT_NAME} (${__package_sku} ${_target_os}-${_target_arch})" + + $__dest = "${__package}.nupkg" + $__dest = "${_directory_output}\${__dest}" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaNUPKG-Package ` + $__dest ` + $_src ` + $__id ` + ${env:PROJECT_VERSION} ` + ${env:PROJECT_PITCH} ` + ${env:PROJECT_CONTACT_NAME} ` + ${env:PROJECT_CONTACT_WEBSITE} ` + ${env:PROJECT_LICENSE_FILE} ` + "icon.png" ` + ${env:PROJECT_README} ` + ${env:PROJECT_LICENSE_ACCEPTANCE_REQUIRED} ` + ${env:PROJECT_SOURCE_URL} ` + $__title + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # clean up from DOTNET nupkg + foreach ($__nuspec in (Get-ChildItem -File -Path $_src -Filter "*.nuspec")) { + $null = hestiaFS-Remove $__nuspec + } + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} } diff --git a/automataCI/_package-cargo_unix-any.sh b/automataCI/_package-cargo_unix-any.sh deleted file mode 100644 index de9fd79..0000000 --- a/automataCI/_package-cargo_unix-any.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/rust.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_CARGO() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # validate input - if [ $(STRINGS_Is_Empty "$PROJECT_RUST") -eq 0 ]; then - return 0 - fi - - I18N_Check_Availability "RUST" - RUST_Activate_Local_Environment - RUST_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 0 - fi - - - # prepare workspace and required values - I18N_Create_Package "RUST" - _src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}" - _target_path="${_dest}/cargo_${_src}" - _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-cargo-${_src}" - I18N_Remake "$_src" - FS_Remake_Directory "$_src" - if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 - fi - - I18N_Check "$_target_path" - FS_Is_Directory "$_target_path" - if [ $? -eq 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_CARGO_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_src" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - FS_Remove_Silently "$_src" - return 0 - ;; - 0) - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # archive the assembled payload - I18N_Package "$_target_path" - FS_Make_Directory "$_target_path" - RUST_Create_Archive "$_src" "$_target_path" - if [ $? -ne 0 ]; then - I18N_Package_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/automataCI/_package-cargo_windows-any.ps1 b/automataCI/_package-cargo_windows-any.ps1 deleted file mode 100644 index f1c74e5..0000000 --- a/automataCI/_package-cargo_windows-any.ps1 +++ /dev/null @@ -1,116 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\rust.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-CARGO { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # validate input - if ($(STRINGS-Is-Empty "${env:PROJECT_RUST}") -eq 0) { - return 0 - } - - $null = I18N-Check-Availability "RUST" - $null = RUST-Activate-Local-Environment - $___process = RUST-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 0 - } - - - # prepare workspace and required values - $null = I18N-Create-Package "RUST" - $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" - $_target_path = "${_dest}\cargo_${_src}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-cargo-${_src}" - $null = I18N-Remake "${_src}" - $___process = FS-Remake-Directory "${_src}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - $null = I18N-Check "${_target_path}" - $___process = FS-Is-Directory "${_target_path}" - if ($___process -eq 0) { - $null = I18N-Check-Failed - return 1 - } - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-CARGO-Content" - $null = I18N-Check-Function "${cmd}" - $___process = OS-Is-Command-Available "${cmd}" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-CARGO-Content ` - ${_target} ` - ${_src} ` - ${_target_filename} ` - ${_target_os} ` - ${_target_arch} - if ($___process -eq 10) { - $null = I18N-Assemble-Skipped - $null = FS-Remove-Silently "${_src}" - return 0 - } elseif ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # archive the assembled payload - $null = I18N-Package "${_target_path}" - $null = FS-Make-Directory "${_target_path}" - $___process = RUST-Create-Archive "${_src}" "${_target_path}" - if ($___process -ne 0) { - $null = I18N-Package-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/automataCI/_package-changelog_unix-any.sh b/automataCI/_package-changelog_unix-any.sh deleted file mode 100644 index 0e8131b..0000000 --- a/automataCI/_package-changelog_unix-any.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/changelog.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_CHANGELOG() { - __changelog_md="$1" - __changelog_deb="$2" - - - I18N_Check_Availability "CHANGELOG" - CHANGELOG_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # validate input - I18N_Validate "${PROJECT_VERSION} CHANGELOG" - CHANGELOG_Compatible_DATA_Version \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ - "$PROJECT_VERSION" - if [ $? -ne 0 ]; then - I18N_Validate_Failed - return 1 - fi - - I18N_Validate "${PROJECT_VERSION} DEB CHANGELOG" - CHANGELOG_Compatible_DEB_Version \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ - "$PROJECT_VERSION" - if [ $? -ne 0 ]; then - I18N_Validate_Failed - return 1 - fi - - - # assemble changelog - I18N_Create "$__changelog_md" - CHANGELOG_Assemble_MD \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ - "$__changelog_md" \ - "$PROJECT_VERSION" \ - "$PROJECT_CHANGELOG_TITLE" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - I18N_Create "$__changelog_deb" - FS_Make_Directory "${__changelog_deb%/*}" - CHANGELOG_Assemble_DEB \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog" \ - "$__changelog_deb" \ - "$PROJECT_VERSION" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/automataCI/_package-changelog_windows-any.ps1 b/automataCI/_package-changelog_windows-any.ps1 deleted file mode 100644 index 5e3048e..0000000 --- a/automataCI/_package-changelog_windows-any.ps1 +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\changelog.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-CHANGELOG { - param ( - [string]$__changelog_md, - [string]$__changelog_deb - ) - - - $null = I18N-Check-Availability "CHANGELOG" - $___process = CHANGELOG-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # validate input - $null = I18N-Validate "${env:PROJECT_VERSION} CHANGELOG" - $___process = CHANGELOG-Compatible-DATA-Version ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` - "${env:PROJECT_VERSION}" - if ($___process -ne 0) { - $null = I18N-Validate-Failed - return 1 - } - - $null = I18N-Validate "${env:PROJECT_VERSION} DEB CHANGELOG" - $___process = CHANGELOG-Compatible-DEB-Version ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` - "${env:PROJECT_VERSION}" - if ($___process -ne 0) { - $null = I18N-Validate-Failed - return 1 - } - - - # assemble changelog - $null = I18N-Create "${__changelog_md}" - $___process = CHANGELOG-Assemble-MD ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` - "${__changelog_md}" ` - "${env:PROJECT_VERSION}" ` - "${env:PROJECT_CHANGELOG_TITLE}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - $null = I18N-Create "${__changelog_deb}" - $null = FS-Make-Housing-Directory "${__changelog_deb}" - $___process = CHANGELOG-Assemble-DEB ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog" ` - "${__changelog_deb}" ` - "${env:PROJECT_VERSION}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/automataCI/_package-chocolatey_unix-any.sh b/automataCI/_package-chocolatey_unix-any.sh deleted file mode 100644 index 87d0639..0000000 --- a/automataCI/_package-chocolatey_unix-any.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/publishers/chocolatey.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_CHOCOLATEY() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # validate input - I18N_Check_Availability "ZIP" - ZIP_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # prepare workspace and required values - I18N_Create_Package "CHOCOLATEY" - _src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}" - _target_path="${_dest}/${_src}" - _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-choco-${_src}" - I18N_Remake "$_src" - FS_Remake_Directory "$_src" - if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 - fi - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_CHOCOLATEY_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_src" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - FS_Remove_Silently "$_src" - return 0 - ;; - 0) - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # check nuspec file is available - I18N_Check ".nuspec" - __name="" - for __file in "${_src}/"*.nuspec; do - FS_Is_File "${__file}" - if [ $? -eq 0 ]; then - if [ $(STRINGS_Is_Empty "$__name") -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - __name="${__file##*/}" - __name="${__name%.nuspec*}" - fi - done - - if [ $(STRINGS_Is_Empty "$__name") -eq 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # archive the assembled payload - __name="${__name}-chocolatey_${PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" - __name="${_dest}/${__name}" - I18N_Archive "$__name" - CHOCOLATEY_Archive "$__name" "$_src" - if [ $? -ne 0 ]; then - I18N_Archive_Failed - return 1 - fi - - - # test the package - I18N_Test "$__name" - CHOCOLATEY_Is_Available - if [ $? -eq 0 ]; then - CHOCOLATEY_Test "$__name" - if [ $? -ne 0 ]; then - I18N_Test_Failed - return 1 - fi - else - I18N_Test_Skipped - fi - - - # report status - return 0 -} diff --git a/automataCI/_package-chocolatey_windows-any.ps1 b/automataCI/_package-chocolatey_windows-any.ps1 deleted file mode 100644 index 7b158d9..0000000 --- a/automataCI/_package-chocolatey_windows-any.ps1 +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\chocolatey.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-CHOCOLATEY { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # validate input - $null = I18N-Check-Availability "ZIP" - $___process = ZIP-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # prepare workspace and required values - $null = I18N-Create-Package "CHOCOLATEY" - $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" - $_target_path = "${_dest}\${_src}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-choco-${_src}" - $null = I18N-Remake "${_src}" - $___process = FS-Remake-Directory "${_src}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-CHOCOLATEY-Content" - $null = I18N-Check-Function "${cmd}" - $___process = OS-Is-Command-Available "PACKAGE-Assemble-CHOCOLATEY-Content" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-CHOCOLATEY-Content ` - "${_target}" ` - "${_src}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - $null = FS-Remove-Silently "${_src}" - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # check nuspec is available - $null = I18N-Check ".nuspec metadata" - $__name = "" - foreach ($__file in (Get-ChildItem -File -Path "${_src}\*.nuspec")) { - if ($(STRINGS-Is-Empty "${__name}") -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $__name = $__file.Name -replace '\.nuspec.*$', '' - } - - if ($(STRINGS-Is-Empty "${__name}") -eq 0) { - $null = I18N-Check-Failed - return 1 - } - - - # archive the assembled payload - $__name = "${__name}-chocolatey_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" - $__name = "${_dest}\${__name}" - $null = I18N-Archive "${__name}" - $___process = CHOCOLATEY-Archive "${__name}" "${_src}" - if ($___process -ne 0) { - $null = I18N-Archive-Failed - return 1 - } - - - # test the package - $null = I18N-Test "${__name}" - $___process = CHOCOLATEY-Is-Available - if ($___process -eq 0) { - $___process = CHOCOLATEY-Test "${__name}" - if ($___process -ne 0) { - $null = I18N-Test-Failed - return 1 - } - } else { - $null = I18N-Test-Skipped - } - - - # report status - return 0 -} diff --git a/automataCI/_package-citation_unix-any.sh b/automataCI/_package-citation_unix-any.sh deleted file mode 100644 index 54bb8c4..0000000 --- a/automataCI/_package-citation_unix-any.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/time.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/citation.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_CITATION() { - __citation_cff="$1" - - - # assemble citation - I18N_Create "$__citation_cff" - CITATION_Build \ - "$__citation_cff" \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/ABSTRACTS.txt" \ - "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/CITATIONS.yml" \ - "$PROJECT_CITATION" \ - "$PROJECT_CITATION_TYPE" \ - "$(TIME_Format_Date_ISO8601 "$(TIME_Now)")" \ - "$PROJECT_NAME" \ - "$PROJECT_VERSION" \ - "$PROJECT_LICENSE" \ - "$PROJECT_SOURCE_URL" \ - "$PROJECT_SOURCE_URL" \ - "$PROJECT_STATIC_URL" \ - "$PROJECT_CONTACT_NAME" \ - "$PROJECT_CONTACT_WEBSITE" \ - "$PROJECT_CONTACT_EMAIL" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/automataCI/_package-citation_windows-any.ps1 b/automataCI/_package-citation_windows-any.ps1 deleted file mode 100644 index 232d02c..0000000 --- a/automataCI/_package-citation_windows-any.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\time.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\citation.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-CITATION { - param( - [string]$__citation_cff - ) - - # execute - $null = I18N-Create "${__citation_cff}" - $___process = CITATION-Build ` - "${__citation_cff}" ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\ABSTRACTS.txt" ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\CITATIONS.yml" ` - "${env:PROJECT_CITATION}" ` - "${env:PROJECT_CITATION_TYPE}" ` - "$(TIME-Format-Date-ISO8601 "$(TIME-Now)")" ` - "${env:PROJECT_NAME}" ` - "${env:PROJECT_VERSION}" ` - "${env:PROJECT_LICENSE}" ` - "${env:PROJECT_SOURCE_URL}" ` - "${env:PROJECT_SOURCE_URL}" ` - "${env:PROJECT_STATIC_URL}" ` - "${env:PROJECT_CONTACT_NAME}" ` - "${env:PROJECT_CONTACT_WEBSITE}" ` - "${env:PROJECT_CONTACT_EMAIL}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/automataCI/_package-consolidate_unix-any.sh b/automataCI/_package-consolidate_unix-any.sh new file mode 100644 index 0000000..71cd903 --- /dev/null +++ b/automataCI/_package-consolidate_unix-any.sh @@ -0,0 +1,84 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Is_File.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaOS/Is_Command_Available.sh.ps1" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +PACKAGE_CONSOLIDATE() { + #__filename="$1" + #__target="$2" + #__target_os="$3" + #__target_arch="$4" + #__package_time="$5" + #__directory_output="$6" + #__arguments="$7" + + + + + # import external assembly function + __cmd="PACKAGE_Assemble_CONSOLIDATE_Content" + hestiaCONSOLE_Log_Check_Availability "$__cmd" + + __file_assembly="${PROJECT_PATH_CI}/package-consolidate_unix-any.sh" + __file_assembly="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${__file_assembly}" + if [ $(hestiaFS_Is_File "$__file_assembly") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + . "$__file_assembly" + + if [ $(hestiaOS_Is_Command_Available "$__cmd") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # execute assembly function + hestiaCONSOLE_Log_Run "$__cmd" + "$__cmd" "$2" "$6" "$1" "$3" "$4" + ___process=$? + case "$___process" in + $hestiaKERNEL_ERROR_CANCELLED) + hestiaCONSOLE_Log_Run_Skipped "$___process" + return $hestiaKERNEL_ERROR_OK + ;; + $hestiaKERNEL_ERROR_OK) + ;; + *) + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + ;; + esac + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/automataCI/_package-consolidate_windows-any.ps1 b/automataCI/_package-consolidate_windows-any.ps1 new file mode 100644 index 0000000..010fe8a --- /dev/null +++ b/automataCI/_package-consolidate_windows-any.ps1 @@ -0,0 +1,88 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Is_Command_Available.sh.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataIC\ci.sh.ps1 instead!`n" + return +} + + + + +function PACKAGE-CONSOLIDATE { + param ( + [string]$_filename, + [string]$_target, + [string]$_target_os, + [string]$_target_arch, + [string]$_package_time, + [string]$_directory_output, + [string]$_arguments + ) + + + + + # import external assembly function + $__cmd = "PACKAGE-Assemble-CONSOLIDATE-Content" + $null = hestiaCONSOLE-Log-Check-Availability $__cmd + + $__file_assembly = "${env:PROJECT_PATH_CI}\package-consolidate_windows-any.ps1" + $__file_assembly = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${__file_assembly}" + if ($(hestiaFS-Is-File $__file_assembly) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + . $__file_assembly + + if ($(hestiaOS-Is-Command-Available $__cmd) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # execute assembly function + $null = hestiaCONSOLE-Log-Run $__cmd + $___process = PACKAGE-Assemble-CONSOLIDATE-Content ` + $_target ` + $_directory_output ` + $_target_filename ` + $_target_os ` + $_target_arch + switch ($___process) { + ${env:hestiaKERNEL_ERROR_CANCELLED} { + $null = hestiaCONSOLE-Log-Run-Skipped $___process + return ${env:hestiaKERNEL_ERROR_OK} + } ${env:hestiaKERNEL_ERROR_OK} { + # proceed further + } default { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + }} + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/automataCI/_package-homebrew_unix-any.sh b/automataCI/_package-homebrew_unix-any.sh deleted file mode 100644 index d93674f..0000000 --- a/automataCI/_package-homebrew_unix-any.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/publishers/homebrew.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_HOMEBREW() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - _src="${__line%%|*}" - - - # validate input - - - # prepare workspace and required values - I18N_Create_Package "HOMEBREW" - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_HOMEBREW_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_src" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - return 0 - ;; - 0) - # accepted - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # report status - return 0 -} diff --git a/automataCI/_package-homebrew_windows-any.ps1 b/automataCI/_package-homebrew_windows-any.ps1 deleted file mode 100644 index 0a1c0cd..0000000 --- a/automataCI/_package-homebrew_windows-any.ps1 +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\homebrew.ps1" - - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-HOMEBREW { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - $_src = $__list[5] - - - # validate input - - - # prepare workspace and required values - $null = I18N-Create-Package "HOMEBREW" - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-HOMEBREW-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-HOMEBREW-Content ` - "${_target}" ` - "${_src}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # report status - return 0 -} diff --git a/automataCI/_package-lib_unix-any.sh b/automataCI/_package-lib_unix-any.sh deleted file mode 100644 index c9b6cbb..0000000 --- a/automataCI/_package-lib_unix-any.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_LIB() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_LIB_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_dest" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - return 0 - ;; - 0) - # accepted - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # report status - return 0 -} diff --git a/automataCI/_package-lib_windows-any.ps1 b/automataCI/_package-lib_windows-any.ps1 deleted file mode 100644 index f784801..0000000 --- a/automataCI/_package-lib_windows-any.ps1 +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-LIB { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-LIB-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-LIB-Content ` - "${_target}" ` - "${_dest}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # report status - return 0 -} diff --git a/automataCI/_package-msi_unix-any.sh b/automataCI/_package-msi_unix-any.sh deleted file mode 100644 index cc03817..0000000 --- a/automataCI/_package-msi_unix-any.sh +++ /dev/null @@ -1,744 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/msi.sh" -. "${LIBS_AUTOMATACI}/services/crypto/random.sh" -. "${LIBS_AUTOMATACI}/services/hestiaLOCALE/Vanilla.sh.ps1" -. "${LIBS_AUTOMATACI}/services/hestiaI18N/Vanilla.sh.ps1" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Seal_MSI() { - __workspace="$1" - __output_directory="$2" - - - # obtain buildable target architecture - _target_arch="$(FS_Get_File "$__workspace")" - I18N_Check "MSI: '$_target_arch'" - case "$_target_arch" in - amd64) - ;; - *) - I18N_Check_Incompatible_Skipped - return 0 # wixl does not support other arch aside amd64 - ;; - esac - - - # validate icon.ico available - __icon_filepath="${__workspace}/icon.ico" - I18N_Check "$__icon_filepath" - FS_Is_File "$__icon_filepath" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # validate msi-banner.jpg is available - __banner_filepath="${__workspace}/msi-banner.jpg" - I18N_Check "$__banner_filepath" - FS_Is_File "$__banner_filepath" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # validate msi-dialog.jpg is available - __dialog_filepath="${__workspace}/msi-dialog.jpg" - I18N_Check "$__dialog_filepath" - FS_Is_File "$__dialog_filepath" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # create wxs scripts by languages - __old_IFS="$IFS" - while IFS="" read -r __language || [ -n "$__language" ]; do - # formulate destination path - __dest="${__workspace}/${PROJECT_SKU}_${__language}_windows-${_target_arch}.wxs" - I18N_Check_Availability "$__dest" - FS_Is_File "$__dest" - if [ $? -eq 0 ]; then - # user supplied - begin packaging - I18N_Package "$__dest" - MSI_Compile "$__dest" "$_target_arch" "$__language" - if [ $? -ne 0 ]; then - I18N_Package_Failed - return 1 - fi - - continue - fi - - - # creating wxs headers - I18N_Create "$__dest" - FS_Write_File "$__dest" "\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CMDLINE_${PROJECT_MSI_INSTALL_DIRECTORY} - - - - CMDLINE_${PROJECT_MSI_INSTALL_DIRECTORY} - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - __source="${__workspace}/bin" - FS_Is_Directory_Empty "$__source" - if [ $? -ne 0 ]; then - ## write the opener - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - ## loop through each file and create the following - for __file in "${__source}/"*; do - FS_Is_File "$__file" - if [ $? -ne 0 ]; then - continue - fi - - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - done - - ## write the closure - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - fi - - __source="${__workspace}/config" - FS_Is_Directory_Empty "$__source" - if [ $? -ne 0 ]; then - ## write the opener - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - ## loop through each file and create the following - for __file in "${__source}/"*; do - FS_Is_File "$__file" - if [ $? -ne 0 ]; then - continue - fi - - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - done - - ## write the closure - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - fi - - __source="${__workspace}/lib" - FS_Is_Directory_Empty "$__source" - if [ $? -ne 0 ]; then - ## write the opener - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - ## loop through each file and create the following - for __file in "${__source}/"*; do - FS_Is_File "$__file" - if [ $? -ne 0 ]; then - continue - fi - - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - done - - ## write the closure - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - fi - - __source="${__workspace}/docs" - FS_Is_Directory_Empty "$__source" - if [ $? -ne 0 ]; then - ## write the opener - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - ## loop through each file and create the following - for __file in "${__source}/"*; do - FS_Is_File "$__file" - if [ $? -ne 0 ]; then - continue - fi - - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - done - - ## write the closure - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - fi - - - # close directory section - FS_Append_File "$__dest" "\ - - - - - - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # define all feature components - FS_Append_File "$__dest" "\ - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # write bin feature list - FS_Is_Directory_Empty "${__workspace}/bin" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - - # write config feature list - FS_Is_Directory_Empty "${__workspace}/config" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - - # write lib feature list - FS_Is_Directory_Empty "${__workspace}/lib" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - - # write docs feature list - FS_Is_Directory_Empty "${__workspace}/docs" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - - # close feature list - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # conclude the wxs write-up - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # begin packaging - I18N_Package "$__dest" - MSI_Compile "$__dest" "$_target_arch" "$__language" - if [ $? -ne 0 ]; then - I18N_Package_Failed - return 1 - fi - done < -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\msi.ps1" -. "${env:LIBS_AUTOMATACI}\services\crypto\random.ps1" -. "${env:LIBS_AUTOMATACI}\services\hestiaLOCALE\Vanilla.sh.ps1" -. "${env:LIBS_AUTOMATACI}\services\hestiaI18N\Vanilla.sh.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Seal-MSI { - param( - [string]$__workspace, - [string]$__output_directory - ) - - - # obtain buildable target architecture - $_target_arch = FS-Get-File "${__workspace}" - $null = I18N-Check "MSI: '${_target_arch}'" - switch (${_target_arch}) { - { $_ -in "amd64", "arm64", "i386", "arm" } { - # accepted - } default { - $null = I18N-Check-Incompatible-Skipped - return 0 # not supported - }} - - - # validate icon.ico is available - $__icon_filepath = "${__workspace}\icon.ico" - $null = I18N-Check "${__icon_filepath}" - $___process = FS-Is-File "${__icon_filepath}" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # validate msi-banner.jpg is available - $__banner_filepath = "${__workspace}\msi-banner.jpg" - $null = I18N-Check "${__banner_filepath}" - $___process = FS-Is-File "${__banner_filepath}" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # validate msi-dialog.jpg is available - $__dialog_filepath = "${__workspace}\msi-banner.jpg" - $null = I18N-Check "${__dialog_filepath}" - $___process = FS-Is-File "${__dialog_filepath}" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # create wxs scripts by languages - foreach ($__language in (-split $(hestiaI18N-Get-Languages-List))) { - # validate LICENSE_[LANG}.rtf is available - $__license_filepath = "${__workspace}\docs\LICENSE_${__language}.rtf" - $null = I18N-Check "${__license_filepath}" - $___process = FS-Is-File "${__license_filepath}" - if ($___process -ne 0) { - ## look for generic one as last resort - $__license_filepath = "${__workspace}\docs\LICENSE.rtf" - $null = I18N-Check "${__license_filepath}" - $___process = FS-Is-File "${__license_filepath}" - if ($___process -ne 0) { - $null = I18N-Check-Failed-Skipped - continue ## no license file - skipping - } - } - - - # formulate destination path - $__dest = "${env:PROJECT_SKU}_${__language}_windows-${_target_arch}.wxs" - $__dest = "${__workspace}\${__dest}" - $null = I18N-Check-Availability "${__dest}" - $___process = FS-Is-File "${__dest}" - if ($___process -eq 0) { - # user supplied - begin packaging - $null = I18N-Package "${__dest}" - $___process = MSI-Compile "${__dest}" "${_target_arch}" "${__language}" - if ($___process -ne 0) { - $null = I18N-Package-Failed - return 1 - } - - continue - } - - - # creating wxs headers - $null = I18N-Create "${__dest}" - $___process = FS-Write-File "${__dest}" @" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - $__source = "${__workspace}\bin" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - $__source = "${__workspace}\config" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - $__source = "${__workspace}\lib" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # Close directory tree definitions - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - ## begin assemble bin/* files - $__source = "${__workspace}\bin" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - ## write the opener - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - ## loop through each file and create the following - foreach ($__file in (Get-ChildItem "${__source}" -File)) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - } - - ## write the closure - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - ## begin assemble config/* files - $__source = "${__workspace}\config" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - ## write the opener - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - ## loop through each file and create the following - foreach ($__file in (Get-ChildItem "${__source}" -File)) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - } - - ## write the closure - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - ## begin assemble lib/* files - $__source = "${__workspace}\lib" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - ## write the opener - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - ## loop through each file and create the following - foreach ($__file in (Get-ChildItem "${__source}" -File)) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - } - - ## write the closure - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - ## begin assemble docs/* files - $__source = "${__workspace}\docs" - $___process = FS-Is-Directory-Empty "${__source}" - if ($___process -ne 0) { - ## write the opener - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - ## loop through each file and create the following - foreach ($__file in (Get-ChildItem "${__source}" -File)) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - } - - ## write the closure - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # create registry key - $___process = FS-Append-File "${__dest}" @" - - - - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # Define all feature components - $___process = FS-Append-File "${__dest}" @" - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # write bin feature list - $___process = FS-Is-Directory-Empty "${__workspace}\bin" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # write config feature list - $___process = FS-Is-Directory-Empty "${__workspace}\config" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # write lib feature list - $___process = FS-Is-Directory-Empty "${__workspace}\lib" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # write docs feature list - $___process = FS-Is-Directory-Empty "${__workspace}\docs" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - - # close feature list - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # Add standard UI support - $___process = FS-Append-File "${__dest}" @" - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # conclude the wxs write-up - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # begin packaging - $null = I18N-Package "${__dest}" - $___process = MSI-Compile "${__dest}" "${_target_arch}" "${__language}" - if ($___process -ne 0) { - $null = I18N-Package-Failed - return 1 - } - } - - - # begin export packages - foreach ($__line in (Get-ChildItem -Path "${__workspace}" -File ` - | Where-Object { ($_.Name -like "*.msi") })) { - $__dest = "${__output_directory}\$(FS-Get-File "${__line}")" - - $null = I18N-Export "${__dest}" - $___process = FS-Copy-File "${__line}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } - } - - - # report status - return 0 -} - - - - -function PACKAGE-Sort-MSI { - param( - [string]$__workspace - ) - - - # execute - $__source = "${__workspace}\any" - $null = I18N-Check "${__source}" - $___process = FS-Is-Directory "${__source}" - if ($___process -ne 0) { - return 0 # nothing to sort - report status - } - - :arch_loop foreach ($_arch in (Get-ChildItem -Path "${__workspace}" -Directory)) { - $_arch = $_arch.FullName - $___process = FS-Is-Directory "${_arch}" - if ($___process -ne 0) { - continue arch_loop - } - - if ("$(FS-Get-File "${_arch}")" -eq "any") { - continue arch_loop - } - - # begin merging from any - :any_loop foreach ($__target in (Get-ChildItem -Path "${__workspace}\any")) { - $__target = $__target.FullName - - $___process = FS-Is-File "${__target}" - if ($___process -eq 0) { - $__dest = FS-Get-File "${__target}" - $__dest = "${_arch}\${__dest}" - $null = I18N-Copy "${__target}" "${__dest}" - $___process = FS-Is-File "${__dest}" - if ($___process -eq 0) { - $null = I18N-Copy-Exists-Skipped - continue any_loop # do not overwrite - } - - $___process = FS-Copy-File "${__target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Copy-Failed - return 1 - } - - continue any_loop - } - - - # it's a directory, loop it - :any_dir_loop foreach ($__file in (Get-ChildItem -Path "${__target}")) { - $__file = $__file.FullName - - $___process = FS-Is-File "${__file}" - if ($___process -ne 0) { - continue any_dir_loop - } - - $__dest = "$(FS-Get-File "${__file}")" - $__dest = "${_arch}\$(FS-Get-File "${__target}")\${__dest}" - $null = I18N-Copy "${__file}" "${__dest}" - $___process = FS-Is-File "${__dest}" - if ($___process -eq 0) { - $null = I18N-Copy-Exists-Skipped - continue any_dir_loop # do not overwrite - } - - $___process = FS-Copy-File "${__file}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Copy-Failed - return 1 - } - } - } - } - - - # remove 'any' to prevent bad compilation - $___process = FS-Remove "${__workspace}/any" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # report status - return 0 -} - - - - -function PACKAGE-Run-MSI { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - $_src = $__list[5] - - - # validate input - $null = I18N-Check-Availability "MSI" - $___process = MSI-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 0 - } - - - # prepare workspace and required values - $null = I18N-Create-Package "MSI" - $_src = "${_src}\${_target_arch}" - $null = FS-Make-Directory "${_src}\bin" - $null = FS-Make-Directory "${_src}\config" - $null = FS-Make-Directory "${_src}\docs" - $null = FS-Make-Directory "${_src}\ext" - $null = FS-Make-Directory "${_src}\lib" - - - # copy all complimentary files to the workspace - $null = I18N-Check-Function "PACKAGE-Assemble-MSI-Content" - $___process = OS-Is-Command-Available "PACKAGE-Assemble-MSI-Content" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-MSI-Content ` - "${_target}" ` - "${_src}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - $null = FS-Remove-Silently "${_src}" - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # report status - return 0 -} diff --git a/automataCI/_package-pdf_unix-any.sh b/automataCI/_package-pdf_unix-any.sh deleted file mode 100644 index 6f486b7..0000000 --- a/automataCI/_package-pdf_unix-any.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_PDF() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_PDF_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_dest" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - return 0 - ;; - 0) - # accepted - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # report status - return 0 -} diff --git a/automataCI/_package-pdf_windows-any.ps1 b/automataCI/_package-pdf_windows-any.ps1 deleted file mode 100644 index fd78da0..0000000 --- a/automataCI/_package-pdf_windows-any.ps1 +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-PDF { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-PDF-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-PDF-Content ` - "${_target}" ` - "${_dest}" ` - "${_target_filename}" ` - "${_target_os}" ` - "${_target_arch}" - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - return 0 - } 0 { - # accepted - } Default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # report status - return 0 -} diff --git a/automataCI/_package-pypi_unix-any.sh b/automataCI/_package-pypi_unix-any.sh deleted file mode 100644 index 7399772..0000000 --- a/automataCI/_package-pypi_unix-any.sh +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/os.sh" -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/python.sh" - - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Run_PYPI() { - #__line="$1" - - - # parse input - __line="$1" - - _dest="${__line%%|*}" - __line="${__line#*|}" - - _target="${__line%%|*}" - __line="${__line#*|}" - - _target_filename="${__line%%|*}" - __line="${__line#*|}" - - _target_os="${__line%%|*}" - __line="${__line#*|}" - - _target_arch="${__line%%|*}" - __line="${__line#*|}" - - - # validate input - if [ $(FS_Is_Target_A_PYPI "$_target") -ne 0 ]; then - return 0 - fi - - if [ $(STRINGS_Is_Empty "$PROJECT_PYTHON") -eq 0 ]; then - return 0 - fi - - I18N_Check_Availability "PYTHON" - PYTHON_Activate_VENV - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Check_Availability "PYPI" - PYTHON_PYPI_Is_Available - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # prepare workspace and required values - I18N_Create "PYPI" - _src="${_target_filename}_${PROJECT_VERSION}_${_target_os}-${_target_arch}" - _target_path="${_dest}/pypi_${_src}" - _src="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-pypi-${_src}" - I18N_Remake "$_src" - FS_Remake_Directory "$_src" - if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 - fi - - I18N_Check "$_target_path" - FS_Is_Directory "$_target_path" - if [ $? -eq 0 ]; then - I18N_Check_Failed - return 1 - fi - - - # copy all complimentary files to the workspace - cmd="PACKAGE_Assemble_PYPI_Content" - I18N_Check_Function "$cmd" - OS_Is_Command_Available "$cmd" - if [ $? -ne 0 ]; then - I18N_Check_Failed - return 1 - fi - - I18N_Assemble_Package - "$cmd" "$_target" "$_src" "$_target_filename" "$_target_os" "$_target_arch" - case $? in - 10) - I18N_Assemble_Skipped - FS_Remove_Silently "$_src" - return 0 - ;; - 0) - # accepted - ;; - *) - I18N_Assemble_Failed - return 1 - ;; - esac - - - # generate required files - I18N_Create "pyproject.toml" - PYTHON_Create_PYPI_Config \ - "$_src" \ - "$PROJECT_NAME" \ - "$PROJECT_VERSION" \ - "$PROJECT_CONTACT_NAME" \ - "$PROJECT_CONTACT_EMAIL" \ - "$PROJECT_CONTACT_WEBSITE" \ - "$PROJECT_PITCH" \ - "$PROJECT_PYPI_README" \ - "$PROJECT_PYPI_README_MIME" \ - "$PROJECT_LICENSE" - case $? in - 2) - I18N_Injection_Manual_Detected - ;; - 0) - ;; - *) - I18N_Create_Failed - return 1 - ;; - esac - - - # archive the assembled payload - I18N_Package "$_target_path" - FS_Make_Directory "$_target_path" - PYTHON_Create_PYPI_Archive "$_src" "$_target_path" - if [ $? -ne 0 ]; then - I18N_Package_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/automataCI/_package-pypi_windows-any.ps1 b/automataCI/_package-pypi_windows-any.ps1 deleted file mode 100644 index 62ee7b5..0000000 --- a/automataCI/_package-pypi_windows-any.ps1 +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\os.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\python.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -function PACKAGE-Run-PYPI { - param ( - [string]$__line - ) - - - # parse input - $__list = $__line -split "\|" - $_dest = $__list[0] - $_target = $__list[1] - $_target_filename = $__list[2] - $_target_os = $__list[3] - $_target_arch = $__list[4] - - - # validate input - if ($(FS-Is-Target-A-PYPI "${_target}") -ne 0) { - return 0 - } - - if ($(STRINGS-Is-Empty "${env:PROJECT_PYTHON}") -eq 0) { - return 0 - } - - $null = I18N-Check-Availability "PYTHON" - $___process = PYTHON-Activate-VENV - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Check-Availability "PYPI" - $___process = PYTHON-PYPI-Is-Available - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - - # prepare workspace and required values - $null = I18N-Create "PYPI" - $_src = "${_target_filename}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}" - $_target_path = "${_dest}\pypi_${_src}" - $_src = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-pypi-${_src}" - $null = I18N-Remake "${_src}" - $___process = FS-Remake-Directory "${_src}" - if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 - } - - - $null = I18N-Check "${_target_path}" - $___process = FS-Is-Directory "${_target_path}" - if ($___process -eq 0) { - $null = I18N-Check-Failed - return 1 - } - - - # copy all complimentary files to the workspace - $cmd = "PACKAGE-Assemble-PYPI-Content" - $null = I18N-Check-Function "$cmd" - $___process = OS-Is-Command-Available "$cmd" - if ($___process -ne 0) { - $null = I18N-Check-Failed - return 1 - } - - $null = I18N-Assemble-Package - $___process = PACKAGE-Assemble-PYPI-Content ` - ${_target} ` - ${_src} ` - ${_target_filename} ` - ${_target_os} ` - ${_target_arch} - switch ($___process) { - 10 { - $null = I18N-Assemble-Skipped - $null = FS-Remove-Silently "${_src}" - return 0 - } 0 { - # accepted - } default { - $null = I18N-Assemble-Failed - return 1 - }} - - - # generate required files - $null = I18N-Create "${_src}\pyproject.toml" - $___process = PYTHON-Create-PYPI-Config ` - "${_src}" ` - "${env:PROJECT_NAME}" ` - "${env:PROJECT_VERSION}" ` - "${env:PROJECT_CONTACT_NAME}" ` - "${env:PROJECT_CONTACT_EMAIL}" ` - "${env:PROJECT_CONTACT_WEBSITE}" ` - "${env:PROJECT_PITCH}" ` - "${env:PROJECT_PYPI_README}" ` - "${env:PROJECT_PYPI_README_MIME}" ` - "${env:PROJECT_LICENSE}" - switch ($___process) { - 2 { - $null = I18N-Injection-Manual-Detected - } 0 { - # accepted - } default { - $null = I18N-Create-Failed - return 1 - }} - - - # archive the assembled payload - $null = I18N-Package "${_target_path}" - $null = FS-Make-Directory "${_target_path}" - $___process = PYTHON-Create-PYPI-Archive "${_src}" "${_target_path}" - if ($___process -ne 0) { - $null = I18N-Package-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/automataCI/_package-single_unix-any.sh b/automataCI/_package-single_unix-any.sh new file mode 100644 index 0000000..8639f2a --- /dev/null +++ b/automataCI/_package-single_unix-any.sh @@ -0,0 +1,85 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Is_File.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaOS/Is_Command_Available.sh.ps1" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +PACKAGE_SINGLE() { + #__filename="$1" + #__target="$2" + #__target_os="$3" + #__target_arch="$4" + #__package_time="$5" + #__directory_output="$6" + #__arguments="$7" + + + + + # import external assembly function + __cmd="PACKAGE_Assemble_SINGLE_Content" + hestiaCONSOLE_Log_Check_Availability "$__cmd" + + __file_assembly="${PROJECT_PATH_CI}/package-single_unix-any.sh" + __file_assembly="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${__file_assembly}" + if [ $(hestiaFS_Is_File "$__file_assembly") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + . "$__file_assembly" + + if [ $(hestiaOS_Is_Command_Available "$__cmd") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # execute assembly function + hestiaCONSOLE_Log_Run "$__cmd" + "$__cmd" "$2" "$6" "$1" "$3" "$4" + ___process=$? + case "$___process" in + $hestiaKERNEL_ERROR_CANCELLED) + hestiaCONSOLE_Log_Run_Skipped "$___process" + return $hestiaKERNEL_ERROR_OK + ;; + $hestiaKERNEL_ERROR_OK) + # accepted + ;; + *) + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + ;; + esac + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/automataCI/_package-single_windows-any.ps1 b/automataCI/_package-single_windows-any.ps1 new file mode 100644 index 0000000..9b2470b --- /dev/null +++ b/automataCI/_package-single_windows-any.ps1 @@ -0,0 +1,88 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Is_Command_Available.sh.ps1" + + + + +# initialize +if (-not (Test-Path -Path ${env:PROJECT_PATH_ROOT})) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + + + + +function PACKAGE-SINGLE { + param ( + [string]$__filename, + [string]$__target, + [string]$__target_os, + [string]$__target_arch, + [string]$__package_time, + [string]$__directory_output, + [string]$__arguments + ) + + + + + # import external assembly function + $__cmd = "PACKAGE-Assemble-SINGLE-Content" + $null = hestiaCONSOLE-Log-Check-Availability $__cmd + + $__file_assembly = "${env:PROJECT_PATH_CI}\package-single_windows-any.ps1" + $__file_assembly = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${__file_assembly}" + if ($(hestiaFS-Is-File $__file_assembly) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Run-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + $null = . $__file_assembly + + if ($(hestiaOS-Is-Command-Available $__cmd) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # execute assembly function + $null = hestiaCONSOLE-Log-Run $__cmd + $___process = PACKAGE-Assemble-SINGLE-Content ` + $__target ` + $__directory_output ` + $__filename ` + $__target_os ` + $__target_arch + switch ($___process) { + ${env:hestiaKERNEL_ERROR_CANCELLED} { + $null = hestiaCONSOLE-Log-Run-Skipped $___process + return ${env:hestiaKERNEL_ERROR_OK} + } ${env:hestiaKERNEL_ERROR_OK} { + # accepted + } default { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + }} + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/automataCI/_package-sourcing_unix-any.sh b/automataCI/_package-sourcing_unix-any.sh deleted file mode 100644 index ed4ee7b..0000000 --- a/automataCI/_package-sourcing_unix-any.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -# source from baseline -tech_list="\ -${PROJECT_PATH_SOURCE:-none} -${PROJECT_ANGULAR:-none} -${PROJECT_C:-none} -${PROJECT_GO:-none} -${PROJECT_NIM:-none} -${PROJECT_PYTHON:-none} -${PROJECT_RESEARCH:-none} -${PROJECT_RUST:-none} -" - -old_IFS="$IFS" -while IFS="" read -r tech || [ -n "$tech" ]; do - # validate input - if [ $(STRINGS_Is_Empty "$tech") -eq 0 ] || - [ "$(STRINGS_To_Uppercase "$tech")" = "NONE" ]; then - continue - fi - - - # execute - package_fx="${PROJECT_PATH_ROOT}/${tech}/${PROJECT_PATH_CI}/package_unix-any.sh" - FS_Is_File "$package_fx" - if [ $? -eq 0 ]; then - I18N_Source "$package_fx" - . "$package_fx" - if [ $? -ne 0 ]; then - I18N_Source_Failed - return 1 - fi - fi -done < -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return -} - - - - -# execute -## IMPORTANT NOTE: -## (1) Appearently, PowerShell disallowed globally scoped dot import inside -## a function. Hence, we don't have a choice but to do repetition. -if ($(STRINGS-Is-Empty "${env:PROJECT_PATH_SOURCE}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_ANGULAR}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_ANGULAR}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_C}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_C}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_GO}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_GO}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_NIM}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_NIM}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_PYTHON}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PYTHON}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_RESEARCH}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_RESEARCH}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} - -if ($(STRINGS-Is-Empty "${env:PROJECT_RUST}") -ne 0) { - $package_fx = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_RUST}" - $package_fx = "${package_fx}\${env:PROJECT_PATH_CI}\package_windows-any.ps1" - if ($(FS-Is-File "$package_fx") -eq 0) { - $null = I18N-Source "${package_fx}" - - $___process = . $package_fx - if ($___process -ne 0) { - $null = I18N-Source-Failed - return 1 - } - } -} diff --git a/automataCI/_package-windows_unix-any.sh b/automataCI/_package-windows_unix-any.sh new file mode 100644 index 0000000..f6e2e3b --- /dev/null +++ b/automataCI/_package-windows_unix-any.sh @@ -0,0 +1,241 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNUPKG/Get.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaOS/Is_Command_Available.sh.ps1" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +PACKAGE_WINDOWS() { + #__filename="$1" + #__target="$2" + #__target_os="$3" + #__target_arch="$4" + #__package_time="$5" + #__directory_output="$6" + #__arguments="$7" + + + + + # validate packager capabilities + case "$3" in + any|windows) + # accepted + ;; + *) + return $hestiaKERNEL_ERROR_OK # not supported + ;; + esac + + + case "$4" in + any|amd64) + # accepted + ;; + arm64|i386|arm) + return $hestiaKERNEL_ERROR_OK # msitools only supports amd64 + ;; + *) + return $hestiaKERNEL_ERROR_OK # not supported + ;; + esac + + + + + # prepare source directory + __directory_source="${6}/${4}" + hestiaFS_Create_Directory "${__directory_source}/bin" + hestiaFS_Create_Directory "${__directory_source}/etc" + hestiaFS_Create_Directory "${__directory_source}/share/doc" + hestiaFS_Create_Directory "${__directory_source}/lib" + + + + + # import external assembly function + __cmd="PACKAGE_Assemble_WINDOWS_Content" + hestiaCONSOLE_Log_Check_Availability "$__cmd" + + __file_assembly="${PROJECT_PATH_CI}/package-windows_unix-any.sh" + __file_assembly="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${__file_assembly}" + if [ $(hestiaFS_Is_File "$__file_assembly") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + . "$__file_assembly" + + if [ $(hestiaOS_Is_Command_Available "$__cmd") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Check_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # execute assembly function + hestiaCONSOLE_Log_Run "$__cmd" + "$__cmd" "$2" "$__directory_source" "$1" "$3" "$4" + ___process=$? + case "$___process" in + $hestiaKERNEL_ERROR_CANCELLED) + hestiaCONSOLE_Log_Run_Skipped "$___process" + return $hestiaKERNEL_ERROR_OK + ;; + $hestiaKERNEL_ERROR_OK) + # proceed further + ;; + *) + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + ;; + esac + + + + + # assemble project README file + __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" + __dest="${__directory_source}/share/doc/${PROJECT_README}" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + if [ $(hestiaFS_Is_File "$__dest") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # assemble project LICENSE file + __source="${PROJECT_PATH_ROOT}/${PROJECT_LICENSE_FILE}" + __dest="${__directory_source}/share/doc/${PROJECT_LICENSE_FILE}" + if [ $(hestiaFS_Is_File "$__dest") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + + + # copy all license RTF files for all languages + for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.rtf; do + if [ $(hestiaFS_Is_Exist "$__source") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + __dest="${__directory_source}/share/doc/$(hestiaFS_Get_File "$__source")" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done + + + + + # assemble icon.ico + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon.ico" + __dest="${__directory_source}/icon.ico" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # assemble msi-banner.jpg + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-banner.jpg" + __dest="${__directory_source}/msi-banner.jpg" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # assemble msi-dialog.jpg + __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-dialog.jpg" + __dest="${__directory_source}/msi-dialog.jpg" + hestiaCONSOLE_Log_Assemble "$__dest" "$__source" + hestiaFS_Copy_File "$__dest" "$__source" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Assemble_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + + + # assemble UI extension + # IMPORTANT_NOTICE + # (1) While already tested, it appears msitools cannot use WiX's + # .NET extension libraries. Hence, let's comment it out since + # it cannot generate GUI elements anyway. + #___ext="WixToolset.UI.wixext" + #__source="wixext4/${___ext}.dll" + #__dest="$__directory_source" + #hestiaCONSOLE_Log_Assemble "${__dest}/${___ext}.dll" "$__source" + #hestiaNUPKG_Get \ + # "${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/${PROJECT_PATH_DOTNET_ENGINE}" \ + # "https://www.nuget.org/api/v2/package" \ + # "$___ext" \ + # "4.0.3" \ + # "" \ + # "$__dest" \ + # "$__source" + #if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + # hestiaCONSOLE_Log_Assemble_Failed + # return $hestiaKERNEL_ERROR_BAD_EXEC + #fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/automataCI/_package-windows_windows-any.ps1 b/automataCI/_package-windows_windows-any.ps1 new file mode 100644 index 0000000..46e8476 --- /dev/null +++ b/automataCI/_package-windows_windows-any.ps1 @@ -0,0 +1,226 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNUPKG\Get.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Is_Command_Available.sh.ps1" + + + + +# initialize +if (-not (Test-Path -Path ${env:PROJECT_PATH_ROOT})) { + Write-Error "[ ERROR ] - Please run from automataIC\ci.sh.ps1 instead!`n" + return +} + + + + +function PACKAGE-WINDOWS { + param ( + [string]$__filename, + [string]$__target, + [string]$__target_os, + [string]$__target_arch, + [string]$__package_time, + [string]$__directory_output, + [string]$__arguments + ) + + + + + # validate packager capabilities + switch ($__target_os) { + { $_ -in "any", "windows" } { + # accepted + } default { + return ${env:hestiaKERNEL_ERROR_OK} # not supported + }} + + + switch ($__target_arch) { + { $_ -in "any", "amd64", "arm64", "i386", "arm" } { + # accepted + } default { + return ${env:hestiaKERNEL_ERROR_OK} # not supported + }} + + + + + # prepare source directory + $__directory_source = "${__directory_output}\${__target_arch}" + $null = hestiaFS-Create-Directory "${__directory_source}\bin" + $null = hestiaFS-Create-Directory "${__directory_source}\etc" + $null = hestiaFS-Create-Directory "${__directory_source}\share\doc" + $null = hestiaFS-Create-Directory "${__directory_source}\lib" + + + + + # import external assembly function + $__cmd = "PACKAGE-Assemble-WINDOWS-Content" + $null = hestiaCONSOLE-Log-Check-Availability $__cmd + + $__file_assembly = "${env:PROJECT_PATH_CI}\package-windows_windows-any.ps1" + $__file_assembly = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${__file_assembly}" + if ($(hestiaFS-Is-File $__file_assembly) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + . $__file_assembly + + if ($(hestiaOS-Is-Command-Available $__cmd) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Check-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # execute assembly function + $null = hestiaCONSOLE-Log-Run $__cmd + $___process = PACKAGE-Assemble-WINDOWS-Content ` + $__target ` + $__directory_source ` + $__target_filename ` + $__target_os ` + $__target_arch + switch ($___process) { + ${env:hestiaKERNEL_ERROR_CANCELLED} { + $null = hestiaCONSOLE-Log-Run-Skipped $___process + return ${env:hestiaKERNEL_ERROR_OK} + } ${env:hestiaKERNEL_ERROR_OK} { + # proceed further + } default { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + }} + + + + + # assemble project README file + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" + $__dest = "${__directory_source}\share\doc\${env:PROJECT_README}" + if ($(hestiaFS-Is-File $__dest) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # assemble project LICENSE file + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_LICENSE_FILE}" + $__dest = "${__directory_source}\share\doc\${env:PROJECT_LICENSE_FILE}" + if ($(hestiaFS-Is-File $__dest) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # copy all license RTF files for all languages + foreach ($__source in (Get-ChildItem ` + -File ` + -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` + -Filter "LICENSE*.rtf" + )) { + $__dest = "${__directory_source}\share\doc\$(hestiaFS-Get-File $__source)" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + + # assemble icon.ico + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon.ico" + $__dest = "${__directory_source}\icon.ico" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # assemble msi-banner.jpg + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-banner.jpg" + $__dest = "${__directory_source}\msi-banner.jpg" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # assemble msi-dialog.jpg + $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-dialog.jpg" + $__dest = "${__directory_source}\msi-dialog.jpg" + $null = hestiaCONSOLE-Log-Assemble $__dest $__source + $___process = hestiaFS-Copy-File $__dest $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # assemble WiX UI extension library + $___ext = "WixToolset.UI.wixext" + $__source = "wixext4\${___ext}.dll" + $__dest = $__directory_source + $null = hestiaCONSOLE-Log-Assemble "${__dest}\${___ext}.dll" $__source + $___process = hestiaNUPKG-Get ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${env:PROJECT_PATH_DOTNET_ENGINE}" ` + "https://www.nuget.org/api/v2/package" ` + $___ext ` + "4.0.3" ` + "" ` + $__dest ` + $__source + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Assemble-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/automataCI/_release-checksum_unix-any.sh b/automataCI/_release-checksum_unix-any.sh index 2229127..d6ab287 100644 --- a/automataCI/_release-checksum_unix-any.sh +++ b/automataCI/_release-checksum_unix-any.sh @@ -69,6 +69,10 @@ RELEASE_Conclude_CHECKSUM() { # gpg sign all packages for TARGET in "$1"/*; do + if [ ! -e "$TARGET" ]; then + continue # last entry is gibbrish from shell + fi + if [ ! "${TARGET%%.asc*}" = "$TARGET" ]; then continue # it's a gpg cert fi @@ -95,6 +99,10 @@ RELEASE_Conclude_CHECKSUM() { # shasum all files for TARGET in "$1"/*; do + if [ ! -e "$TARGET" ]; then + continue # last entry is gibbrish from shell + fi + FS_Is_Directory "$TARGET" if [ $? -eq 0 ]; then I18N_Is_Directory_Skipped "$TARGET" diff --git a/automataCI/_release-citation_unix-any.sh b/automataCI/_release-citation_unix-any.sh index 2b950d2..f71132c 100644 --- a/automataCI/_release-citation_unix-any.sh +++ b/automataCI/_release-citation_unix-any.sh @@ -43,7 +43,9 @@ RELEASE_Run_CITATION_CFF() { # execute I18N_Publish "CITATION.cff" if [ $(OS_Is_Run_Simulated) -ne 0 ]; then - FS_Copy_File "$1" "${PROJECT_PATH_ROOT}/CITATION.cff" + __dest="${PROJECT_PATH_ROOT}/CITATION.cff" + FS_Remove_Silently "$__dest" + FS_Copy_File "$1" "$__dest" if [ $? -ne 0 ]; then I18N_Publish_Failed return 1 diff --git a/automataCI/_release-citation_windows-any.ps1 b/automataCI/_release-citation_windows-any.ps1 index 261a7f4..ab4be3b 100644 --- a/automataCI/_release-citation_windows-any.ps1 +++ b/automataCI/_release-citation_windows-any.ps1 @@ -45,7 +45,9 @@ function RELEASE-Run-CITATION-CFF { # execute $null = I18N-Publish "CITATION.cff" if ($(OS-Is-Run-Simulated) -ne 0) { - $___process = FS-Copy-File "${__target}" "${env:PROJECT_PATH_ROOT}\CITATION.cff" + $__dest = "${env:PROJECT_PATH_ROOT}\CITATION.cff" + $null = FS-Remove-Silently "${__dest}" + $___process = FS-Copy-File "${__target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Publish-Failed return 1 diff --git a/automataCI/_release-lib_unix-any.sh b/automataCI/_release-lib_unix-any.sh index cd7f60e..db7c6c1 100644 --- a/automataCI/_release-lib_unix-any.sh +++ b/automataCI/_release-lib_unix-any.sh @@ -47,6 +47,12 @@ RELEASE_Run_LIBS() { return 0 fi + if [ $(FS_Is_Target_A_TARGZ "$1") -ne 0 ] || + [ $(FS_Is_Target_A_TARXZ "$1") -ne 0 ] || + [ $(FS_Is_Target_A_ZIP "$1") -ne 0 ]; then + return 0 + fi + GIT_Is_Available if [ $? -ne 0 ]; then return 0 @@ -56,17 +62,17 @@ RELEASE_Run_LIBS() { # execute __branch="v${PROJECT_VERSION}" if [ $(FS_Is_Target_A_NPM "$1") -eq 0 ]; then - if [ $(STRINGS_Is_Empty "$PROJECT_NODE_BRANCH_TAG") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_NODE_NPM_ID") -eq 0 ]; then return 0 fi - __branch="${__branch}_${PROJECT_NODE_BRANCH_TAG}" + __branch="${__branch}_${PROJECT_NODE_NPM_ID}" elif [ $(FS_Is_Target_A_C "$1") -eq 0 ]; then - if [ $(STRINGS_Is_Empty "$PROJECT_C_BRANCH_TAG") -eq 0 ]; then + if [ $(STRINGS_Is_Empty "$PROJECT_C_ID") -eq 0 ]; then return 0 fi - __branch="${__branch}_${PROJECT_C_BRANCH_TAG}" + __branch="${__branch}_${PROJECT_C_ID}" else return 0 fi @@ -97,7 +103,7 @@ RELEASE_Run_LIBS() { elif [ $(FS_Is_Target_A_ZIP "$1") -eq 0 ]; then ZIP_Extract "$__workspace" "$1" else - FS_Copy_File "$1" "${__workspace}" + FS_Copy_File "$1" "${__workspace}/$(FS_Get_File "$1")" fi if [ $? -ne 0 ]; then diff --git a/automataCI/_release-lib_windows-any.ps1 b/automataCI/_release-lib_windows-any.ps1 index 0801736..5e08c75 100644 --- a/automataCI/_release-lib_windows-any.ps1 +++ b/automataCI/_release-lib_windows-any.ps1 @@ -49,6 +49,12 @@ function RELEASE-Run-LIBS { return 0 } + if (($(FS-Is-Target-A-TARGZ "${__target}") -ne 0) -or + ($(FS-Is-Target-A-TARXZ "${__target}") -ne 0) -or + ($(FS-Is-Target-A-ZIP "${__target}") -ne 0)) { + return 0 + } + $___process = GIT-Is-Available if ($___process -ne 0) { return 0 @@ -58,17 +64,17 @@ function RELEASE-Run-LIBS { # execute $__branch = "v${env:PROJECT_VERSION}" if ($(FS-Is-Target-A-NPM "${__target}") -eq 0) { - if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_BRANCH_TAG}") -eq 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_NODE_NPM_ID}") -eq 0) { return 0 } - $__branch = "${__branch}_${env:PROJECT_NODE_BRANCH_TAG}" + $__branch = "${__branch}_${env:PROJECT_NODE_NPM_ID}" } elseif ($(FS-Is-Target-A-C "${__target}") -eq 0) { - if ($(STRINGS-Is-Empty "${env:PROJECT_C_BRANCH_TAG}") -eq 0) { + if ($(STRINGS-Is-Empty "${env:PROJECT_C_ID}") -eq 0) { return 0 } - $__branch = "${__branch}_${env:PROJECT_C_BRANCH_TAG}" + $__branch = "${__branch}_${env:PROJECT_C_ID}" } else { return 0 } @@ -102,7 +108,9 @@ function RELEASE-Run-LIBS { } elseif ($(FS-Is-Target-A-ZIP "${__target}") -eq 0) { $___process = ZIP-Extract "${__workspace}" "${__target}" } else { - $___process = FS-Copy-File "${__target}" "${__workspace}" + $___process = FS-Copy-File ` + "${__target}" ` + "${__workspace}\$(FS-Get-File "${__target}")" } if ($___process -ne 0) { diff --git a/automataCI/_release-nupkg_unix-any.sh b/automataCI/_release-nupkg_unix-any.sh new file mode 100644 index 0000000..4966e3e --- /dev/null +++ b/automataCI/_release-nupkg_unix-any.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. +. "${LIBS_AUTOMATACI}/services/hestiaOS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNUPKG/Vanilla.sh.ps1" + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +RELEASE_Run_NUPKG() { + #__target="$1" + + + # validate input + if [ $(hestiaNUPKG_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + hestiaCONSOLE_Log_Publish "NUPKG" + if [ $(hestiaOS_Is_Simulation_Mode) -ne 0 ]; then + hestiaNUPKG_Publish "$PROJECT_NUPKG_URL" "$NUPKG_TOKEN" "$__target" + if [ $? -ne 0 ]; then + hestiaCONSOLE_Log_Publish_Failed + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + else + # always simulate in case of error or mishaps before any point of no return + hestiaCONSOLE_Log_Publish_Simulate "NUPKG" + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/automataCI/_release-nupkg_windows-any.ps1 b/automataCI/_release-nupkg_windows-any.ps1 new file mode 100644 index 0000000..25f91e0 --- /dev/null +++ b/automataCI/_release-nupkg_windows-any.ps1 @@ -0,0 +1,60 @@ +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNUPKG\Vanilla.sh.ps1" + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return +} + + + + +function RELEASE-Run-NUPKG { + param( + [string]$__target + ) + + + # validate input + if ($(hestiaNUPKG-Is-Target-Valid "${__target}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # execute + $null = hestiaCONSOLE-Log-Publish "NUPKG" + if ($(hestiaOS-Is-Simulation-Mode) -ne 0) { + $___process = hestiaNUPKG-Publish ` + "${env:PROJECT_NUPKG_URL}" ` + "${env:NUPKG_TOKEN}" ` + "${__target}" + if ($___process -ne 0) { + $null = hestiaCONSOLE-Log-Publish-Failed + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } else { + # always simulate in case of error or mishaps before any point of no return + $null = hestiaCONSOLE-Log-Publish-Simulate "NPM" + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/automataCI/_release-research_unix-any.sh b/automataCI/_release-research_unix-any.sh index 77bc2c0..35a7e8e 100644 --- a/automataCI/_release-research_unix-any.sh +++ b/automataCI/_release-research_unix-any.sh @@ -35,7 +35,7 @@ RELEASE_Run_RESEARCH() { return 0 fi - if [ "${1##*${PROJECT_RESEARCH_IDENTIFIER}}" = "$1" ]; then + if [ "${1##*${PROJECT_RESEARCH_ID}}" = "$1" ]; then return 0 # not a research paper fi @@ -46,6 +46,7 @@ RELEASE_Run_RESEARCH() { __dest="PAPER.pdf" __dest="${PROJECT_PATH_ROOT}/${__dest}" I18N_Publish "$__dest" + FS_Remove_Silently "$__dest" FS_Copy_File "$1" "$__dest" if [ $? -ne 0 ]; then I18N_Publish_Failed diff --git a/automataCI/_release-research_windows-any.ps1 b/automataCI/_release-research_windows-any.ps1 index 405d074..33e92e2 100644 --- a/automataCI/_release-research_windows-any.ps1 +++ b/automataCI/_release-research_windows-any.ps1 @@ -37,7 +37,7 @@ function RELEASE-Run-RESEARCH { return 0 } - if ($($__target -replace "^.*${env:PROJECT_RESEARCH_IDENTIFIER}") -eq "${__target}") { + if ($($__target -replace "^.*${env:PROJECT_RESEARCH_ID}") -eq "${__target}") { return 0 # not a research paper } @@ -48,6 +48,7 @@ function RELEASE-Run-RESEARCH { $__dest = "PAPER.pdf" $null = I18N-Publish "${__dest}" $__dest = "${env:PROJECT_PATH_ROOT}\${__dest}" + $null = FS-Remove-Silently "${__dest}" $___process = FS-Copy-File "${__target}" "${__dest}" if ($___process -ne 0) { $null = I18N-Publish-Failed diff --git a/automataCI/package_unix-any.sh b/automataCI/package_unix-any.sh index 25b7382..b2d1a30 100644 --- a/automataCI/package_unix-any.sh +++ b/automataCI/package_unix-any.sh @@ -20,209 +20,394 @@ if [ "$PROJECT_PATH_ROOT" = "" ]; then return 1 fi -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/io/sync.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" -. "${LIBS_AUTOMATACI}/services/compilers/flatpak.sh" -. "${LIBS_AUTOMATACI}/services/publishers/homebrew.sh" -. "${LIBS_AUTOMATACI}/services/versioners/git.sh" -. "${LIBS_AUTOMATACI}/_package-archive_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-cargo_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-changelog_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-chocolatey_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-citation_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-deb_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-docker_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-flatpak_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-homebrew_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-ipk_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-lib_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-msi_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-pdf_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-pypi_unix-any.sh" -. "${LIBS_AUTOMATACI}/_package-rpm_unix-any.sh" +. "${LIBS_AUTOMATACI}/services/hestiaCHANGELOG/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaCITATION/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaCONSOLE/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaGIT/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaHOMEBREW/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaMSI/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaNPM/Is_Target_Valid.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaOS/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaPDF/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaRUST/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaSTRING/Vanilla.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaWASM/Is_Target_Valid_JS.sh.ps1" +. "${LIBS_AUTOMATACI}/services/hestiaTIME/Vanilla.sh.ps1" -# source locally provided functions -. "${LIBS_AUTOMATACI}/_package-sourcing_unix-any.sh" +# snap a release time +PACKAGE_TIME="$(hestiaTIME_Now)" +DIRECTORY_BUILD="${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}" +DIRECTORY_DOTNET="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TOOLS}/${PROJECT_PATH_DOTNET_ENGINE}" -# 1-time setup job required materials -DEST="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" -I18N_Remake "$DEST" -FS_Remake_Directory "$DEST" -if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 +# clean up the entire output directory for fresh packaging +DIRECTORY_OUTPUT="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" +hestiaCONSOLE_Log_Recreate "$DIRECTORY_OUTPUT" +hestiaFS_Recreate_Directory "$DIRECTORY_OUTPUT" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi -if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne 0 ]; then - HOMEBREW_WORKSPACE="packagers-homebrew-${PROJECT_SKU}" - I18N_Setup "$HOMEBREW_WORKSPACE" - HOMEBREW_WORKSPACE="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${HOMEBREW_WORKSPACE}" - FS_Remake_Directory "$HOMEBREW_WORKSPACE" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 + + +# clean up homebrew consolidation directory +if [ "$(hestiaSTRING_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne $hestiaKERNEL_ERROR_OK ]; then + DIRECTORY_HOMEBREW="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-homebrew-${PROJECT_SKU}" + hestiaCONSOLE_Log_Recreate "$DIRECTORY_HOMEBREW" + hestiaFS_Recreate_Directory "$DIRECTORY_HOMEBREW" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi -if [ "$(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY")" -ne 0 ]; then - MSI_WORKSPACE="packagers-msi-${PROJECT_SKU}" - I18N_Setup "$MSI_WORKSPACE" - MSI_WORKSPACE="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${MSI_WORKSPACE}" - FS_Remake_Directory "$MSI_WORKSPACE" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 + + +# clean up msi (windows) consolidation directory +if [ "$(hestiaSTRING_Is_Empty "$PROJECT_MSI_CODEPAGE")" -ne $hestiaKERNEL_ERROR_OK ]; then + DIRECTORY_MSI="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-msi-${PROJECT_SKU}" + hestiaCONSOLE_Log_Recreate "$DIRECTORY_MSI" + hestiaFS_Recreate_Directory "$DIRECTORY_MSI" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi - if [ $(STRINGS_Is_Empty "$PROJECT_MSI_REGISTRY_KEY") -eq 0 ]; then + if [ "$(hestiaSTRING_Is_Empty "$PROJECT_MSI_REGISTRY_KEY")" -eq $hestiaKERNEL_ERROR_OK ]; then PROJECT_MSI_REGISTRY_KEY="\ Software\\\\${PROJECT_SCOPE}\\\\InstalledProducts\\\\${PROJECT_SKU_TITLECASE}" fi fi -if [ "$(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL")" -ne 0 ]; then - FLATPAK_REPO="flatpak-repo" - I18N_Setup "$FLATPAK_REPO" - FLATPAK_REPO="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${FLATPAK_REPO}" - FS_Remove_Silently "$FLATPAK_REPO" - if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_REPO") -ne 0 ] && - [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_REPO") -eq 0 ]; then + +# clean up flatpak repository directory +if [ "$(hestiaSTRING_Is_Empty "$PROJECT_FLATPAK_URL")" -ne $hestiaKERNEL_ERROR_OK ]; then + DIRECTORY_FLATPAK="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-flatpak-${PROJECT_SKU}" + hestiaCONSOLE_Log_Recreate "$DIRECTORY_FLATPAK" + hestiaFS_Remove "$DIRECTORY_FLATPAK" + + if [ $(hestiaSTRING_Is_Empty "$PROJECT_FLATPAK_REPO") -ne $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "$PROJECT_RELEASE_REPO") -eq $hestiaKERNEL_ERROR_OK ]; then # version controlled repository supplied; AND # single unified repository is not enabled - FS_Make_Housing_Directory "$FLATPAK_REPO" - GIT_Clone_Repo \ - "$PROJECT_PATH_ROOT" \ - "$PROJECT_PATH_TEMP" \ - "$PWD" \ - "$PROJECT_FLATPAK_REPO" \ - "$PROJECT_SIMULATE_RUN" \ - "$(FS_Get_File "$FLATPAK_REPO")" \ - "$PROJECT_FLATPAK_REPO_BRANCH" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 + if [ $(hestiaOS_Is_Simulation_Mode) -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Simulate "$DIRECTORY_FLATPAK" + else + hestiaGIT_Clone "$PROJECT_FLATPAK_REPO" "$DIRECTORY_FLATPAK" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + hestiaGIT_Change_Branch "$DIRECTORY_FLATPAK" "$PROJECT_FLATPAK_REPO_BRANCH" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi fi - if [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_PATH") -ne 0 ]; then - FLATPAK_REPO="${FLATPAK_REPO}/${PROJECT_FLATPAK_PATH}" + if [ $(hestiaSTRING_Is_Empty "$PROJECT_FLATPAK_PATH") -ne $hestiaKERNEL_ERROR_OK ]; then + DIRECTORY_FLATPAK="${DIRECTORY_FLATPAK}/${PROJECT_FLATPAK_PATH}" fi fi - FS_Make_Directory "$FLATPAK_REPO" - if [ $? -ne 0 ]; then - I18N_Setup_Failed - return 1 + hestiaFS_Create_Directory "$DIRECTORY_FLATPAK" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi + + +# clean up changelog directory +DIRECTORY_CHANGELOG="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-changelog" +hestiaCONSOLE_Log_Recreate "$DIRECTORY_CHANGELOG" +hestiaFS_Recreate_Directory "$DIRECTORY_CHANGELOG" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC +fi + + + + +# generate markdown changelog FILE_CHANGELOG_MD="${PROJECT_SKU}-CHANGELOG_${PROJECT_VERSION}.md" FILE_CHANGELOG_MD="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${FILE_CHANGELOG_MD}" -FILE_CHANGELOG_DEB="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-changelog/deb.gz" -PACKAGE_Run_CHANGELOG "$FILE_CHANGELOG_MD" "$FILE_CHANGELOG_DEB" -if [ $? -ne 0 ]; then - return 1 +hestiaCONSOLE_Log_Recreate "$FILE_CHANGELOG_MD" +hestiaCHANGELOG_Assemble_MARKDOWN \ + "$FILE_CHANGELOG_MD" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog/data" \ + "$PROJECT_CHANGELOG_TITLE" \ + "$PROJECT_VERSION" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi + + +# generate deb changelog +FILE_CHANGELOG_DEB="${DIRECTORY_CHANGELOG}/deb" +hestiaCONSOLE_Log_Recreate "$FILE_CHANGELOG_DEB" +hestiaCHANGELOG_Assemble_DEB \ + "$FILE_CHANGELOG_DEB" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog/deb" \ + "$PROJECT_VERSION" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC +fi + + + + +# generate rpm changelog +FILE_CHANGELOG_RPM="${DIRECTORY_CHANGELOG}/rpm" +hestiaCONSOLE_Log_Recreate "$FILE_CHANGELOG_RPM" +hestiaCHANGELOG_Assemble_RPM \ + "$FILE_CHANGELOG_RPM" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/changelog/data" \ + "$(hestiaTIME_Format_Date_RPM "$PACKAGE_TIME")" \ + "$PROJECT_CONTACT_NAME" \ + "$PROJECT_CONTACT_EMAIL" \ + "$PROJECT_VERSION" \ + "$PROJECT_CADENCE" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC +fi + + + + +# generate CITATION.cff FILE_CITATION_CFF="${PROJECT_SKU}-CITATION_${PROJECT_VERSION}.cff" FILE_CITATION_CFF="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${FILE_CITATION_CFF}" -PACKAGE_Run_CITATION "$FILE_CITATION_CFF" -if [ $? -ne 0 ]; then - return 1 +hestiaCONSOLE_Log_Recreate "$FILE_CITATION_CFF" +hestiaCITATION_Assemble \ + "$FILE_CITATION_CFF" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/ABSTRACTS.txt" \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/CITATIONS.yml" \ + "$PROJECT_CITATION" \ + "$PROJECT_CITATION_TYPE" \ + "$(hestiaTIME_Format_Date_ISO8601 "$PACKAGE_TIME")" \ + "$PROJECT_NAME" \ + "$PROJECT_VERSION" \ + "$PROJECT_LICENSE" \ + "$PROJECT_SOURCE_URL" \ + "$PROJECT_SOURCE_URL" \ + "$PROJECT_STATIC_URL" \ + "$PROJECT_CONTACT_NAME" \ + "$PROJECT_CONTACT_WEBSITE" \ + "$PROJECT_CONTACT_EMAIL" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi -I18N_Newline +# clean up log directory +DIRECTORY_LOG="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/packagers" +hestiaCONSOLE_Log_Recreate "$DIRECTORY_LOG" +hestiaFS_Recreate_Directory "$DIRECTORY_LOG" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC +fi -# prepare for parallel package -__log_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_LOG}/packagers" -I18N_Remake "$__log_directory" -FS_Remake_Directory "$__log_directory" -FS_Is_Directory "$__log_directory" -if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 + + +# clean up parallel control directory +DIRECTORY_PARALLEL="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-parallel" +hestiaCONSOLE_Log_Recreate "$DIRECTORY_PARALLEL" +hestiaFS_Recreate_Directory "$DIRECTORY_PARALLEL" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi -__control_directory="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-parallel" -I18N_Remake "${__control_directory}" -FS_Remake_Directory "$__control_directory" -FS_Is_Directory "$__control_directory" -if [ $? -ne 0 ]; then - I18N_Remake_Failed - return 1 + + + +# clean up serial control directory +DIRECTORY_SERIAL="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/packagers-serial" +hestiaCONSOLE_Log_Recreate "$DIRECTORY_SERIAL" +hestiaFS_Recreate_Directory "$DIRECTORY_SERIAL" +___process=$? +if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Recreate_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi -__parallel_control="${__control_directory}/control-parallel.txt" -FS_Remove_Silently "$__parallel_control" -__serial_control="${__control_directory}/control-serial.txt" -FS_Remove_Silently "$__serial_control" +# setup subroutine function for parallel executions SUBROUTINE_Package() { #__line="$1" + __filename="${1%%|*}" + __arguments="${1#*|}" - # parse input - __command="${1##*|}" - __arguments="${1%|*}" + __target="${__arguments%%|*}" + __arguments="${__arguments#*|}" - __log="${__arguments##*|}" - __arguments="${__arguments%|*}|" + __target_os="${__arguments%%|*}" + __arguments="${__arguments#*|}" - __subject="${__log##*/}" - __subject="${__subject%.*}" + __target_arch="${__arguments%%|*}" + __arguments="${__arguments#*|}" + __package_time="${__arguments%%|*}" + __arguments="${__arguments#*|}" - # execute - I18N_Package "$__subject" - FS_Remove_Silently "$__log" + __function="${__arguments##*|}" + __arguments="${__arguments%|*}" - $__command "$__arguments" &> "$__log" - if [ $? -ne 0 ]; then - I18N_Package_Failed - return 1 + __directory_log="${__arguments##*|}" + __arguments="${__arguments%|*}" + + __directory_output="${__arguments##*|}" + + __arguments="${__arguments%|*}" + if [ "$__directory_output" = "$__arguments" ]; then + __arguments="" fi + # import required libraries + . "${LIBS_AUTOMATACI}/services/hestiaKERNEL/Vanilla.sh.ps1" + + + # execute + case "$__function" in + "PACKAGE_APP") + __log="${__directory_log}/app-${__filename}_${__target_os}-${__target_arch}.txt" + ;; + "PACKAGE_ARCHIVE") + __log="${__directory_log}/archive-${__filename}_${__target_os}-${__target_arch}.txt" + . "${LIBS_AUTOMATACI}/_package-archive_unix-any.sh" + PACKAGE_ARCHIVE "$__filename" \ + "$__target" \ + "$__target_os" \ + "$__target_arch" \ + "$__package_time" \ + "$__directory_output" \ + "$__arguments" \ + &> "$__log" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + ;; + "PACKAGE_SINGLE") + __log="${__directory_log}/single-${__filename}_${__target_os}-${__target_arch}.txt" + . "${LIBS_AUTOMATACI}/_package-single_unix-any.sh" + PACKAGE_SINGLE "$__filename" \ + "$__target" \ + "$__target_os" \ + "$__target_arch" \ + "$__package_time" \ + "$__directory_output" \ + "$__arguments" \ + &> "$__log" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + ;; + "PACKAGE_UNIX") + __log="${__directory_log}/unix-${__filename}_${__target_os}-${__target_arch}.txt" + ;; + "PACKAGE_WINDOWS") + __log="${__directory_log}/windows-${__filename}_${__target_os}-${__target_arch}.txt" + . "${LIBS_AUTOMATACI}/_package-windows_unix-any.sh" + PACKAGE_WINDOWS "$__filename" \ + "$__target" \ + "$__target_os" \ + "$__target_arch" \ + "$__package_time" \ + "$__directory_output" \ + "$__arguments" \ + &> "$__log" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + ;; + "PACKAGE_CONSOLIDATE") + __log="${__directory_log}/consolidate-${__filename}_${__target_os}-${__target_arch}.txt" + . "${LIBS_AUTOMATACI}/_package-consolidate_unix-any.sh" + PACKAGE_CONSOLIDATE "$__filename" \ + "$__target" \ + "$__target_os" \ + "$__target_arch" \ + "$__package_time" \ + "$__directory_output" \ + "$__arguments" \ + &> "$__log" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + ;; + *) + return $hestiaKERNEL_ERROR_BAD_EXEC + ;; + esac + + # report status - return 0 + return $hestiaKERNEL_ERROR_OK } -# begin registering packagers -FS_Is_Directory "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}" -if [ $? -eq 0 ]; then -for i in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}"/*; do - FS_Is_File "$i" - if [ $? -ne 0 ]; then +# register built artifacts for parallel executions +if [ $(hestiaFS_Is_Directory "$DIRECTORY_BUILD") -ne $hestiaKERNEL_ERROR_OK ]; then + # no artifacts at all - report status + hestiaCONSOLE_Log_Success + return $hestiaKERNEL_ERROR_OK +fi + +for __artifact in "${DIRECTORY_BUILD}/"*; do + if [ $(hestiaFS_Is_File "$__artifact") -ne $hestiaKERNEL_ERROR_OK ]; then continue fi # parse build candidate - I18N_Detected "$i" - TARGET_FILENAME="${i##*${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}/}" + TARGET_FILENAME="$(hestiaFS_Get_File "$__artifact")" TARGET_FILENAME="${TARGET_FILENAME%.*}" TARGET_OS="${TARGET_FILENAME##*_}" TARGET_FILENAME="${TARGET_FILENAME%%_*}" @@ -230,293 +415,194 @@ for i in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}"/*; do TARGET_ARCH="${TARGET_ARCH%%.*}" TARGET_OS="${TARGET_OS%%-*}" TARGET_OS="${TARGET_OS%%.*}" + TAG_COMMON="${TARGET_FILENAME}|${__artifact}|${TARGET_OS}|${TARGET_ARCH}|${PACKAGE_TIME}" - if [ "$(STRINGS_Is_Empty "$TARGET_OS")" -eq 0 ] || - [ "$(STRINGS_Is_Empty "$TARGET_ARCH")" -eq 0 ] || - [ "$(STRINGS_Is_Empty "$TARGET_FILENAME")" -eq 0 ]; then - I18N_File_Has_Bad_Stat_Skipped + if [ "$(hestiaSTRING_Is_Empty "$TARGET_OS")" -eq $hestiaKERNEL_ERROR_OK ] || + [ "$(hestiaSTRING_Is_Empty "$TARGET_ARCH")" -eq $hestiaKERNEL_ERROR_OK ] || + [ "$(hestiaSTRING_Is_Empty "$TARGET_FILENAME")" -eq $hestiaKERNEL_ERROR_OK ]; then continue fi - STRINGS_Has_Prefix "$PROJECT_SKU" "$TARGET_FILENAME" - if [ $? -ne 0 ]; then - STRINGS_Has_Prefix "lib${PROJECT_SKU}" "$TARGET_FILENAME" - if [ $? -ne 0 ]; then - I18N_Is_Incompatible_Skipped "$TARGET_FILENAME" - continue - fi - fi - - __common="${DEST}|${i}|${TARGET_FILENAME}|${TARGET_OS}|${TARGET_ARCH}" - - # begin registrations - I18N_Sync_Register "$i" - - if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_ARCHIVE") -ne 0 ]; then - __log="archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_ARCHIVE + # register for single object type package + if [ $(hestiaPDF_Is_Target_Valid "$__artifact") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "${DIRECTORY_PARALLEL}/control.txt" "\ +${TAG_COMMON}|${DIRECTORY_OUTPUT}|${DIRECTORY_LOG}|PACKAGE_SINGLE " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC fi - fi - if [ $(STRINGS_Is_Empty "$PROJECT_RUST") -ne 0 ]; then - __log="cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_CARGO -" - if [ $? -ne 0 ]; then - return 1 - fi + continue fi - # NOTE: chocolatey only serve windows - if [ $(STRINGS_Is_Empty "$PROJECT_CHOCOLATEY_URL") -ne 0 ]; then - case "$TARGET_OS" in - any|windows) - __log="chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_CHOCOLATEY -" - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac - fi - # NOTE: deb does not work in windows or mac - if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -ne 0 ]; then - case "$TARGET_OS" in - windows|darwin) - ;; - *) - __log="deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE_Run_DEB + # register for classical .tar.xz, .zip, & .nupkg types + hestiaFS_Append_File "${DIRECTORY_PARALLEL}/control.txt" "\ +${TAG_COMMON}|${DIRECTORY_OUTPUT}|${DIRECTORY_LOG}|PACKAGE_ARCHIVE " - if [ $? -ne 0 ]; then - return 1 - fi - ;; - esac + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC fi - # NOTE: container only serve windows and linux - if [ $(STRINGS_Is_Empty "$PROJECT_CONTAINER_REGISTRY") -ne 0 ]; then - case "$TARGET_OS" in - any|linux|windows) - __log="docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__serial_control" "\ -${__common}|${__log}|PACKAGE_Run_DOCKER -" - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac - fi - # NOTE: flatpak only serve linux - FLATPAK_Is_Available - if [ $? -eq 0 ] && [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL") -ne 0 ]; then - case "$TARGET_OS" in - any|linux) - __log="flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__serial_control" "\ -${__common}|${FLATPAK_REPO}|${__log}|PACKAGE_Run_FLATPAK -" - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac + # bail tech-specific artifacts since the following no longer needs them + if [ $(hestiaWASM_Is_Target_Valid_JS "$__artifact") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaNPM_Is_Target_Valid "$__artifact") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaRUST_Is_Target_Valid "$__artifact") -eq $hestiaKERNEL_ERROR_OK ]; then + continue fi - # NOTE: homebrew only serve linux and mac - if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -ne 0 ]; then - case "$TARGET_OS" in - any|darwin|linux) - __log="homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${HOMEBREW_WORKSPACE}|${__log}|PACKAGE_Run_HOMEBREW -" - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac - fi - if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_IPK") -ne 0 ]; then - __log="ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_IPK + # register homebrew type + if [ "$(hestiaSTRING_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne $hestiaKERNEL_ERROR_OK ] && ( + [ ! "$TARGET_OS" = "windows" ] + ); then + hestiaFS_Append_File "${DIRECTORY_PARALLEL}/control.txt" "\ +${TAG_COMMON}|${DIRECTORY_HOMEBREW}|${DIRECTORY_LOG}|PACKAGE_CONSOLIDATE " - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi - if [ $(FS_Is_Target_A_Library "$i") -eq 0 ] && - [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_ARCHIVE") -ne 0 ]; then - __log="lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_LIB -" - if [ $? -ne 0 ]; then - return 1 - fi - fi - # NOTE: MSI only works in windows - if [ $(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY") -ne 0 ]; then - case "$TARGET_OS" in - any|windows) - __log="msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${MSI_WORKSPACE}|${__log}|PACKAGE_Run_MSI + # register windows type + if [ "$(hestiaSTRING_Is_Empty "$PROJECT_MSI_CODEPAGE")" -ne $hestiaKERNEL_ERROR_OK ] && ( + [ "$TARGET_OS" = "windows" ] || [ "$TARGET_OS" = "any" ] + ); then + hestiaFS_Append_File "${DIRECTORY_PARALLEL}/control.txt" "\ +${TAG_COMMON}|${DIRECTORY_MSI}|${DIRECTORY_LOG}|PACKAGE_WINDOWS " - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac - - fi - - if [ $(FS_Is_Target_A_PDF "$i") -eq 0 ]; then - __log="pdf_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_PDF -" - if [ $? -ne 0 ]; then - return 1 + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi - if [ $(STRINGS_Is_Empty "$PROJECT_PYTHON") -ne 0 ]; then - __log="pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_PYPI -" - if [ $? -ne 0 ]; then - return 1 - fi - fi - # NOTE: RPM only serve linux - if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -ne 0 ]; then - case "$TARGET_OS" in - any|linux) - __log="rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - __log="${__log_directory}/${__log}" - FS_Append_File "$__parallel_control" "\ -${__common}|${__log}|PACKAGE_Run_RPM -" - if [ $? -ne 0 ]; then - return 1 - fi - ;; - *) - ;; - esac - fi + # register app-only sandboxed|containerized packages done -fi -I18N_Sync_Run -FS_Is_File "$__parallel_control" -if [ $? -eq 0 ]; then - SYNC_Exec_Parallel "SUBROUTINE_Package" "$__parallel_control" - if [ $? -ne 0 ]; then - I18N_Sync_Failed - return 1 + + +# execute in parallel +hestiaCONSOLE_Log_Run "$DIRECTORY_PARALLEL" +if [ $(hestiaFS_Is_File "${DIRECTORY_PARALLEL}/control.txt") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaKERNEL_Run_Parallel_Sentinel "SUBROUTINE_Package" "$DIRECTORY_PARALLEL" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi -if [ $(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL") -ne 0 ]; then - I18N_Newline - I18N_Newline - __dest="${PROJECT_SKU}.rb" - I18N_Export "$__dest" - __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${__dest}" - HOMEBREW_Seal "$__dest" \ - "${PROJECT_SKU}-homebrew_${PROJECT_VERSION}_any-any.tar.xz" \ - "$HOMEBREW_WORKSPACE" \ + +# execute homebrew package +if [ "$(hestiaSTRING_Is_Empty "$PROJECT_HOMEBREW_URL")" -ne $hestiaKERNEL_ERROR_OK ]; then + __dest="${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}/${PROJECT_SKU}.rb" + hestiaCONSOLE_Log_Package "$__dest" + hestiaHOMEBREW_Package \ + "$__dest" \ + "${PROJECT_SKU}-${PROJECT_HOMEBREW_ID}_${PROJECT_VERSION}_any-any.tar.xz" \ + "$DIRECTORY_HOMEBREW" \ "$PROJECT_SKU" \ "$PROJECT_PITCH" \ "$PROJECT_CONTACT_WEBSITE" \ "$PROJECT_LICENSE" \ "$PROJECT_HOMEBREW_URL" - if [ $? -ne 0 ];then - I18N_Export_Failed - return 1 + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi -if [ "$(STRINGS_Is_Empty "$PROJECT_MSI_INSTALL_DIRECTORY")" -ne 0 ]; then - I18N_Newline - I18N_Newline - # sort any arch into others - PACKAGE_Sort_MSI "$MSI_WORKSPACE" - if [ $? -ne 0 ];then - return 1 + +# execute msi package +if [ "$(hestiaSTRING_Is_Empty "$PROJECT_MSI_CODEPAGE")" -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package "MSI" + if [ $(hestiaFS_Is_Directory "${DIRECTORY_MSI}/any") -eq $hestiaKERNEL_ERROR_OK ]; then + # 'any' arch exists - merge into existing ones + for _arch in "${DIRECTORY_MSI}/"*; do + if [ $(hestiaFS_Is_Directory "$_arch") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + if [ "$(hestiaFS_Get_File "$_arch")" = "any" ]; then + continue + fi + + hestiaCONSOLE_Log_Merge "$_arch" "${DIRECTORY_MSI}/any" + hestiaFS_Merge_Directories "$_arch" "${DIRECTORY_MSI}/any" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Merge_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done + + + # remove 'any' arch to prevent dirty compilations + hestiaFS_Remove "${DIRECTORY_MSI}/any" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Merge_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi fi - # seal all MSI packages - for _candidate in "${MSI_WORKSPACE}/"*; do - FS_Is_Directory "$_candidate" - if [ $? -ne 0 ]; then + + # begin package creation + for _arch in "${DIRECTORY_MSI}/"*; do + if [ $(hestiaFS_Is_Directory "$_arch") -ne $hestiaKERNEL_ERROR_OK ]; then continue fi - I18N_Newline - PACKAGE_Seal_MSI "$_candidate" "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" - if [ $? -ne 0 ];then - return 1 + hestiaCONSOLE_Log_Package "$_arch" + hestiaMSI_Package \ + "${PROJECT_PATH_ROOT}/${PROJECT_PATH_PKG}" \ + "$_arch" \ + "$PROJECT_SKU" \ + "$PROJECT_VERSION" \ + "$PRODUCT_APP_UUID" \ + "$PROJECT_SCOPE" \ + "$PROJECT_NAME" \ + "$PROJECT_CONTACT_NAME" \ + "$PROJECT_CONTACT_WEBSITE" \ + "$PROJECT_MSI_INSTALLER_VERSION_UNIX" \ + "$PROJECT_MSI_INSTALLER_SCOPE" \ + "$PROJECT_MSI_REGISTRY_KEY" \ + "$PROJECT_MSI_BIN_COMPONENT_GUID" \ + "$PROJECT_MSI_ETC_COMPONENT_GUID" \ + "$PROJECT_MSI_LIB_COMPONENT_GUID" \ + "$PROJECT_MSI_DOC_COMPONENT_GUID" \ + "$PROJECT_MSI_REGISTRIES_GUID" \ + "$PROJECT_MSI_CODEPAGE" \ + "$DIRECTORY_DOTNET" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Package_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi done fi -I18N_Sync_Run_Series -FS_Is_File "$__serial_control" -if [ $? -eq 0 ]; then - SYNC_Exec_Serial "SUBROUTINE_Package" "$__serial_control" - if [ $? -ne 0 ]; then - I18N_Sync_Failed - return 1 + + +# execute in serial +hestiaCONSOLE_Log_Run "$DIRECTORY_SERIAL" +if [ $(hestiaFS_Is_File "${DIRECTORY_SERIAL}/control.txt") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaKERNEL_Run_Parallel_Sentinel "SUBROUTINE_Package" "$DIRECTORY_SERIAL" "1" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaCONSOLE_Log_Run_Failed "$___process" + return $hestiaKERNEL_ERROR_BAD_EXEC fi fi @@ -524,5 +610,5 @@ fi # report status -I18N_Run_Successful -return 0 +hestiaCONSOLE_Log_Success +return $hestiaKERNEL_ERROR_OK diff --git a/automataCI/package_windows-any.ps1 b/automataCI/package_windows-any.ps1 index 9ca070b..8fe50ae 100644 --- a/automataCI/package_windows-any.ps1 +++ b/automataCI/package_windows-any.ps1 @@ -15,537 +15,598 @@ # initialize if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run me from automataCI\ci.sh.ps1 instead!`n" - return 1 + Write-Error "[ ERROR ] - Please run me from automataCI\ci.sh.ps1 instead!`n" + return 1 } -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\sync.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" -. "${env:LIBS_AUTOMATACI}\services\compilers\flatpak.ps1" -. "${env:LIBS_AUTOMATACI}\services\publishers\homebrew.ps1" -. "${env:LIBS_AUTOMATACI}\services\versioners\git.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaCHANGELOG\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaCITATION\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaCONSOLE\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaGIT\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaHOMEBREW\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaMSI\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaNPM\Is_Target_Valid.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaOS\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaPDF\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaRUST\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaSTRING\Vanilla.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaWASM\Is_Target_Valid_JS.sh.ps1" +. "${env:LIBS_AUTOMATACI}\services\hestiaTIME\Vanilla.sh.ps1" -. "${env:LIBS_AUTOMATACI}\_package-changelog_windows-any.ps1" -. "${env:LIBS_AUTOMATACI}\_package-citation_windows-any.ps1" -. "${env:LIBS_AUTOMATACI}\_package-msi_windows-any.ps1" +# snap a release time +$PACKAGE_TIME = hestiaTIME-Now +$DIRECTORY_BUILD = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}" +$DIRECTORY_DOTNET = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TOOLS}\${env:PROJECT_PATH_DOTNET_ENGINE}" -# 1-time setup job required materials -$DEST = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" -$null = I18N-Remake "${DEST}" -$___process = FS-Remake-Directory "${DEST}" -if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 + + + +# clean up the entire output directory for fresh packaging +$DIRECTORY_OUTPUT = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" +$null = hestiaCONSOLE-Log-Recreate $DIRECTORY_OUTPUT +$___process = hestiaFS-Recreate-Directory $DIRECTORY_OUTPUT +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} } -if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { - $HOMEBREW_WORKSPACE = "packagers-homebrew-${env:PROJECT_SKU}" - $null = I18N-Setup "${HOMEBREW_WORKSPACE}" - $HOMEBREW_WORKSPACE = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${HOMEBREW_WORKSPACE}" - $___process = FS-Remake-Directory "${HOMEBREW_WORKSPACE}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } + + +# clean up homebrew consolidation directory +if ($(hestiaSTRING-Is-Empty ${env:PROJECT_HOMEBREW_URL}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $DIRECTORY_HOMEBREW = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-homebrew-${env:PROJECT_SKU}" + $null = hestiaCONSOLE-Log-Recreate $DIRECTORY_HOMEBREW + $___process = hestiaFS-Recreate-Directory $DIRECTORY_HOMEBREW + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } } -if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { - $MSI_WORKSPACE = "packagers-msi-${env:PROJECT_SKU}" - $null = I18N-Setup "${MSI_WORKSPACE}" - $MSI_WORKSPACE = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${MSI_WORKSPACE}" - $___process = FS-Remake-Directory "${MSI_WORKSPACE}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } - if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_REGISTRY_KEY}") -eq 0) { - ${env:PROJECT_MSI_REGISTRY_KEY} = @" +# clean up msi (windows) consolidation directory +if ($(hestiaSTRING-Is-Empty ${env:PROJECT_MSI_CODEPAGE}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $DIRECTORY_MSI = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-msi-${env:PROJECT_SKU}" + $null = hestiaCONSOLE-Log-Recreate $DIRECTORY_MSI + $___process = hestiaFS-Recreate-Directory $DIRECTORY_MSI + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($(hestiaSTRING-Is-Empty $env:PROJECT_MSI_REGISTRY_KEY) -eq ${env:hestiaKERNEL_ERROR_OK}) { + ${env:PROJECT_MSI_REGISTRY_KEY} = @" Software\${env:PROJECT_SCOPE}\InstalledProducts\${env:PROJECT_SKU_TITLECASE} "@ - } + } } -if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0) { - $FLATPAK_REPO = "flatpak-repo" - $null = I18N-Setup "${FLATPAK_REPO}" - $FLATPAK_REPO = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${FLATPAK_REPO}" - $null = FS-Remove-Silently "$FLATPAK_REPO" - - if (($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_REPO}") -ne 0) -and - ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_REPO}") -ne 0)) { - # version controlled repository supplied; AND - # single unified repository is not enabled - $null = FS-Make-Housing-Directory "$FLATPAK_REPO" - $___process = GIT-Clone-Repo ` - "${env:PROJECT_PATH_ROOT}" ` - "${env:PROJECT_PATH_TEMP}" ` - "$(Get-Location)" ` - "${env:PROJECT_FLATPAK_REPO}" ` - "${env:PROJECT_SIMULATE_RUN}" ` - "$(FS-Get-File "${env:FLATPAK_REPO}")" ` - "${env:PROJECT_FLATPAK_REPO_BRANCH}" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } - - if ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_PATH}") -ne 0) { - $FLATPAK_REPO = "${FLATPAK_REPO}/${env:PROJECT_FLATPAK_PATH}" - } - } - - $___process = FS-Make-Directory "$FLATPAK_REPO" - if ($___process -ne 0) { - $null = I18N-Setup-Failed - return 1 - } + + +# clean up flatpak repository directory +if ($(hestiaSTRING-Is-Empty $env:PROJECT_FLATPAK_URL) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $DIRECTORY_FLATPAK = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-flatpak-${env:PROJECT_SKU}" + $null = hestiaCONSOLE-Log-Recreate $DIRECTORY_FLATPAK + $null = hestiaFS-Remove $DIRECTORY_FLATPAK + + if ( + ($(hestiaSTRING-Is-Empty ${env:PROJECT_FLATPAK_REPO}) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty ${env:PROJECT_RELEASE_REPO}) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + if ($(hestiaOS-Is-Simulation-Mode) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Simulate $DIRECTORY_FLATPAK + } else { + # version controlled repository supplied; AND + # single unified repository is not enabled + $___process = hestiaGIT-Clone ` + ${env:PROJECT_FLATPAK_REPO} ` + $DIRECTORY_FLATPAK + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___process = hestiaGIT-Change-Branch ` + $DIRECTORY_FLATPAK ` + ${env:PROJECT_FLATPAK_REPO_BRANCH} + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + if ($(hestiaSTRING-Is-Empty ${env:PROJECT_FLATPAK_PATH}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $DIRECTORY_FLATPAK = "${DIRECTORY_FLATPAK}\${env:PROJECT_FLATPAK_PATH}" + } + } + + $___process = hestiaFS-Create-Directory ${DIRECTORY_FLATPAK} + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } +} + + + + +# clean up changelog directory +$DIRECTORY_CHANGELOG = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-changelog" +$null = hestiaCONSOLE-Log-Recreate ${DIRECTORY_CHANGELOG} +$___process = hestiaFS-Recreate-Directory ${DIRECTORY_CHANGELOG} +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} } + + +# generate markdown changelog $FILE_CHANGELOG_MD = "${env:PROJECT_SKU}-CHANGELOG_${env:PROJECT_VERSION}.md" $FILE_CHANGELOG_MD = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${FILE_CHANGELOG_MD}" -$FILE_CHANGELOG_DEB = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-changelog\deb.gz" -$___process = Package-Run-CHANGELOG "$FILE_CHANGELOG_MD" "$FILE_CHANGELOG_DEB" -if ($___process -ne 0) { - return 1 +$null = hestiaCONSOLE-Log-Recreate $FILE_CHANGELOG_MD +$___process = hestiaCHANGELOG-Assemble-MARKDOWN ` + $FILE_CHANGELOG_MD ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog\data" ` + ${env:PROJECT_CHANGELOG_TITLE} ` + ${env:PROJECT_VERSION} +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} } -$FILE_CITATION_CFF = "${env:PROJECT_SKU}-CITATION_${env:PROJECT_VERSION}.cff" -$FILE_CITATION_CFF = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${FILE_CITATION_CFF}" -$___process = Package-Run-CITATION "$FILE_CITATION_CFF" -if ($___process -ne 0) { - return 1 -} -$null = I18N-Newline +# generate deb changelog +$FILE_CHANGELOG_DEB = "${DIRECTORY_CHANGELOG}\deb" +$null = hestiaCONSOLE-Log-Recreate $FILE_CHANGELOG_DEB +$___process = hestiaCHANGELOG-Assemble-DEB ` + $FILE_CHANGELOG_DEB ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog\deb" ` + ${env:PROJECT_VERSION} +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} + +$FILE_CHANGELOG_DEB = "${FILE_CHANGELOG_DEB}.gz" +if ($(hestiaFS-Is-File $FILE_CHANGELOG_DEB) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} -# prepare for parallel package -$__log_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\packagers" -$null = I18N-Remake "${__log_directory}" -$null = FS-Remake-Directory "${__log_directory}" -$___process = FS-Is-Directory "${__log_directory}" -if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 +# generate rpm changelog +$FILE_CHANGELOG_RPM = "${DIRECTORY_CHANGELOG}\rpm" +$null = hestiaCONSOLE-Log-Recreate $FILE_CHANGELOG_RPM +$___process = hestiaCHANGELOG-Assemble-RPM ` + $FILE_CHANGELOG_RPM ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\changelog\data" ` + "$(hestiaTIME-Format-Date-RPM $PACKAGE_TIME)" ` + ${env:PROJECT_CONTACT_NAME} ` + ${env:PROJECT_CONTACT_EMAIL} ` + ${env:PROJECT_VERSION} ` + ${env:PROJECT_CADENCE} +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} } -$__control_directory = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-parallel" -$null = I18N-Remake "${__control_directory}" -$null = FS-Remake-Directory "${__control_directory}" -$___process = FS-Is-Directory "${__control_directory}" -if ($___process -ne 0) { - $null = I18N-Remake-Failed - return 1 -} -$__parallel_control = "${__control_directory}\control-parallel.txt" -$null = FS-Remove-Silently "${__parallel_control}" +# generate CITATION.cff +$FILE_CITATION_CFF = "${env:PROJECT_SKU}-CITATION_${env:PROJECT_VERSION}.cff" +$FILE_CITATION_CFF = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${FILE_CITATION_CFF}" +$null = hestiaCONSOLE-Log-Recreate $FILE_CITATION_CFF +$___process = hestiaCITATION-Assemble ` + $FILE_CITATION_CFF ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\ABSTRACTS.txt" ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs\CITATIONS.yml" ` + ${env:PROJECT_CITATION} ` + ${env:PROJECT_CITATION_TYPE} ` + "$(hestiaTIME-Format-Date-ISO8601 "${PACKAGE_TIME}")" ` + ${env:PROJECT_NAME} ` + ${env:PROJECT_VERSION} ` + ${env:PROJECT_LICENSE} ` + ${env:PROJECT_SOURCE_URL} ` + ${env:PROJECT_SOURCE_URL} ` + ${env:PROJECT_STATIC_URL} ` + ${env:PROJECT_CONTACT_NAME} ` + ${env:PROJECT_CONTACT_WEBSITE} ` + ${env:PROJECT_CONTACT_EMAIL} +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} -$__serial_control = "${__control_directory}\control-serial.txt" -$null = FS-Remove-Silently "${__serial_control}" -function SUBROUTINE-Package { - param( - [string]$__line - ) - - - # initialize libraries from scratch - $null = . "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" - $null = . "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" - $null = . "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - $null = . "${env:LIBS_AUTOMATACI}\_package-archive_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-cargo_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-changelog_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-chocolatey_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-deb_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-docker_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-flatpak_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-homebrew_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-ipk_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-lib_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-msi_windows-any.ps1" - - $null = . "${env:LIBS_AUTOMATACI}\_package-pypi_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-rpm_windows-any.ps1" - $null = . "${env:LIBS_AUTOMATACI}\_package-sourcing_windows-any.ps1" - - - # parse input - $__command = $__line.Split("|")[-1] - $__log = $__line.Split("|")[-2] - $__arguments = $__line.Split("|") - $__arguments = $__arguments[0..$($__arguments.Length - 3)] - $__arguments = $__arguments -Join "|" - - $__subject = Split-Path -Leaf -Path "${__log}" - $__subject = FS-Extension-Remove "${__subject}" "*" - - - # execute - $null = I18N-Package "${__subject}" - $null = FS-Remove-Silently "${__log}" - - try { - ${function:SUBROUTINE-Exec} = Get-Command ` - "${__command}" ` - -ErrorAction SilentlyContinue - $($___process = SUBROUTINE-Exec "${__arguments}") *> "${__log}" - } catch { - $___process = 1 - } - if ($___process -ne 0) { - $null = I18N-Package-Failed - return 1 - } - - - # report status - return 0 +# clean up log directory +$DIRECTORY_LOG = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_LOG}\packagers" +$null = hestiaCONSOLE-Log-Recreate $DIRECTORY_LOG +$___process = hestiaFS-Recreate-Directory $DIRECTORY_LOG +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} } -# begin registering packagers -if ($(FS-Is-Directory "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}") -eq 0) { -foreach ($i in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}")) { - $i = $i.FullName +# clean up parallel control directory +$DIRECTORY_PARALLEL = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-parallel" +$null = hestiaCONSOLE-Log-Recreate $DIRECTORY_PARALLEL +$___process = hestiaFS-Recreate-Directory $DIRECTORY_PARALLEL +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} - $___process = FS-Is-File "$i" - if ($___process -ne 0) { - continue - } - # parse build candidate - $null = I18N-Detected "${i}" - $TARGET_FILENAME = Split-Path -Leaf $i - $TARGET_FILENAME = $TARGET_FILENAME -replace "\..*$" - $TARGET_OS = $TARGET_FILENAME -replace ".*_" - $TARGET_FILENAME = $TARGET_FILENAME -replace "_.*" - $TARGET_ARCH = $TARGET_OS -replace ".*-" - $TARGET_ARCH = $TARGET_ARCH -replace "\..*$" - $TARGET_OS = $TARGET_OS -replace "-.*" - $TARGET_OS = $TARGET_OS -replace "\..*$" - if (($(STRINGS-Is-Empty "${TARGET_OS}") -eq 0) -or - ($(STRINGS-Is-Empty "${TARGET_ARCH}") -eq 0) -or - ($(STRINGS-Is-Empty "${TARGET_FILENAME}") -eq 0)) { - $null = I18N-File-Has-Bad-Stat-Skipped - continue - } +# clean up serial control directory +$DIRECTORY_SERIAL = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\packagers-serial" +$null = hestiaCONSOLE-Log-Recreate $DIRECTORY_SERIAL +$___process = hestiaFS-Recreate-Directory $DIRECTORY_SERIAL +if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Recreate-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} - $___process = STRINGS-Has-Prefix "${env:PROJECT_SKU}" "${TARGET_FILENAME}" - if ($___process -ne 0) { - $___process = STRINGS-Has-Prefix "lib${env:PROJECT_SKU}" "${TARGET_FILENAME}" - if ($___process -ne 0) { - $null = I18N-Is-Incompatible-Skipped "${TARGET_FILENAME}" - continue - } - } - $__common = "${DEST}|${i}|${TARGET_FILENAME}|${TARGET_OS}|${TARGET_ARCH}" - # begin registrations - $null = I18N-Sync-Register "$i" +# setup subroutine function for parallel executions +function SUBROUTINE-Package { + param( + [string]$__line + ) + + + # parse input + $__arguments = $__line.Split("|") + $__filename = $__arguments[0] + $__target = $__arguments[1] + $__target_os = $__arguments[2] + $__target_arch = $__arguments[3] + $__package_time = $__arguments[4] + $__function = $__arguments[-1] + $__directory_log = $__arguments[-2] + $__directory_output = $__arguments[-3] + + if ($__directory_output -eq $__arguments[-4]) { + $__arguments = "" + } else { + $__arguments = $__arguments[5..($__arguments.Length - 4)] -join "|" + } + + + # import required libraries + $null = . "${env:LIBS_AUTOMATACI}\services\hestiaKERNEL\Vanilla.sh.ps1" + + + # execute + switch ("${__function}") { + "PACKAGE-APP" { + $__log = "${__directory_log}\app-${__filename}_${__target_os}-${__target_arch}.txt" + } "PACKAGE-ARCHIVE" { + $__log = "${__directory_log}\archive-${__filename}_${__target_os}-${__target_arch}.txt" + $null = . "${env:LIBS_AUTOMATACI}\_package-archive_windows-any.ps1" + $($___process = PACKAGE-ARCHIVE ` + $__filename ` + $__target ` + $__target_os ` + $__target_arch ` + $__package_time ` + $__directory_output ` + $__arguments) *>> $__log + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } "PACKAGE-SINGLE" { + $__log = "${__directory_log}\single-${__filename}_${__target_os}-${__target_arch}.txt" + $null = . "${env:LIBS_AUTOMATACI}\_package-single_windows-any.ps1" + $($___process = Package-SINGLE ` + $__filename ` + $__target ` + $__target_os ` + $__target_arch ` + $__package_time ` + $__directory_output ` + $__arguments) *>> $__log + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } "PACKAGE-UNIX" { + $__log = "${__directory_log}\unix-${__filename}_${__target_os}-${__target_arch}.txt" + } "PACKAGE-WINDOWS" { + $__log = "${__directory_log}\windows-${__filename}_${__target_os}-${__target_arch}.txt" + $null = . "${env:LIBS_AUTOMATACI}\_package-windows_windows-any.ps1" + $($___process = PACKAGE-WINDOWS ` + $__filename ` + $__target ` + $__target_os ` + $__target_arch ` + $__package_time ` + $__directory_output ` + $__arguments) *>> $__log + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } "PACKAGE-CONSOLIDATE" { + $__log = "${__directory_log}\consolidate-${__filename}_${__target_os}-${__target_arch}.txt" + $null = . "${env:LIBS_AUTOMATACI}\_package-consolidate_windows-any.ps1" + $($___process = PACKAGE-CONSOLIDATE ` + $__filename ` + $__target ` + $__target_os ` + $__target_arch ` + $__package_time ` + $__directory_output ` + $__arguments) *>> $__log + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } default { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + }} + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} - if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_ARCHIVE}") -ne 0) { - $__log = "archive_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-ARCHIVE -"@ - if ($___process -ne 0) { - return 1 - } - } - if ($(STRINGS-Is-Empty "${env:PROJECT_RUST}") -ne 0) { - $__log = "cargo_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-CARGO -"@ - if ($___process -ne 0) { - return 1 - } - } - - # NOTE: chocolatey only serve windows - if ($(STRINGS-Is-Empty "${env:PROJECT_CHOCOLATEY_URL}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "any", "windows" } { - $__log = "chocolatey_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-CHOCOLATEY +# register built artifacts for parallel executions +if ($(hestiaFS-Is-Directory $DIRECTORY_BUILD) -ne ${env:hestiaKERNEL_ERROR_OK}) { + # no artifacts at all - report status + $null = hestiaCONSOLE-Log-Success + return ${env:hestiaKERNEL_ERROR_OK} +} -"@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - # NOTE: deb does not work in windows or mac - if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "windows", "darwin" } { - $__log = "deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE-Run-DEB +foreach ($__artifact in (Get-ChildItem -Path $DIRECTORY_BUILD)) { + if ($(hestiaFS-Is-File $__artifact) -ne ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + + # parse build candidate + $TARGET_FILENAME = hestiaFS-Get-File $__artifact + $TARGET_FILENAME = $TARGET_FILENAME -replace "\..*$", '' + $TARGET_OS = $TARGET_FILENAME -replace ".*_", '' + $TARGET_FILENAME = $TARGET_FILENAME -replace "_.*", '' + $TARGET_ARCH = $TARGET_OS -replace ".*-", '' + $TARGET_ARCH = $TARGET_ARCH -replace "\..*$", '' + $TARGET_OS = $TARGET_OS -replace "-.*", '' + $TARGET_OS = $TARGET_OS -replace "\..*$", '' + $TAG_COMMON = "${TARGET_FILENAME}|${__artifact}|${TARGET_OS}|${TARGET_ARCH}|${PACKAGE_TIME}" + + if ( + ($(hestiaSTRING-Is-Empty $TARGET_OS) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $TARGET_ARCH) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $TARGET_FILENAME) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + continue + } + + + # register for single object type package + if ( + ($(hestiaPDF-Is-Target-Valid $__artifact) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + # register for single object type package + $___process = hestiaFS-Append-File "${DIRECTORY_PARALLEL}/control.txt" @" +${TAG_COMMON}|${DIRECTORY_OUTPUT}|${DIRECTORY_LOG}|PACKAGE-SINGLE "@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - # NOTE: container only server windows and linux - if ($(STRINGS-Is-Empty "${env:PROJECT_CONTAINER_REGISTRY}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "any", "linux", "windows" } { - $__log = "docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__serial_control}" @" -${__common}|${__log}|PACKAGE-Run-DOCKER + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } -"@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - # NOTE: flatpak only serve linux - $___process = FLATPAK-Is-Available - if (($___process -eq 0) -and - ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0)) { - switch ("${TARGET_OS}") { - { $_ -in "any", "linux" } { - $__log = "flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__serial_control}" @" -${__common}|${FLATPAK_REPO}|${__log}|PACKAGE-Run-FLATPAK + continue + } -"@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - # NOTE: homebrew only serve linux and mac - if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "any", "darwin", "linux" } { - $__log = "homebrew_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${HOMEBREW_WORKSPACE}|${__log}|PACKAGE-Run-HOMEBREW -"@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_IPK}") -ne 0) { - $__log = "ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-IPK + # register for classical .tar.xz, .zip, & .nupkg types + $___process = hestiaFS-Append-File "${DIRECTORY_PARALLEL}/control.txt" @" +${TAG_COMMON}|${DIRECTORY_OUTPUT}|${DIRECTORY_LOG}|PACKAGE-ARCHIVE "@ - if ($___process -ne 0) { - return 1 - } - } - - if (($(FS-Is-Target-A-Library "${i}") -eq 0) -and - ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_ARCHIVE}") -ne 0)) { - $__log = "lib_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-LIB + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } -"@ - if ($___process -ne 0) { - return 1 - } - } - - # NOTE: MSI only works in windows - if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "any", "windows" } { - $__log = "msi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${MSI_WORKSPACE}|${__log}|PACKAGE-Run-MSI -"@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } - - if ($(FS-Is-Target-A-PDF "${i}") -eq 0) { - $__log = "PDF_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-PDF + # bail tech-specific artifacts since the following no longer needs them + if ( + ($(hestiaWASM-Is-Target-Valid-JS $__artifact) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaNPM-Is-Target-Valid $__artifact) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaRUST-Is-Target-Valid $__artifact) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + continue + } -"@ - if ($___process -ne 0) { - return 1 - } - } - if ($(STRINGS-Is-Empty "${env:PROJECT_PYTHON}") -ne 0) { - $__log = "pypi_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-PYPI + # register for homebrew type + if ( + ($(hestiaSTRING-Is-Empty ${env:PROJECT_HOMEBREW_URL}) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($TARGET_OS -ne "windows") + ) { + $___process = hestiaFS-Append-File "${DIRECTORY_PARALLEL}/control.txt" @" +${TAG_COMMON}|${DIRECTORY_HOMEBREW}|${DIRECTORY_LOG}|PACKAGE-CONSOLIDATE "@ - if ($___process -ne 0) { - return 1 - } - } - - # NOTE: RPM only serve linux - if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -ne 0) { - switch ("${TARGET_OS}") { - { $_ -in "any", "linux" } { - $__log = "rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" - $__log = "${__log_directory}\${__log}" - $___process = FS-Append-File "${__parallel_control}" @" -${__common}|${__log}|PACKAGE-Run-RPM + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # register for windows type + if ( + ($(hestiaSTRING-Is-Empty ${env:PROJECT_MSI_CODEPAGE}) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ( + ($TARGET_OS -eq "windows") -or + ($TARGET_OS -eq "any") + ) + ) { + $___process = hestiaFS-Append-File "${DIRECTORY_PARALLEL}/control.txt" @" +${TAG_COMMON}|${DIRECTORY_MSI}|${DIRECTORY_LOG}|PACKAGE-WINDOWS "@ - if ($___process -ne 0) { - return 1 - } - } default { - }} - } -} -} + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } -$null = I18N-Sync-Run -$___process = FS-Is-File "${__parallel_control}" -if ($___process -eq 0) { - $___process = SYNC-Exec-Parallel ` - ${function:SUBROUTINE-Package}.ToString() ` - "${__parallel_control}" ` - "${__control_directory}" - if ($___process -ne 0) { - $null = I18N-Sync-Failed - return 1 - } + # register app-only sandboxed|containerized packages } -if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -ne 0) { - $null = I18N-Newline - $null = I18N-Newline - - $__dest = "${env:PROJECT_SKU}.rb" - $null = I18N-Export "${__dest}" - $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${__dest}" - $___process = HOMEBREW-Seal "${__dest}" ` - "${env:PROJECT_SKU}-homebrew_${env:PROJECT_VERSION}_any-any.tar.xz" ` - "${HOMEBREW_WORKSPACE}" ` - "${env:PROJECT_SKU}" ` - "${env:PROJECT_PITCH}" ` - "${env:PROJECT_CONTACT_WEBSITE}" ` - "${env:PROJECT_LICENSE}" ` - "${env:PROJECT_HOMEBREW_URL}" - if ($___process -ne 0) { - $null = I18N-Export-Failed - return 1 - } + + +# execute in parallel +$null = hestiaCONSOLE-Log-Run $DIRECTORY_PARALLEL +if ($(hestiaFS-Is-File "${DIRECTORY_PARALLEL}\control.txt") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaKERNEL-Run-Parallel-Sentinel ` + ${function:SUBROUTINE-Package}.ToString() ` + $DIRECTORY_PARALLEL + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } } -if ($(STRINGS-Is-Empty "${env:PROJECT_MSI_INSTALL_DIRECTORY}") -ne 0) { - $null = I18N-Newline - $null = I18N-Newline - # sort 'any' arch into others - $___process = PACKAGE-Sort-MSI "${MSI_WORKSPACE}" - if ($___process -ne 0) { - return 1 - } +# execute homebrew package +if ($(hestiaSTRING-Is-Empty ${env:PROJECT_HOMEBREW_URL}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $__dest = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}\${env:PROJECT_SKU}.rb" + $null = hestiaCONSOLE-Log-Package $__dest + $___process = hestiaHOMEBREW-Package ` + $__dest ` + "${env:PROJECT_SKU}-${env:PROJECT_HOMEBREW_ID}_${env:PROJECT_VERSION}_any-any.tar.xz" ` + $DIRECTORY_HOMEBREW ` + ${env:PROJECT_SKU} ` + ${env:PROJECT_PITCH} ` + ${env:PROJECT_CONTACT_WEBSITE} ` + ${env:PROJECT_LICENSE} ` + ${env:PROJECT_HOMEBREW_URL} + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } +} + - # seal all MSI packages - foreach ($_candidate in (Get-ChildItem -Path "${MSI_WORKSPACE}" -Directory)) { - $_candidate = $_candidate.FullName - $null = I18N-Newline - $___process = PACKAGE-Seal-MSI ` - "${_candidate}" ` - "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" - if ($___process -ne 0) { - return 1 - } - } +# execute msi package +if ($(hestiaSTRING-Is-Empty ${env:PROJECT_MSI_CODEPAGE}) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package "MSI" + if ($(hestiaFS-Is-Directory "${DIRECTORY_MSI}\any") -eq ${env:hestiaKERNEL_ERROR_OK}) { + # 'any' arch exists - merge into existing ones + foreach ($_arch in (Get-ChildItem -Path $DIRECTORY_MSI)) { + if ($(hestiaFS-Is-Directory $_arch) -ne ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + if ($(hestiaFS-Get-File $_arch) -eq "any") { + continue + } + + $null = hestiaCONSOLE-Log-Merge $_arch "${DIRECTORY_MSI}\any" + $___process = hestiaFS-Merge-Directories $_arch "${DIRECTORY_MSI}\any" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Merge-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # remove 'any' arch to prevent dirty compilations + $___process = hestiaFS-Remove "${DIRECTORY_MSI}\any" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Merge-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # begin package creation + foreach ($_arch in (Get-ChildItem -Path $DIRECTORY_MSI)) { + if ($(hestiaFS-Is-Directory $_arch) -ne ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + + $null = hestiaCONSOLE-Log-Package $_arch + $___process = hestiaMSI-Package ` + "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_PKG}" ` + $_arch ` + ${env:PROJECT_SKU} ` + ${env:PROJECT_VERSION} ` + ${env:PRODUCT_APP_UUID} ` + ${env:PROJECT_SCOPE} ` + ${env:PROJECT_NAME} ` + ${env:PROJECT_CONTACT_NAME} ` + ${env:PROJECT_CONTACT_WEBSITE} ` + ${env:PROJECT_MSI_INSTALLER_VERSION_WINDOWS} ` + ${env:PROJECT_MSI_INSTALLER_SCOPE} ` + ${env:PROJECT_MSI_REGISTRY_KEY} ` + ${env:PROJECT_MSI_BIN_COMPONENT_GUID} ` + ${env:PROJECT_MSI_ETC_COMPONENT_GUID} ` + ${env:PROJECT_MSI_LIB_COMPONENT_GUID} ` + ${env:PROJECT_MSI_DOC_COMPONENT_GUID} ` + ${env:PROJECT_MSI_REGISTRIES_GUID} ` + ${env:PROJECT_MSI_CODEPAGE} ` + $DIRECTORY_DOTNET + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Package-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } } -$null = I18N-Sync-Run-Series -$___process = FS-Is-File "${__serial_control}" -if ($___process -eq 0) { - $___process = SYNC-Exec-Serial ` - ${function:SUBROUTINE-Package}.ToString() ` - "${__serial_control}" - if ($___process -ne 0) { - $null = I18N-Sync-Failed - return 1 - } + + +# execute in serial +$null = hestiaCONSOLE-Log-Run $DIRECTORY_SERIAL +if ($(hestiaFS-Is-File "${DIRECTORY_SERIAL}\control.txt") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaKERNEL-Run-Parallel-Sentinel ` + ${function:SUBROUTINE-Package}.ToString() ` + $DIRECTORY_SERIAL ` + "1" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaCONSOLE-Log-Run-Failed $___process + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } } # report status -$null = I18N-Run-Successful -return 0 +$null = hestiaCONSOLE-Log-Success +return ${env:hestiaKERNEL_ERROR_OK} diff --git a/automataCI/release_unix-any.sh b/automataCI/release_unix-any.sh index 3562d3e..9614a77 100644 --- a/automataCI/release_unix-any.sh +++ b/automataCI/release_unix-any.sh @@ -34,6 +34,7 @@ fi . "${LIBS_AUTOMATACI}/_release-homebrew_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-lib_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-npm_unix-any.sh" +. "${LIBS_AUTOMATACI}/_release-nupkg_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-project_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-pypi_unix-any.sh" . "${LIBS_AUTOMATACI}/_release-research_unix-any.sh" @@ -169,6 +170,12 @@ for TARGET in "$PACKAGE_DIRECTORY"/*; do fi + RELEASE_Run_NUPKG "$TARGET" + if [ $? -ne 0 ]; then + return 1 + fi + + RELEASE_Run_PYPI "$TARGET" if [ $? -ne 0 ]; then return 1 diff --git a/automataCI/release_windows-any.ps1 b/automataCI/release_windows-any.ps1 index 69dd698..c833a93 100644 --- a/automataCI/release_windows-any.ps1 +++ b/automataCI/release_windows-any.ps1 @@ -33,6 +33,7 @@ if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { . "${env:LIBS_AUTOMATACI}\_release-homebrew_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-lib_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-npm_windows-any.ps1" +. "${env:LIBS_AUTOMATACI}\_release-nupkg_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-project_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-pypi_windows-any.ps1" . "${env:LIBS_AUTOMATACI}\_release-research_windows-any.ps1" @@ -160,6 +161,11 @@ foreach ($TARGET in (Get-ChildItem -Path "${PACKAGE_DIRECTORY}")) { $TARGET = $T return 1 } + $___process = RELEASE-Run-NUPKG "$TARGET" + if ($___process -ne 0) { + return 1 + } + $___process = RELEASE-Run-PYPI "$TARGET" if ($___process -ne 0) { return 1 diff --git a/automataCI/services/compilers/deb.ps1 b/automataCI/services/compilers/deb.ps1 index faf5cec..944b89b 100644 --- a/automataCI/services/compilers/deb.ps1 +++ b/automataCI/services/compilers/deb.ps1 @@ -1104,7 +1104,9 @@ function DEB-Unpack { # execute # copy target into directory - $___process = FS-Copy-File "${___target}" "${___directory}" + $___process = FS-Copy-File ` + "${___target}" ` + "${___directory}\$(FS-Get-File "${___target}")" if ($___process -ne 0) { return 1 } diff --git a/automataCI/services/compilers/deb.sh b/automataCI/services/compilers/deb.sh index 4642f01..ce5e3d6 100644 --- a/automataCI/services/compilers/deb.sh +++ b/automataCI/services/compilers/deb.sh @@ -1063,10 +1063,6 @@ DEB_Unpack() { # validate input - if [ $(STRINGS_Is_Empty "$___directory") -eq 0 ]; then - return 1 - fi - FS_Is_Directory "$___directory" if [ $? -ne 0 ]; then return 1 @@ -1095,7 +1091,7 @@ DEB_Unpack() { # execute # copy target into directory - FS_Copy_File "$___target" "$___directory" + FS_Copy_File "$___target" "${___directory}/$(FS_Get_File "$___target")" if [ $? -ne 0 ]; then return 1 fi diff --git a/automataCI/services/hestiaCHANGELOG/Assemble_DEB.sh.ps1 b/automataCI/services/hestiaCHANGELOG/Assemble_DEB.sh.ps1 new file mode 100644 index 0000000..8c5569e --- /dev/null +++ b/automataCI/services/hestiaCHANGELOG/Assemble_DEB.sh.ps1 @@ -0,0 +1,254 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Compress.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCHANGELOG-Assemble-DEB { + param ( + [string]$___filepath, + [string]$___data_directory, + [string]$___version + ) + + + # validate input + if ($(hestiaGIT-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___data_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ( + ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaFS-Is-File "${___filepath}.gz") -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXIST} + } + + if ($(hestiaFS-Is-Directory $___data_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + + # execute + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory "${___filepath}")" + + + # write the latest first + if ($(hestiaFS-Is-File "${___data_directory}\latest") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + $___initiated = ${env:hestiaKERNEL_DATA_MISSING} + foreach ($___line in (Get-Content "${___data_directory}\latest")) { + $___process = hestiaFS-Append-File $___filepath "${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___initiated = ${env:hestiaKERNEL_ERROR_OK} + } + + + # loop through each git tag and append accordingly + foreach ($___tag in (Invoke-Expression "git tag --sort -version:refname")) { + if ($(hestiaFS-Is-File "${___data_directory}\$($___tag -replace ".*v", '')") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + foreach ($___line in (Get-Content "${___data_directory}\$($___tag -replace ".*v", '')")) { + $___process = hestiaFS-Append-File $___filepath "${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($___initiated -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath "`n`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + $___initiated = ${env:hestiaKERNEL_ERROR_OK} + } + } + + + # gunzip the target + $___process = hestiaGZ-Compress $___filepath + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Compress.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCHANGELOG_Assemble_DEB() { + #___filepath="$1" + #___data_directory="$2" + #___version="$3" + + + # validate input + if [ $(hestiaGIT_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaFS_Is_File "${1}.gz") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXIST + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + + + # write the latest first + if [ $(hestiaFS_Is_File "${2}/latest") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + ___initiated=$hestiaKERNEL_DATA_MISSING + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + hestiaFS_Append_File "$1" "${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___initiated=$hestiaKERNEL_ERROR_OK + done < "${2}/latest" + IFS="$___old_IFS" + unset ___old_IFS + + + # loop through each git tag and append accordingly + for ___tag in $(git tag --sort -version:refname); do + if [ $(hestiaFS_Is_File "${2}/${___tag##*v}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $___initiated -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\n\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + hestiaFS_Append_File "$1" "${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___initiated=$hestiaKERNEL_ERROR_OK + done < "${2}/${___tag##*v}" + IFS="$___old_IFS" + unset ___old_IFS + done + + + # gunzip the target + hestiaGZ_Compress "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1 b/automataCI/services/hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1 new file mode 100644 index 0000000..e292fa3 --- /dev/null +++ b/automataCI/services/hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1 @@ -0,0 +1,248 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCHANGELOG-Assemble-MARKDOWN { + param ( + [string]$___filepath, + [string]$___data_directory, + [string]$___title, + [string]$___version + ) + + + # validate input + if ($(hestiaGIT-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___data_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___title) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXIST} + } + + if ($(hestiaFS-Is-Directory $___data_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + + # execute + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory "${___filepath}")" + $___process = hestiaFS-Write-File $___filepath "# ${___title}`n`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # write the latest first + if ($(hestiaFS-Is-File "${___data_directory}\latest") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + $___process = hestiaFS-Append-File $___filepath "`n## ${___version}`n`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + foreach ($___line in (Get-Content "${___data_directory}\latest")) { + $___process = hestiaFS-Append-File $___filepath "* ${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # loop through each git tag and append accordingly + foreach ($___tag in (Invoke-Expression "git tag --sort -version:refname")) { + if ($(hestiaFS-Is-File "${___data_directory}\$($___tag -replace ".*v", '')") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + $___process = hestiaFS-Append-File $___filepath "`n`n## ${___tag}`n`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + foreach ($___line in (Get-Content "${___data_directory}\$($___tag -replace ".*v", '')")) { + $___process = hestiaFS-Append-File $___filepath "* ${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCHANGELOG_Assemble_MARKDOWN() { + #___filepath="$1" + #___data_directory="$2" + #___title="$3" + #___version="$4" + + + # validate input + if [ $(hestiaGIT_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXIST + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + hestiaFS_Write_File "$1" "# ${3}\n\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # write the latest first + if [ $(hestiaFS_Is_File "${2}/latest") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + hestiaFS_Append_File "$1" "\n## ${4}\n\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + hestiaFS_Append_File "$1" "* ${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "${2}/latest" + IFS="$___old_IFS" + unset ___old_IFS + + + # loop through each git tag and append accordingly + for ___tag in $(git tag --sort -version:refname); do + if [ $(hestiaFS_Is_File "${2}/${___tag##*v}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + hestiaFS_Append_File "$1" "\n\n## ${___tag}\n\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + hestiaFS_Append_File "$1" "* ${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "${2}/${___tag##*v}" + IFS="$___old_IFS" + unset ___old_IFS + done + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHANGELOG/Assemble_RPM.sh.ps1 b/automataCI/services/hestiaCHANGELOG/Assemble_RPM.sh.ps1 new file mode 100644 index 0000000..86e6904 --- /dev/null +++ b/automataCI/services/hestiaCHANGELOG/Assemble_RPM.sh.ps1 @@ -0,0 +1,264 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCHANGELOG-Assemble-RPM { + param ( + [string]$___filepath, + [string]$___data_directory, + [string]$___date, + [string]$___name, + [string]$___email, + [string]$___version, + [string]$___cadence + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___data_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___date) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___name) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___email) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___cadence) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ( + ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaFS-Is-File "${___filepath}.gz") -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXIST} + } + + if ($(hestiaFS-Is-Directory $___data_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + + # execute + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___filepath)" + + + # emit stanza + $___process = hestiaFS-Write-File $___filepath "%%changelog`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # emit latest changelog + if ($(hestiaFS-Is-File "${___data_directory}\latest") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +* ${___date} ${___name} <${___email}> - ${___version}-${___cadence} + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + foreach ($___line in (Get-Content "${___data_directory}\latest")) { + $___process = hestiaFS-Append-File $___filepath "- ${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } else { + $___process = hestiaFS-Append-File $___filepath "# unavailable`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # emit tailing newline + $___process = hestiaFS-Append-File $___filepath "`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCHANGELOG_Assemble_RPM() { + #___filepath="$1" + #___data_directory="$2" + #___date="$3" + #___name="$4" + #___email="$5" + #___version="$6" + #___cadence="$7" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXIST + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + + + # emit stanza + hestiaFS_Append_File "$1" "%%changelog\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # emit latest changelog + if [ $(hestiaFS_Is_File "${2}/latest") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +* ${3} ${4} <${5}> - ${6}-${7} +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + ___line="${___line%%#*}" + if [ $(hestiaSTRING_Is_Empty "$___line") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "$1" "- ${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "${2}/latest" + IFS="$___old_IFS" + unset ___old_IFS + else + hestiaFS_Append_File "$1" "# unavailable\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # emit tailing newline + hestiaFS_Append_File "$1" "\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHANGELOG/Vanilla.sh.ps1 b/automataCI/services/hestiaCHANGELOG/Vanilla.sh.ps1 new file mode 100644 index 0000000..dc10ab2 --- /dev/null +++ b/automataCI/services/hestiaCHANGELOG/Vanilla.sh.ps1 @@ -0,0 +1,58 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCHANGELOG\Assemble_DEB.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCHANGELOG\Assemble_MARKDOWN.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCHANGELOG\Assemble_RPM.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCHANGELOG/Assemble_DEB.sh.ps1" +. "${LIBS_HESTIA}/hestiaCHANGELOG/Assemble_MARKDOWN.sh.ps1" +. "${LIBS_HESTIA}/hestiaCHANGELOG/Assemble_RPM.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHOCOLATEY/Install.sh.ps1 b/automataCI/services/hestiaCHOCOLATEY/Install.sh.ps1 new file mode 100644 index 0000000..e3feb51 --- /dev/null +++ b/automataCI/services/hestiaCHOCOLATEY/Install.sh.ps1 @@ -0,0 +1,117 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCHOCOLATEY\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Exec.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCHOCOLATEY-Install { + param ( + [string]$___package + ) + + + # validate input + if ($(hestiaCHOCOLATEY-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___package) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___process = OS-Exec "choco" "install `"${___package}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaCHOCOLATEY/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCHOCOLATEY_Install() { + #___package="$1" + + + # validate input + if [ $(hestiaCHOCOLATEY_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + choco install "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHOCOLATEY/Is_Available.sh.ps1 b/automataCI/services/hestiaCHOCOLATEY/Is_Available.sh.ps1 new file mode 100644 index 0000000..e3d100e --- /dev/null +++ b/automataCI/services/hestiaCHOCOLATEY/Is_Available.sh.ps1 @@ -0,0 +1,86 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaCHOCOLATEY-Is-Available { + # execute + if ($(hestiaOS-Is-Command-Available "choco") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaCHOCOLATEY_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "choco") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCHOCOLATEY/Vanilla.sh.ps1 b/automataCI/services/hestiaCHOCOLATEY/Vanilla.sh.ps1 new file mode 100644 index 0000000..972084a --- /dev/null +++ b/automataCI/services/hestiaCHOCOLATEY/Vanilla.sh.ps1 @@ -0,0 +1,56 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCHOCOLATEY\Install.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCHOCOLATEY\Is_Available.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCHOCOLATEY/Install.sh.ps1" +. "${LIBS_HESTIA}/hestiaCHOCOLATEY/Is_Available.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCITATION/Assemble.sh.ps1 b/automataCI/services/hestiaCITATION/Assemble.sh.ps1 new file mode 100644 index 0000000..40212e0 --- /dev/null +++ b/automataCI/services/hestiaCITATION/Assemble.sh.ps1 @@ -0,0 +1,578 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCITATION-Assemble { + param( + [string]$___filepath, + [string]$___abstract_filepath, + [string]$___citation_filepath, + [string]$___cff_version, + [string]$___type, + [string]$___date, + [string]$___title, + [string]$___version, + [string]$___license, + [string]$___repo, + [string]$___repo_code, + [string]$___repo_artifact, + [string]$___contact_name, + [string]$___contact_website, + [string]$___contact_email + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___cff_version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} # disabled by explicit request + } + + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___abstract_filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___citation_filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXIST} + } + + if ($(hestiaFS-Is-File $___abstract_filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} + } + + if ($(hestiaFS-Is-File $___citation_filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} + } + + if ($(hestiaSTRING-Is-Empty $___type) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___title) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___filepath)" + + + $___process = hestiaFS-Write-File $___filepath @" +# WARNING: auto-generated by AutomataCI + +cff-version: `"${___cff_version}`" +type: `"${___type}`" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # write date field + if ($(hestiaSTRING-Is-Empty $___date) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +date-released: "${___date}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write title field + if ($(STRINGS-Is-Empty $___title) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +title: "${___title}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write version field + if ($(hestiaSTRING-Is-Empty $___version) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +version: "${___version}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write license field + if ($(hestiaSTRING-Is-Empty $___license) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +license: "${___license}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write repository field + if ($(hestiaSTRING-Is-Empty $___repo) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +repository: "${___repo}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write repository code field + if ($(hestiaSTRING-Is-Empty $___repo_code) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +repository-code: "${___repo_code}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write repository artifact field + if ($(hestiaSTRING-Is-Empty $___repo_artifact) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +repository-artifact: "${___repo_artifact}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write url field + if ($(hestiaSTRING-Is-Empty $___contact_website) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" +url: "${___contact_website}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write contact field + if ($(hestiaSTRING-Is-Empty $___contact_name) -ne ${env:hestiaKERNEL_ERROR_OK}) { + if ( + ($(hestiaSTRING-Is-Empty $___contact_website) -ne ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___contact_email) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + $___process = hestiaFS-Append-File $___filepath @" +contact: + - affiliation: "${___contact_name}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # write contact email field + if ($(hestiaSTRING-Is-Empty $___contact_email) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" + email: "${___contact_email}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # write contact website field + if ($(hestiaSTRING-Is-Empty $___contact_website) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___filepath @" + website: "${___contact_website}" + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + } + } + + + # write abstract field + $___process = hestiaFS-Append-File $___filepath @" +abstract: |- + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + foreach ($___line in (Get-Content $___abstract_filepath)) { + if ( + ($(hestiaSTRING-Is-Empty $___line) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty "$($___line -replace "#.*$", '')") -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + continue + } + + $___line = $___line -replace '#.*', '' + if ($(hestiaSTRING-Is-Empty $___line) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___line = " ${___line}" + } + + $___process = hestiaFS-Append-File $___filepath "${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return 1 + } + } + + + # append remaining fields from citation_filepath + foreach ($___line in (Get-Content $___citation_filepath)) { + if ( + ($(hestiaSTRING-Is-Empty $___line) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty "$($___line -replace "#.*$", '')") -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + continue + } + + $___line = $___line -replace '#.*', '' + if ($(STRINGS-Is-Empty $___line) -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___process = hestiaFS-Append-File $___filepath "${___line}`n" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCITATION_Assemble() { + #___filepath="$1" + #___abstract_filepath="$2" + #___citation_filepath="$3" + #___cff_version="$4" + #___type="$5" + #___date="$6" + #___title="$7" + #___version="$8" + #___license="$9" + #___repo="${10}" + #___repo_code="${11}" + #___repo_artifact="${12}" + #___contact_name="${13}" + #___contact_website="${14}" + #___contact_email="${15}" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK # disabled by explicit request + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXIST + fi + + if [ $(hestiaFS_Is_File "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_FILE + fi + + if [ $(hestiaFS_Is_File "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_FILE + fi + + if [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + # write compulsory fields + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + hestiaFS_Write_File "$1" "\ +# WARNING: auto-generated by AutomataCI + +cff-version: \"${4}\" +type: \"${5}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # write date field + if [ $(hestiaSTRING_Is_Empty "$6") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +date-released: \"${6}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write title field + if [ $(hestiaSTRING_Is_Empty "$7") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +title: \"${7}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write version field + if [ $(hestiaSTRING_Is_Empty "$8") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +version: \"${8}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write license field + if [ $(hestiaSTRING_Is_Empty "$9") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +license: \"${9}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write repository field + if [ $(hestiaSTRING_Is_Empty "${10}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +repository: \"${10}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write repository code field + if [ $(hestiaSTRING_Is_Empty "${11}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +repository-code: \"${11}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write repository artifact field + if [ $(hestiaSTRING_Is_Empty "${12}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +repository-artifact: \"${12}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write url field + if [ $(hestiaSTRING_Is_Empty "${14}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +url: \"${14}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write contact field + if [ $(hestiaSTRING_Is_Empty "${13}") -ne $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "${14}") -ne $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "${15}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ +contact: + - affiliation: \"${13}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # write contact email field + if [ $(hestiaSTRING_Is_Empty "${15}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ + email: \"${15}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # write contact website field + if [ $(hestiaSTRING_Is_Empty "${14}") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "$1" "\ + website: \"${14}\" +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + fi + fi + + + # write abstract field + hestiaFS_Append_File "$1" "\ +abstract: |- +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + if [ $(hestiaSTRING_Is_Empty "$___line") -ne $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "${___line%%#*}") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + ___line="${___line%%#*}" + if [ $(hestiaSTRING_Is_Empty "$___line") -ne $hestiaKERNEL_ERROR_OK ]; then + ___line=" ${___line}" + fi + + hestiaFS_Append_File "$1" "${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "$2" + IFS="$___old_IFS" && unset ___old_IFS + + + # append remaining fields from citation_filepath + ___old_IFS="$IFS" + while IFS="" read -r ___line || [ -n "$___line" ]; do + if [ $(hestiaSTRING_Is_Empty "$___line") -ne $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "${___line%%#*}") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + ___line="${___line%%#*}" + if [ $(hestiaSTRING_Is_Empty "$___line") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "$1" "${___line}\n" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < "$3" + IFS="$___old_IFS" && unset ___old_IFS + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCITATION/Vanilla.sh.ps1 b/automataCI/services/hestiaCITATION/Vanilla.sh.ps1 new file mode 100644 index 0000000..76e2db3 --- /dev/null +++ b/automataCI/services/hestiaCITATION/Vanilla.sh.ps1 @@ -0,0 +1,54 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCITATION\Assemble.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCITATION/Assemble.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log.sh.ps1 new file mode 100644 index 0000000..2efc629 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log.sh.ps1 @@ -0,0 +1,220 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Done.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Error.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Info.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Note.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_OK.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Success.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Warning.sh.ps1" + + + + +function hestiaCONSOLE-Log { + param( + [string]$___mode, + [string]$___message, + [string]$___lang, + [string]$___appendix + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $___color = "" + $___foreground_color = "Gray" + switch ($___mode) { + error { + $___tag = hestiaI18N-Translate-Error $___lang + $___color = "31" + $___foreground_color = "Red" + } warning { + $___tag = hestiaI18N-Translate-Warning $___lang + $___color = "33" + $___foreground_color = "Yellow" + } info { + $___tag = hestiaI18N-Translate-Info $___lang + $___color = "36" + $___foreground_color = "Cyan" + } note { + $___tag = hestiaI18N-Translate-Note $___lang + $___color = "35" + $___foreground_color = "Magenta" + } success { + $___tag = hestiaI18N-Translate-Success $___lang + $___color = "32" + $___foreground_color = "Green" + } ok { + $___tag = hestiaI18N-Translate-OK $___lang + $___color = "36" + $___foreground_color = "Cyan" + } done { + $___tag = hestiaI18N-Translate-Done $___lang + $___color = "36" + $___foreground_color = "Cyan" + } default { + $___tag = "" + $___color = "" + $___foreground_color = "" + }} + + if (-not [string]::IsNullOrEmpty($___tag)) { + $___tag = "⦗ $($___tag.ToUpper()) ⦘" + $___tag = "$("{0,-14} " -f $___tag)" + } + + if (-not [string]::IsNullOrEmpty($___appendix)) { + $___message ="${___appendix} ➞ ${___message}" + } + + if ( + ($Host.UI.RawUI.ForegroundColor -ge "DarkGray") -or + (${env:TERM} -eq "xterm-256color") -or + (${env:COLORTERM} -eq "truecolor", "24bit") -and + ( + (-not ([string]::IsNullOrEmpty($___color))) -and + (-not ([string]::IsNullOrEmpty($___foreground_color))) + ) + ) { + # terminal supports color mode + $null = Write-Host ` + -NoNewLine ` + -ForegroundColor $___foreground_color @" +$([char]0x1b)[1;${___color}m${___tag}$([char]0x1b)[0;${___color}m${___message}$([char]0x1b)[0m +"@ + } else { + $null = Write-Host -NoNewLine "${___tag}${___message}" + } +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Done.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Error.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Info.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Note.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_OK.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Success.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Warning.sh.ps1" + + + + +hestiaCONSOLE_Log() { + #___mode="$1" + #___message="$2" + #___lang="$3" + #___appendix="$4" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$3")" + ___color="" + case "$1" in + error) + ___tag="$(hestiaI18N_Translate_Error "$___lang")" + ___color="31" + ;; + warning) + ___tag="$(hestiaI18N_Translate_Warning "$___lang")" + ___color="33" + ;; + info) + ___tag="$(hestiaI18N_Translate_Info "$___lang")" + ___color="36" + ;; + note) + ___tag="$(hestiaI18N_Translate_Note "$___lang")" + ___color="35" + ;; + success) + ___tag="$(hestiaI18N_Translate_Success "$___lang")" + ___color="32" + ;; + ok) + ___tag="$(hestiaI18N_Translate_OK "$___lang")" + ___color="36" + ;; + done) + ___tag="$(hestiaI18N_Translate_Done "$___lang")" + ___color="36" + ;; + *) + # do nothing + ;; + esac + + if [ ! "$___tag" = "" ]; then + ___tag="⦗ $(printf -- "%s" "$___tag" | tr '[:lower:]' '[:upper:]') ⦘" + ___tag="$(printf -- "%-17s " "$___tag")" + fi + + ___msg="$2" + if [ ! -z "$4" ]; then + ___msg="${4} ➞ ${___msg}" + fi + + if ([ ! -z "$COLORTERM" ] || [ "$TERM" = "xterm-256color" ]) && [ ! -z "$___color" ]; then + # terminal supports color mode + 1>&2 printf -- "\033[1;${___color}m%s\033[0;${___color}m %b\033[0m" \ + "$___tag" \ + "$___msg" + else + 1>&2 printf -- "%s%b" "$___tag" "$___msg" + fi + unset ___color ___tag ___lang ___msg + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Assemble.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Assemble.sh.ps1 new file mode 100644 index 0000000..803013d --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Assemble.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble.sh.ps1" + + + + +function hestiaCONSOLE-Log-Assemble { + param ( + [string]$___destination, + [string]$___source, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Assemble $___lang $___destination $___source)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble.sh.ps1" + + + + +hestiaCONSOLE_Log_Assemble() { + #___destination="$1" + #___source="$2" + #___lang="$3" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$3")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Assemble "$___lang" "$1" "$2")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Assemble_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Assemble_Failed.sh.ps1 new file mode 100644 index 0000000..c6035e7 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Assemble_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Assemble-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Assemble-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Assemble_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Assemble_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Assemble_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Assemble_Simulate.sh.ps1 new file mode 100644 index 0000000..215f244 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Assemble_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Assemble-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Assemble-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Assemble_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Assemble_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1 new file mode 100644 index 0000000..2edaca2 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Assemble-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Assemble-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Assemble_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Assemble_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Check.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Check.sh.ps1 new file mode 100644 index 0000000..4a46085 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Check.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check.sh.ps1" + + + + +function hestiaCONSOLE-Log-Check { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = "$(hestiaLOCALE-Get-Lang "${___lang}")" + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Check "${___lang}" "${___subject}")`n" ` + "${___lang}" + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check.sh.ps1" + + + + +hestiaCONSOLE_Log_Check() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info "$(hestiaI18N_Translate_Check "$___lang" "$1")\n" "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Check_Availability.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Check_Availability.sh.ps1 new file mode 100644 index 0000000..0a94df4 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Check_Availability.sh.ps1 @@ -0,0 +1,98 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Availability.sh.ps1" + + + + +function hestiaCONSOLE-Log-Check-Availability { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Check-Availability $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Availability.sh.ps1" + + + + +hestiaCONSOLE_Log_Check_Availability() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Check_Availability "$___lang" "$1")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Check_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Check_Failed.sh.ps1 new file mode 100644 index 0000000..9dcc652 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Check_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Check-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Check-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Check_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Check_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Check_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Check_Simulate.sh.ps1 new file mode 100644 index 0000000..be12df4 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Check_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Check-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = "$(hestiaLOCALE-Get-Lang "${___lang}")" + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Check-Simulate "${___lang}")`n" ` + "${___lang}" + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Check_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Check_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Check_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Check_Skipped.sh.ps1 new file mode 100644 index 0000000..e4216a9 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Check_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Check-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Check-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Check_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Check_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Create.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Create.sh.ps1 new file mode 100644 index 0000000..10f49e4 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Create.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create.sh.ps1" + + + + +function hestiaCONSOLE-Log-Create { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Create $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create.sh.ps1" + + + + +hestiaCONSOLE_Log_Create() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info "$(hestiaI18N_Translate_Create "$___lang" "$1")\n" "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Create_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Create_Failed.sh.ps1 new file mode 100644 index 0000000..6a7b518 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Create_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Create-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Create-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Create_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Create_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Create_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Create_Simulate.sh.ps1 new file mode 100644 index 0000000..f7a9036 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Create_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Create-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Create-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Create_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Create_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Create_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Create_Skipped.sh.ps1 new file mode 100644 index 0000000..4d8eadf --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Create_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Create-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Create-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Create_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Create_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Merge.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Merge.sh.ps1 new file mode 100644 index 0000000..9cd3b9d --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Merge.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge.sh.ps1" + + + + +function hestiaCONSOLE-Log-Merge { + param ( + [string]$___destination, + [string]$___source, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Merge $___lang $___destination $___source)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge.sh.ps1" + + + + +hestiaCONSOLE_Log_Merge() { + #___destination="$1" + #___source="$2" + #___lang="$3" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Merge "$___lang" "$1" "$2")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Merge_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Merge_Failed.sh.ps1 new file mode 100644 index 0000000..0b275ec --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Merge_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Merge-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Merge-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Merge_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Merge_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Merge_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Merge_Simulate.sh.ps1 new file mode 100644 index 0000000..ee25541 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Merge_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Merge-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Merge-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Merge_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Merge_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Merge_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Merge_Skipped.sh.ps1 new file mode 100644 index 0000000..c50b276 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Merge_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Merge-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Merge-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Merge_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Merge_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Package.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Package.sh.ps1 new file mode 100644 index 0000000..33c3ffa --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Package.sh.ps1 @@ -0,0 +1,98 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package.sh.ps1" + + + + +function hestiaCONSOLE-Log-Package { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Package $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package.sh.ps1" + + + + +hestiaCONSOLE_Log_Package() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Package "$___lang" "$1")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Package_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Package_Failed.sh.ps1 new file mode 100644 index 0000000..09a9df2 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Package_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Package-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Package-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Package_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Package_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Package_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Package_Simulate.sh.ps1 new file mode 100644 index 0000000..94738d3 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Package_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Package-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Package-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Package_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Package_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Package_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Package_Skipped.sh.ps1 new file mode 100644 index 0000000..d625a81 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Package_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Package-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Package-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Package_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Package_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Publish.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Publish.sh.ps1 new file mode 100644 index 0000000..47b081e --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Publish.sh.ps1 @@ -0,0 +1,98 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish.sh.ps1" + + + + +function hestiaCONSOLE-Log-Publish { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Publish $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish.sh.ps1" + + + + +hestiaCONSOLE_Log_Publish() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Publish "$___lang" "$1")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Publish_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Publish_Failed.sh.ps1 new file mode 100644 index 0000000..9bbe116 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Publish_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Publish-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Publish-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Publish_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Publish_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Publish_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Publish_Simulate.sh.ps1 new file mode 100644 index 0000000..f938062 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Publish_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Publish-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Publish-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Publish_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Publish_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Publish_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Publish_Skipped.sh.ps1 new file mode 100644 index 0000000..f819d33 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Publish_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Publish-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Publish-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Publish_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Publish_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Recreate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Recreate.sh.ps1 new file mode 100644 index 0000000..524fcd2 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Recreate.sh.ps1 @@ -0,0 +1,98 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Recreate { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Recreate $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate.sh.ps1" + + + + +hestiaCONSOLE_Log_Recreate() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Recreate "$___lang" "$1")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Recreate_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Recreate_Failed.sh.ps1 new file mode 100644 index 0000000..1379e3e --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Recreate_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Recreate-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Recreate-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Recreate_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Recreate_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Recreate_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Recreate_Simulate.sh.ps1 new file mode 100644 index 0000000..69fea42 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Recreate_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Recreate-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Recreate-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Recreate_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Recreate_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1 new file mode 100644 index 0000000..d3aeb66 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Recreate-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Recreate-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Recreate_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Recreate_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Run.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Run.sh.ps1 new file mode 100644 index 0000000..d084c0d --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Run.sh.ps1 @@ -0,0 +1,98 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run.sh.ps1" + + + + +function hestiaCONSOLE-Log-Run { + param ( + [string]$___subject, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log info ` + "$(hestiaI18N-Translate-Run $___lang $___subject)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run.sh.ps1" + + + + +hestiaCONSOLE_Log_Run() { + #___subject="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log info \ + "$(hestiaI18N_Translate_Run "$___lang" "$1")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Run_Failed.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Run_Failed.sh.ps1 new file mode 100644 index 0000000..07a05d9 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Run_Failed.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Failed.sh.ps1" + + + + +function hestiaCONSOLE-Log-Run-Failed { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log error ` + "$(hestiaI18N-Translate-Run-Failed $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Failed.sh.ps1" + + + + +hestiaCONSOLE_Log_Run_Failed() { + #___appendix="$1" + #___lang="$2" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$2")" + hestiaCONSOLE_Log error \ + "$(hestiaI18N_Translate_Run_Failed "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Run_Simulate.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Run_Simulate.sh.ps1 new file mode 100644 index 0000000..6df07f9 --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Run_Simulate.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Simulate.sh.ps1" + + + + +function hestiaCONSOLE-Log-Run-Simulate { + param ( + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Run-Simulate $___lang)`n" ` + $___lang + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Simulate.sh.ps1" + + + + +hestiaCONSOLE_Log_Run_Simulate() { + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Run_Simulate "$___lang")\n" \ + "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Run_Skipped.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Run_Skipped.sh.ps1 new file mode 100644 index 0000000..b2db62b --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Run_Skipped.sh.ps1 @@ -0,0 +1,100 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Skipped.sh.ps1" + + + + +function hestiaCONSOLE-Log-Run-Skipped { + param ( + [string]$___appendix, + [string]$___lang + ) + + + # execute + $___lang = hestiaLOCALE-Get-Lang $___lang + $null = hestiaCONSOLE-Log warning ` + "$(hestiaI18N-Translate-Run-Skipped $___lang)`n" ` + $___lang ` + $___appendix + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Skipped.sh.ps1" + + + + +hestiaCONSOLE_Log_Run_Skipped() { + #___appendix="$1" + #___lang="$1" + + + # execute + ___lang="$(hestiaLOCALE_Get_Lang "$1")" + hestiaCONSOLE_Log warning \ + "$(hestiaI18N_Translate_Run_Skipped "$___lang")\n" \ + "$___lang" \ + "$1" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Log_Success.sh.ps1 b/automataCI/services/hestiaCONSOLE/Log_Success.sh.ps1 new file mode 100644 index 0000000..08207ae --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Log_Success.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Success.sh.ps1" + + + + +function hestiaCONSOLE-Log-Success { + param ( + [string]$___lang + ) + + + # execute + $null = hestiaCONSOLE-Log success "`n`n" "$(hestiaLOCALE-Get-Lang $___lang)" + + + # report status + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Success.sh.ps1" + + + + +hestiaCONSOLE_Log_Success() { + #___lang="$1" + + + # execute + hestiaCONSOLE_Log success "\n\n" "$(hestiaLOCALE_Get_Lang "$1")" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCONSOLE/Vanilla.sh.ps1 b/automataCI/services/hestiaCONSOLE/Vanilla.sh.ps1 new file mode 100644 index 0000000..40a033c --- /dev/null +++ b/automataCI/services/hestiaCONSOLE/Vanilla.sh.ps1 @@ -0,0 +1,122 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Assemble_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Assemble.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Assemble_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Assemble_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Check_Availability.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Check_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Check.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Check_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Check_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Create_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Create.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Create_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Create_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Merge_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Merge.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Merge_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Merge_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Package_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Package.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Package_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Package_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Publish_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Publish.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Publish_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Publish_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Recreate_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Recreate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Recreate_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Recreate_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Run_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Run.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Run_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Run_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCONSOLE\Log_Success.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCONSOLE/Log.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Assemble_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Assemble.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Assemble_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Assemble_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Check_Availability.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Check_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Check.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Check_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Check_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Create_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Create.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Create_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Create_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Merge_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Merge.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Merge_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Merge_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Package_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Package.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Package_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Package_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Publish_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Publish.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Publish_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Publish_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Recreate_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Recreate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Recreate_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Recreate_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Run_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Run.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Run_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Run_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaCONSOLE/Log_Success.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_Binary.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_Binary.sh.ps1 new file mode 100644 index 0000000..ece2f4e --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_Binary.sh.ps1 @@ -0,0 +1,79 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Data.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-Binary { + param ( + [long]$___length + ) + + + # execute + return hestiaCRYPTO-Create-Random-Data $___length "01" +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Data.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_Binary() { + #___length="$1" + + + # validate input + printf -- "%s" "$(hestiaCRYPTO_Create_Random_Data "$1" '0-1')" + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_Data.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_Data.sh.ps1 new file mode 100644 index 0000000..cff0d8f --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_Data.sh.ps1 @@ -0,0 +1,165 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-Data { + param ( + [long]$___length, + [string]$___charset + ) + + + # validate input + if ($___length -le 0) { + $___length = 33 + } + + if ($(hestiaSTRING-Is-Empty $___charset) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___outcome = [char[]]@(0) * $___length + $___bytes = [byte[]]@(0) * $___length + $___crypter = [System.Security.Cryptography.RandomNumberGenerator]::Create() + $null = $___crypter.GetBytes($___bytes) + $null = $___crypter.Dispose() + + for ($___i = 0; $___i -lt $___length; $___i++) { + $___index = [int] ($___bytes[$___i] % $___charset.Length) + $___outcome[$___i] = [char] $___charset[$___index] + } + + + # report status + return $___outcome -join ""; +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_Data() { + #___length="$1" + #___charset="$2" + + + # validate input + if [ -n "$1" -a $1 -eq $1 2> /dev/null -a $1 -gt 0 ]; then + ___length=$1 + else + ___length=33 + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaOS_Is_Command_Available "dd") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaOS_Is_Command_Available "tr") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaFS_Is_Exist "/dev/urandom") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + + # execute + ___output="" + ___count=0 + + # NOTE: + # (1) MacOS's 'tr' won't break itself when reading directly from + # /dev/urandom source. + # (2) Using 'dd' directly against /dev/urandom cannot warrant the + # output length we wanted. + # (3) So, we do not have a choice but to perform loop capturing until + # we get exactly what we wanted. + # (4) If you have better idea without compromising crypto-randomness + # while improving the performance, please inform the maintainers. + # (5) For now, this is what we have. Blame note (1) for behaving + # weirdly especially coming from an organ-selling priced hardware. + while [ $___count -ne $___length ]; do + ___char="$(dd bs=1 if=/dev/urandom count=1 2> /dev/null \ + | LC_ALL=C tr -dc "$2" 2> /dev/null)" + if [ -z "$___char" ]; then + continue + fi + + ___output="${___output}${___char}" + + # increase counter for successful capture + ___count=$(($___count + ${#___char})) + done + + + # report status + printf -- "%s" "$___output" + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_Decimal.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_Decimal.sh.ps1 new file mode 100644 index 0000000..b507dfa --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_Decimal.sh.ps1 @@ -0,0 +1,79 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Data.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-Decimal { + param ( + [long]$___length + ) + + + # execute + return hestiaCRYPTO-Create-Random-Data $___length "0123456789" +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Data.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_Decimal() { + #___length="$1" + + + # validate input + printf -- "%s" "$(hestiaCRYPTO_Create_Random_Data "$1" '0-9')" + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_Hex.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_Hex.sh.ps1 new file mode 100644 index 0000000..f20a7db --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_Hex.sh.ps1 @@ -0,0 +1,79 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Data.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-Hex { + param ( + [long]$___length + ) + + + # execute + return hestiaCRYPTO-Create-Random-Data $___length "0123456789ABCDEF" +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Data.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_Hex() { + #___length="$1" + + + # validate input + printf -- "%s" "$(hestiaCRYPTO_Create_Random_Data "$1" 'A-F0-9')" + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_String.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_String.sh.ps1 new file mode 100644 index 0000000..4744292 --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_String.sh.ps1 @@ -0,0 +1,91 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Data.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-String { + param ( + [long]$___length, + [string]$___charset + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___charset) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + $___charset += "abcdefghijklmnopqrstuvwxyz" + $___charset += "0123456789" + } + + + # execute + return hestiaCRYPTO-Create-Random-Data $___length $___charset +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Data.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_String() { + #___length="$1" + #___charset="$2" + + + # validate input + printf -- "%s" "$(hestiaCRYPTO_Create_Random_Data "$1" "${2:-a-zA-Z0-9}")" + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Create_Random_UUID.sh.ps1 b/automataCI/services/hestiaCRYPTO/Create_Random_UUID.sh.ps1 new file mode 100644 index 0000000..f345dc9 --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Create_Random_UUID.sh.ps1 @@ -0,0 +1,169 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Binary.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Hex.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Now.sh.ps1" + + + + +function hestiaCRYPTO-Create-Random-UUID { + # execute + $___length_data = 24 + $___length_epoch = 8 + + $___data = "$(hestiaCRYPTO-Create-Random-Hex $___length_data)" + $___epoch = '{0:X}' -f ([int] $(hestiaTIME-Now)) + + $___output = "" + $___length_data -= 1 + $___length_epoch -= 1 + for ($___count = 0; $___count -lt 32; $___count++) { + switch ($___count) { + { $_ -in 8, 12, 16, 20 } { + # add uuid dashes by the correct index + $___output += "-" + } default { + # do nothing + }} + + if (($(hestiaCRYPTO-Create-Random-Binary 1) -eq "1") -and ($___length_epoch -ge 0)) { + # gamble and add 1 character from epoch if won + $___output += $___epoch.Substring(0,1) + $___epoch = $___epoch.Substring(1) + $___length_epoch -= 1 + } elseif ($___length_data -ge 0) { + # add random character otherwise + $___output += $___data.Substring(0,1) + $___data = $___data.Substring(1) + $___length_data -= 1 + } elseif ($___length_epoch -ge 0) { + # only epoch left + $___output += $___epoch.Substring(0,1) + $___epoch = $___epoch.Substring(1) + $___length_epoch -= 1 + } else { + # impossible error edge cases - return nothing and fail + # is better than faulty. + return "" + } + } + + + # report status + return $___output +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Binary.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Hex.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Now.sh.ps1" + + + + +hestiaCRYPTO_Create_Random_UUID() { + # execute + ___length_data=24 + ___length_epoch=8 + + ___data="$(hestiaCRYPTO_Create_Random_Hex "$___length_data")" + ___epoch="$(printf -- "%X" "$(hestiaTIME_Now)")" + + ___output="" + ___length_epoch=$(($___length_epoch - 1)) + ___length_data=$(($___length_data - 1)) + ___count=0 + while [ $___count -lt 32 ]; do + case "$___count" in + 8|12|16|20) + # add uuid dashes by the correct index + ___output="${___output}-" + ;; + *) + ;; + esac + + if [ "$(hestiaCRYPTO_Create_Random_Binary 1)" = "1" ] && [ $___length_epoch -ge 0 ]; then + # gamble and add 1 character from epoch if won + ___remainder="${___epoch#?}" + ___output="${___output}${___epoch%"$___remainder"}" + ___epoch="$___remainder" + ___length_epoch=$(($___length_epoch - 1)) + elif [ $___length_data -ge 0 ]; then + # add random character otherwise + ___remainder="${___data#?}" + ___output="${___output}${___data%"$___remainder"}" + ___data="$___remainder" + ___length_data=$(($___length_data - 1)) + elif [ $___length_epoch -ge 0 ]; then + # only epoch left + ___remainder="${___epoch#?}" + ___output="${___output}${___epoch%"$___remainder"}" + ___epoch="$___remainder" + ___length_epoch=$(($___length_epoch - 1)) + else + # impossible error edge cases - return nothing and fail + # is better than faulty. + printf -- "" + return 1 + fi + + + # increase counter since POSIX does not have C like for loop. + ___count=$(($___count + 1)) + done + + + # report status + printf -- "%s" "$___output" + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaCRYPTO/Vanilla.sh.ps1 b/automataCI/services/hestiaCRYPTO/Vanilla.sh.ps1 new file mode 100644 index 0000000..60066da --- /dev/null +++ b/automataCI/services/hestiaCRYPTO/Vanilla.sh.ps1 @@ -0,0 +1,64 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Binary.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Data.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Decimal.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_Hex.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_String.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_UUID.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Binary.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Data.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Decimal.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_Hex.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_String.sh.ps1" +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_UUID.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Append_Byte_File.sh.ps1 b/automataCI/services/hestiaFS/Append_Byte_File.sh.ps1 new file mode 100644 index 0000000..6ab5cca --- /dev/null +++ b/automataCI/services/hestiaFS/Append_Byte_File.sh.ps1 @@ -0,0 +1,146 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Append-Byte_File { + param ( + [string]$___target, + [byte[]]$___content + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($___content.Count -le 0) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___target)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + if ( + ($(hestiaFS-Is-Exist $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaFS-Is-File $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} + } + + + # execute + foreach ($___byte in $___content) { + $null = Add-Content -AsByteStream -NoNewline -Path $___target -Value $___byte + if (-not $?) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Append_Byte_File() { + #___target="$1" + #___content="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$1")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE + fi + + + # execute + printf -- "%b" "$2" >> "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Append_File.sh.ps1 b/automataCI/services/hestiaFS/Append_File.sh.ps1 new file mode 100644 index 0000000..98029cb --- /dev/null +++ b/automataCI/services/hestiaFS/Append_File.sh.ps1 @@ -0,0 +1,104 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Append_Byte_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Append_Text_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Append-File { + param ( + [string]$___target, + [string]$___string_content, + [byte[]]$___byte_content + ) + + + # execute + if ($(hestiaSTRING-Is-Empty $___string_content) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # write as byte data type + return hestiaFS-Append-Byte-File $___target $___byte_content + } else { + # default to text data type + return hestiaFS-Append-Text-File $___target $___string_content + } +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Append_Byte_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Append_Text_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Append_File() { + #___target="$1" + #___string_content="$2" + #___bytes_content="$3" + + + # execute + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + # write as byte data type + hestiaFS_Append_Byte_File "$1" "$2" + else + # default to text data type + hestiaFS_Append_Text_File "$1" "$2" + fi + + + # report status + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Append_Text_File.sh.ps1 b/automataCI/services/hestiaFS/Append_Text_File.sh.ps1 new file mode 100644 index 0000000..2acf09c --- /dev/null +++ b/automataCI/services/hestiaFS/Append_Text_File.sh.ps1 @@ -0,0 +1,144 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Append-Text-File { + param ( + [string]$___target, + [string]$___content + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___content) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___target)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + if ( + ($(hestiaFS-Is-Exist $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaFS-Is-File $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} + } + + + # execute + $null = Add-Content -NoNewline -Path $___target -Value $___content + if ($?) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Append_Text_File() { + #___target="$1" + #___content="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$1")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE + fi + + + # execute + printf -- "%b" "$2" >> "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Copy.sh.ps1 b/automataCI/services/hestiaFS/Copy.sh.ps1 new file mode 100644 index 0000000..aeb6357 --- /dev/null +++ b/automataCI/services/hestiaFS/Copy.sh.ps1 @@ -0,0 +1,149 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Copy { + param ( + [string]$___destination, + [string]$___source, + [string]$___resolve_link + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if ($(hestiaFS-Is-Socket $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return hestiaFS-Copy-Socket $___destination $___source + } elseif ($(hestiaFS-Is-Symbolic-Link $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaSTRING-Is-Empty $___resolve_link) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return hestiaFS-Copy-File $___destination $___source + } + + return hestiaFS-Copy-Symbolic-Link $___destination $___source + } elseif ($(hestiaFS-Is-Directory $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return hestiaFS-Copy-Directory $___destination $___source + } elseif ($(hestiaFS-Is-File $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return hestiaFS-Copy-File $___destination $___source + } + + + # report status + return ${env:hestiaKERNEL_ERROR_UNSUPPORTED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Copy() { + #___destination="$1" + #___source="$2" + #___resolve_link="$3" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ $(hestiaFS_Is_Socket "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Copy_Socket "$1" "$2" + return $? + elif [ $(hestiaFS_Is_Symbolic_Link "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Copy_File "$1" "$2" + return $? + fi + + hestiaFS_Copy_Symbolic_Link "$1" "$2" + return $? + elif [ $(hestiaFS_Is_Directory "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Copy_Directory "$1" "$2" + return $? + elif [ $(hestiaFS_Is_File "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Copy_File "$1" "$2" + return $? + fi + + + # report status + return $hestiaKERNEL_ERROR_UNSUPPORTED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Copy_Directory.sh.ps1 b/automataCI/services/hestiaFS/Copy_Directory.sh.ps1 new file mode 100644 index 0000000..4d908c2 --- /dev/null +++ b/automataCI/services/hestiaFS/Copy_Directory.sh.ps1 @@ -0,0 +1,138 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Create_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Copy-Directory { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + + # execute + $null = hestiaFS-Create-Directory $___destination + $null = Copy-Item -Path "${___source}\*" -Destination "${___destination}\." -Recurse + if ($?) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Copy_Directory() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + + # execute + cp -r "${2}/"* "${1}/." + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Copy_File.sh.ps1 b/automataCI/services/hestiaFS/Copy_File.sh.ps1 new file mode 100644 index 0000000..f71dbbf --- /dev/null +++ b/automataCI/services/hestiaFS/Copy_File.sh.ps1 @@ -0,0 +1,148 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Copy-File { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___destination)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + + # execute + $null = Copy-Item -Path $___source -Destination $___destination + if ($?) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Copy_File() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_FILE + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$2")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + + # execute + cp -L "$2" "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Copy_Socket.sh.ps1 b/automataCI/services/hestiaFS/Copy_Socket.sh.ps1 new file mode 100644 index 0000000..cc5f7f5 --- /dev/null +++ b/automataCI/services/hestiaFS/Copy_Socket.sh.ps1 @@ -0,0 +1,139 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Copy-Socket { + param ( + [string]$___destination_directory, + [string]$___source + ) + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Socket $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_SOCKET} + } + + if ($(hestiaFS-Is-Directory $___destination_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_UNSUPPORTED} # windows does not have socket file +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Copy_Socket() { + #___destination_directory="$1" + #___source="$2" + + + # validate input + if [ $(hestiaOS_Is_Command_Available "tar") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Socket "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_SOCKET + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + + # execute + ___current_directory="$PWD" && cd "$(hestiaFS_Get_Directory "$2")" + tar -cpf- "$(hestiaFS_Get_File "$2")" | tar -xf- -C "$1" + ___process=$? + cd "$___current_directory" && unset ___current_directory + if [ $___process -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Copy_Symbolic_Link.sh.ps1 b/automataCI/services/hestiaFS/Copy_Symbolic_Link.sh.ps1 new file mode 100644 index 0000000..732431c --- /dev/null +++ b/automataCI/services/hestiaFS/Copy_Symbolic_Link.sh.ps1 @@ -0,0 +1,167 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Copy-Symbolic-Link { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Symbolic-Link $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_LINK} + } + + if ($(hestiaFS-Is-Exist $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_DEAD} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___destination)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + + # execute + $___origin = (Get-Item $___source).Target + $___type = $null + if ($(hestiaFS-Is-Directory $___origin) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___type = "Junction" + } elseif ($(hestiaFS-Is-File $___origin) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___type = "HardLink" + } else { + return ${env:hestiaKERNEL_ERROR_DATA_BAD} + } + + $null = New-Item -ItemType $___type -Value $___origin -Path $___destination + if ($?) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Copy_Symbolic_Link() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Symbolic_Link "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_LINK + fi + + if [ $(hestiaFS_Is_Exist "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_DEAD + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$2")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + + # execute + cp -a "$2" "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Create_Directory.sh.ps1 b/automataCI/services/hestiaFS/Create_Directory.sh.ps1 new file mode 100644 index 0000000..07b9247 --- /dev/null +++ b/automataCI/services/hestiaFS/Create_Directory.sh.ps1 @@ -0,0 +1,137 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Create-Directory { + param ( + [string]$___filepath + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ( + ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaFS-Is-Socket $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaFS-Is-Symbolic-Link $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-Directory $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + + # execute + $___process = New-Item -ItemType Directory -Force -Path "${___filepath}" + if ($___process) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Create_Directory() { + #___filepath="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaFS_Is_Socket "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaFS_Is_Symbolic_Link "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_Directory "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + mkdir -p "$1" + if [ $? -ne 0 ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Get_Directory.sh.ps1 b/automataCI/services/hestiaFS/Get_Directory.sh.ps1 new file mode 100644 index 0000000..954b5e8 --- /dev/null +++ b/automataCI/services/hestiaFS/Get_Directory.sh.ps1 @@ -0,0 +1,97 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Get-Directory { + param ( + [string]$___filepath + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + return (Split-Path -Parent -Path $___filepath) +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Get_Directory() { + #___filepath="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + printf -- "%b" "${1%/*}" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Get_File.sh.ps1 b/automataCI/services/hestiaFS/Get_File.sh.ps1 new file mode 100644 index 0000000..2885143 --- /dev/null +++ b/automataCI/services/hestiaFS/Get_File.sh.ps1 @@ -0,0 +1,97 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Get-File { + param ( + [string]$___filepath + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + return (Split-Path -Leaf -Path $___filepath) +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Get_File() { + #___filepath="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + printf -- "%b" "${1##*/}" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Get_Relative_Path.sh.ps1 b/automataCI/services/hestiaFS/Get_Relative_Path.sh.ps1 new file mode 100644 index 0000000..7555d00 --- /dev/null +++ b/automataCI/services/hestiaFS/Get_Relative_Path.sh.ps1 @@ -0,0 +1,110 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Get-Relative-Path { + param ( + [string]$___source, + [string]$___base + ) + + + # validate input + if ( + ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___base) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return "" + } + + + # execute + $___output = Resolve-Path -Relative -Path $___target -RelativeBasePath $___base + if ($___output.StartsWith(".\")) { + $___output = $___output.Substring(2) + } + + + # report status + return $___output +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Get_Relative_Path() { + #___source="$1" + #___base="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + printf -- "%b" "${1#*${2}/}" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Get_Size.sh.ps1 b/automataCI/services/hestiaFS/Get_Size.sh.ps1 new file mode 100644 index 0000000..6447dfe --- /dev/null +++ b/automataCI/services/hestiaFS/Get_Size.sh.ps1 @@ -0,0 +1,245 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\To_Lowercase.sh.ps1" + + + + +function hestiaFS-Get-Size { + param ( + [string]$___target, + [string]$___quantification, + [string]$___follow_link + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + if ($(hestiaFS-Is-Exist $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + switch ($(hestiaSTRING-To-Lowercase $___quantification)) { + { $_ -in "k", "kb" } { + # 1024 (kilobytes) + $___size = 1024 + } { $_ -in "m", "mb" } { + # 1000*1024 (megabytes) + $___size = 1048576 + } { $_ -in "g", "gb" } { + # 1000*1000*1024 (gigabytes) + $___size = 1073741824 + } { $_ -in "t", "tb" } { + # 1000*1000*1000*1024 (terabytes) + $___size = 1099511627776 + } { $_ -in "p", "pb" } { + # 1000*1000*1000*1000*1024 (petabytes) + $___size = 1125899906842624 + } { $_ -in "e", "eb" } { + # 1000*1000*1000*1000*1000*1024 (exabytes) + $___size = 1152921504606846976 + } { $_ -in "z", "zb" } { + # 1000*1000*1000*1000*1000*1000*1024 (zettabytes) + $___size = 1180591620717411303424 + } { $_ -in "y", "yb" } { + # 1000*1000*1000*1000*1000*1000*1000*1024 (yottabytes) + $___size = 1208925819614629174706176 + } default { + # 1 (byte) + $___size = 1 + }} + + if ($(hestiaSTRING-Is-Empty $___follow_link) -ne ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaFS-Is-Directory $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___value = Get-ChildItem -ErrorAction SilentlyContinue ` + -Recurse ` + -Force ` + -Include * ` + -FollowSymlink ` + -Path $___target + | Where-Object { $_.psiscontainer -eq $false } ` + | Measure-Object -Property length -sum ` + | Select-Object sum + } else { + $___value = Get-ChildItem -ErrorAction SilentlyContinue ` + -FollowSymlink ` + -Path $___target + | Measure-Object -Property length -sum ` + | Select-Object sum + } + } else { + if ($(hestiaFS-Is-Directory $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___value = Get-ChildItem -ErrorAction SilentlyContinue ` + -Recurse ` + -Force ` + -Include * ` + -Path $___target + | Where-Object { $_.psiscontainer -eq $false } ` + | Measure-Object -Property length -sum ` + | Select-Object sum + } else { + $___value = Get-ChildItem -ErrorAction SilentlyContinue -Path $___target + | Measure-Object -Property length -sum ` + | Select-Object sum + } + } + + return [math]::Round($___value.sum / $___size, 0) +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/To_Lowercase.sh.ps1" + + + + +hestiaFS_Get_Size() { + #___target="$1" + #___quantification="$2" + #___follow_link="$3" + + + # validate input + if [ $(hestiaOS_Is_Command_Available "du") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + ___link="--no-dereference" + if [ $(hestiaSTRING_Is_Empty "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + ___link="--dereference" + fi + + if [ $(hestiaFS_Is_Exist "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + case "$(hestiaSTRING_To_Lowercase "$2")" in + k|kib) + # 1024 (kilobytes) + ___size=1024 + ;; + m|mib) + # 1000*1024 (megabytes) + ___size=1048576 + ;; + g|gib) + # 1000*1000*1024 (gigabytes) + ___size=1073741824 + ;; + t|tib) + # 1000*1000*1000*1024 (terabytes) + ___size=1099511627776 + ;; + p|pib) + # 1000*1000*1000*1000*1024 (petabytes) + ___size=1125899906842624 + ;; + e|eib) + # 1000*1000*1000*1000*1000*1024 (exabytes) + ___size=1152921504606846976 + ;; + z|zib) + # 1000*1000*1000*1000*1000*1000*1024 (zettabytes) + ___size=1180591620717411303424 + ;; + y|yib) + # 1000*1000*1000*1000*1000*1000*1000*1024 (yottabytes) + ___size=1208925819614629174706176 + ;; + *) + # 1 (byte) + ___size=1 + ;; + esac + + ___size="$(du ${___link} --summarize --block-size="$___size" "$1")" + ___output="" + while [ -n "$___size" ]; do + ___char="$(printf -- "%.1b" "$___size")" + case "$___char" in + 0|1|2|3|4|5|6|7|8|9) + ___output="${___output}${___char}" + ;; + *) + break + ;; + esac + + ___size="${___size#*$___char}" + done + printf -- "%d" "$___output" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Directory.sh.ps1 b/automataCI/services/hestiaFS/Is_Directory.sh.ps1 new file mode 100644 index 0000000..badaa5c --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Directory.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-Directory { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if (Test-Path -PathType Container -Path $___target -ErrorAction SilentlyContinue) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_DATA_BAD} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Directory() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ -d "$1" ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_BAD" + return $hestiaKERNEL_ERROR_DATA_BAD +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Directory_Empty.sh.ps1 b/automataCI/services/hestiaFS/Is_Directory_Empty.sh.ps1 new file mode 100644 index 0000000..44758e1 --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Directory_Empty.sh.ps1 @@ -0,0 +1,124 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-Directory-Empty { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + + # execute + if ( + (Get-ChildItem $___target -force ` + | Select-Object -First 1 ` + | Measure-Object).Count -ne 0 + ) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Directory_Empty() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY" + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + for ___item in "$1"/*; do + if [ -e "$___item" ]; then + printf -- "$hestiaKERNEL_ERROR_BAD_EXEC" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done + + + # execute + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Exist.sh.ps1 b/automataCI/services/hestiaFS/Is_Exist.sh.ps1 new file mode 100644 index 0000000..54a8c19 --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Exist.sh.ps1 @@ -0,0 +1,160 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-Exist { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if ($(hestiaFS-Is-Directory $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaFS-Is-File $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaFS-Is-Socket $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaFS-Is-Symbolic-Link $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + if (Test-Path -Path "$((Get-Item $___target).Target)") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + return ${env:hestiaKERNEL_ERROR_DATA_DEAD} + } + + if (Test-Path -PathType Any -Path $___target) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_BAD} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Exist() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ $(hestiaFS_Is_Directory "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaFS_Is_Socket "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaFS_Is_Symbolic_Link "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + if [ -e "$1" ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + printf -- "$hestiaKERNEL_ERROR_DATA_DEAD" + return $hestiaKERNEL_ERROR_DATA_DEAD + fi + + if [ -e "$1" ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "$hestiaKERNEL_ERROR_DATA_BAD" + return $hestiaKERNEL_ERROR_DATA_BAD +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_File.sh.ps1 b/automataCI/services/hestiaFS/Is_File.sh.ps1 new file mode 100644 index 0000000..a09dfa5 --- /dev/null +++ b/automataCI/services/hestiaFS/Is_File.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-File { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if (Test-Path -PathType leaf -Path $___target -ErrorAction SilentlyContinue) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_BAD} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_File() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ -f "$1" ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_BAD" + return $hestiaKERNEL_ERROR_DATA_BAD +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Filename_Has.sh.ps1 b/automataCI/services/hestiaFS/Is_Filename_Has.sh.ps1 new file mode 100644 index 0000000..c00bc05 --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Filename_Has.sh.ps1 @@ -0,0 +1,118 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-Filename-Has { + param ( + [string]$___filepath, + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___filepath}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if ($("${___filepath}" -replace ".*${___target}", '') -ne "${___filepath}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_DATA_BAD} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Filename_Has() { + #___filepath="$1" + #___target="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_ENTITY_EMPTY + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ ! "${1#*${2}}" = "$1" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + printf -- "%d" $hestiaKERNEL_ERROR_DATA_BAD + return $hestiaKERNEL_ERROR_DATA_BAD +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Socket.sh.ps1 b/automataCI/services/hestiaFS/Is_Socket.sh.ps1 new file mode 100644 index 0000000..0a7c5de --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Socket.sh.ps1 @@ -0,0 +1,94 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" + + + + +function hestiaFS-Is-Socket { + param ( + [string]$___target + ) + + + # execute + return ${env:hestiaKERNEL_ERROR_UNSUPPORTED} # windows does not have socket file +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Socket() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ -S "$1" ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_BAD" + return $hestiaKERNEL_ERROR_DATA_BAD +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Is_Symbolic_Link.sh.ps1 b/automataCI/services/hestiaFS/Is_Symbolic_Link.sh.ps1 new file mode 100644 index 0000000..f9474d0 --- /dev/null +++ b/automataCI/services/hestiaFS/Is_Symbolic_Link.sh.ps1 @@ -0,0 +1,124 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Is-Symbolic-Link { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if (-not (Test-Path -PathType Any -Path $___target -ErrorAction SilentlyContinue)) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + try { + $___link = (Get-Item $___target).LinkType + if ( + ($___link -eq "HardLink") -or + ($___link -eq "SymbolicLink") + ) { + return ${env:hestiaKERNEL_ERROR_OK} + } + } catch { + # something bad happened during the Get-Item + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_LINK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Is_Symbolic_Link() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ ! -e "$1" ]; then + printf -- "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ -L "$1" ]; then + printf -- "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "$hestiaKERNEL_ERROR_DATA_IS_NOT_LINK" + return $hestiaKERNEL_ERROR_DATA_IS_NOT_LINK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/List.sh.ps1 b/automataCI/services/hestiaFS/List.sh.ps1 new file mode 100644 index 0000000..c105e5f --- /dev/null +++ b/automataCI/services/hestiaFS/List.sh.ps1 @@ -0,0 +1,168 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-List { + param ( + [string]$___source, + [string]$___recursive_scan, + [string]$___resolve_symlink + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + if ($(hestiaFS-Is-Directory $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___scanned = $null + if ($(hestiaFS-Is-Directory $___resolve_symlink) -ne ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaFS-Is-Directory $___recursive_scan) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___scanned = Get-ChildItem -File -Recurse -FollowSymlink -Path $___source + } else { + $___scanned = Get-ChildItem -File -FollowSymlink -Path $___source + } + } else { + if ($(hestiaFS-Is-Directory $___recursive_scan) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___scanned = Get-ChildItem -File -Recurse -Path $___source + } else { + $___scanned = Get-ChildItem -File -Path $___source + } + } + + $___list = "" + foreach ($___file in $___scanned) { + $___list = "${___list}${___file}`n" + } + + + # report status + return $___list +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_List() { + #___source="$1" + #___recursive_scan="$2" + #___resolve_symlink="$3" + + + # validate input + if [ $(hestiaOS_Is_Command_Available "find") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + + # execute + ___scanned="" + if [ $(hestiaSTRING_Is_Empty "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + ___scanned="$(find -L "$2" -type f 2>/dev/null)" + else + ___scanned="$(find -L "$2" -maxdepth 1 -type f 2>/dev/null)" + fi + else + if [ $(hestiaSTRING_Is_Empty "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + ___scanned="$(find "$2" -type f 2>/dev/null)" + else + ___scanned="$(find "$2" -maxdepth 1 -type f 2>/dev/null)" + fi + fi + + ___output="" + ___old_IFS="$IFS" + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + ___output="${___output}${___file}\n" + done < diff --git a/automataCI/services/hestiaFS/Merge_Directories.sh.ps1 b/automataCI/services/hestiaFS/Merge_Directories.sh.ps1 new file mode 100644 index 0000000..7191e2f --- /dev/null +++ b/automataCI/services/hestiaFS/Merge_Directories.sh.ps1 @@ -0,0 +1,179 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Copy.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Remove.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Merge-Directories { + param ( + [string]$___destination, + [string]$___source, + [string]$___override_existing, + [string]$___resolve_symlink + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___destination) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-Directory $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + + # execute + foreach ($___src in (Get-ChildItem -File -Recurse -Path $___source)) { + $___dest = $___src -replace [regex]::Escape("${___source}\"), '' + $___dest = "${___destination}\${___dest}" + + if ($(hestiaFS-Is-File $___dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaSTRING-Is-Empty $___override_existing) -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___process = hestiaFS-Remove $___dest + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + $___process = hestiaFS-Copy $___dest $___src $___resolve_symlink + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Copy.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Remove.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Merge_Directories() { + #___destination="$1" + #___source="$2" + #___override_existing="$3" + #___resolve_symlink="$4" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + ___old_IFS="$IFS" + while IFS= read -r ___src || [ -n "$___src" ]; do + ___dest="${1}/${___src##*${2}/}" + + if [ $(hestiaFS_Is_File "$___dest") -eq $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Remove "$___dest" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + hestiaFS_Copy "$___dest" "$___src" "$4" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done </dev/null) +EOF + IFS="$___old_IFS" && unset ___old_IFS + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Move.sh.ps1 b/automataCI/services/hestiaFS/Move.sh.ps1 new file mode 100644 index 0000000..1135b6f --- /dev/null +++ b/automataCI/services/hestiaFS/Move.sh.ps1 @@ -0,0 +1,144 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Move { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + + # execute + try { + Move-Item -Force -Path $___source -Destination $___destination + if ($?) { + $___process = ${env:hestiaKERNEL_ERROR_OK} + } else { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } catch { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Move() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + + # execute + mv "$2" "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Recreate_Directory.sh.ps1 b/automataCI/services/hestiaFS/Recreate_Directory.sh.ps1 new file mode 100644 index 0000000..af30906 --- /dev/null +++ b/automataCI/services/hestiaFS/Recreate_Directory.sh.ps1 @@ -0,0 +1,122 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Create_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Remove.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Recreate-Directory { + param ( + [string]$___filepath + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + } + + + # execute + $null = hestiaFS-Remove $___filepath + $___process = hestiaFS-Create-Directory $___filepath + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Create_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Remove.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Recreate_Directory() { + #___filepath="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + + # execute + hestiaFS_Remove "$1" + hestiaFS_Create_Directory "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Remove.sh.ps1 b/automataCI/services/hestiaFS/Remove.sh.ps1 new file mode 100644 index 0000000..ebe206d --- /dev/null +++ b/automataCI/services/hestiaFS/Remove.sh.ps1 @@ -0,0 +1,126 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" + + + + +function hestiaFS-Remove { + param ( + [string]$___filepath + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_DEAD} + } + + + # execute + try { + $___process = Remove-Item -Recurse -Force -Path $___filepath + if ($___process -eq $null) { + $___process = ${env:hestiaKERNEL_ERROR_OK} + } else { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } catch { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # execute + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" + + + + +hestiaFS_Remove() { + #___filepath="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_DEAD + fi + + + # execute + rm -rf "$1" &> /dev/null + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # execute + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Replace_Extension.sh.ps1 b/automataCI/services/hestiaFS/Replace_Extension.sh.ps1 new file mode 100644 index 0000000..0e98522 --- /dev/null +++ b/automataCI/services/hestiaFS/Replace_Extension.sh.ps1 @@ -0,0 +1,190 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Replace-Extension { + param ( + [string]$___path, + [string]$___extension, + [string]$___candidate + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___target = hestiaFS-Get-File $___path + $___directory = hestiaFS-Get-Directory $___path + if ($___extension -eq "*") { + ## trim all extensions to the first period + $___target = $___target -replace '(\.\w+)+$', '' + + ## restore directory pathing when available + if ( + ($(hestiaSTRING-Is-Empty $___directory) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($___directory -ne $___path) + ) { + $___target = "${___directory}\${___target}" + } + } elseif ($(hestiaSTRING-Is-Empty $___extension) -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## trim off existing extension + if ($___extension.Substring(0,1) -eq ".") { + $___extension = $___extension.Substring(1) + } + $___extension = [regex]::Escape($___extension) + $___target = $___target -replace "\.${___extension}$", '' + + ## append new extension when available + if ( + ($___target -ne (hestiaFS-Get-File $___path)) -and + ($(hestiaSTRING-Is-Empty $___candidate) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + if ($___candidate.Substring(0,1) -eq ".") { + $___target += "." + $___candidate.Substring(1) + } else { + $___target += "." + $___candidate + } + } + + ## restore directory pathing when available + if ( + ($(hestiaSTRING-Is-Empty $___directory) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($___directory -ne $___path) + ) { + $___target = "${___directory}\${___target}" + } + } else { + ## do nothing + $___target = $___path + } + + + # report status + return $___target +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Replace_Extension() { + #___target="$1" + #___extension="$2" + #___candidate="$3" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_DATA_EMPTY" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + ___directory="$(hestiaFS_Get_Directory "$1")" + if [ "$2" = "*" ]; then + ## trim all extensions to the first period + ___target="${___target%%.*}" + + ## restore directory pathing when available + if [ $(hestiaSTRING_Is_Empty "$___directory") -ne $hestiaKERNEL_ERROR_OK ] && + [ ! "$___directory" = "$1" ]; then + ___target="${___directory}/${___target}" + fi + elif [ $(hestiaSTRING_Is_Empty "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + ## trim off existing extension + ___extension="$2" + if [ "$(printf -- "%.1s" "$2")" = "." ]; then + ___extension="${2#*.}" + fi + ___target="${___target%.${___extension}*}" + + ## append new extension when available + if [ ! "$(hestiaFS_Get_File "$1")" = "$___target" ] && + [ $(hestiaSTRING_Is_Empty "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + if [ "$(printf -- "%.1s" "$3")" = "." ]; then + ___target="${___target}.${3#*.}" + else + ___target="${___target}.${3}" + fi + fi + + ## restore directory pathing when available + if [ $(hestiaSTRING_Is_Empty "$___directory") -ne $hestiaKERNEL_ERROR_OK ] && + [ ! "$___directory" = "$1" ]; then + ___target="${___directory}/${___target}" + fi + else + ## do nothing + ___target="$1" + fi + + + # report status + printf -- "%s" "$___target" + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Vanilla.sh.ps1 b/automataCI/services/hestiaFS/Vanilla.sh.ps1 new file mode 100644 index 0000000..fcf9e9e --- /dev/null +++ b/automataCI/services/hestiaFS/Vanilla.sh.ps1 @@ -0,0 +1,108 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Append_Byte_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Append_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Append_Text_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Copy_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Create_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Relative_Path.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Filename_Has.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Socket.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Symbolic_Link.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\List.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Merge_Directories.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Move.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Recreate_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Remove.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Replace_Extension.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Write_Byte_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Write_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Write_Text_File.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Append_Text_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Append_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Append_Byte_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Copy_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Create_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Relative_Path.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Filename_Has.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Socket.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Symbolic_Link.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/List.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Merge_Directories.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Move.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Recreate_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Remove.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Replace_Extension.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Write_Byte_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Write_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Write_Text_File.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Write_Byte_File.sh.ps1 b/automataCI/services/hestiaFS/Write_Byte_File.sh.ps1 new file mode 100644 index 0000000..7deb028 --- /dev/null +++ b/automataCI/services/hestiaFS/Write_Byte_File.sh.ps1 @@ -0,0 +1,140 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Write-Byte-File { + param ( + [string]$___target, + [byte[]]$___content + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($___content.Count -le 0) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___target)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + if ($(hestiaFS-Is-Exist $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + + # execute + foreach ($___byte in $___content) { + $null = Set-Content -AsByteStream -NoNewline -Path $___target -Value $___byte + if (-not $?) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Write_Byte_File() { + #___target="$1" + #___content="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$1")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + + # execute + printf -- "%b" "$2" > "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Write_File.sh.ps1 b/automataCI/services/hestiaFS/Write_File.sh.ps1 new file mode 100644 index 0000000..2142175 --- /dev/null +++ b/automataCI/services/hestiaFS/Write_File.sh.ps1 @@ -0,0 +1,104 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Write_Byte_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Write_Text_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Write-File { + param ( + [string]$___target, + [string]$___string_content, + [byte[]]$___byte_content + ) + + + # execute + if ($(hestiaSTRING-Is-Empty $___string_content) -eq ${env:hestiaKERNEL_ERROR_OK}) { + # write as byte data type + return hestiaFS-Write-Byte-File $___target $___byte_content + } else { + # default to text data type + return hestiaFS-Write-Text-File $___target $___string_content + } +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Write_Byte_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Write_Text_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Write_File() { + #___target="$1" + #___string_content="$2" + #___bytes_content="$3" + + + # execute + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + # write as byte data type + hestiaFS_Write_Byte_File "$1" "$2" + else + # default to text data type + hestiaFS_Write_Text_File "$1" "$2" + fi + + + # report status + return $? +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaFS/Write_Text_File.sh.ps1 b/automataCI/services/hestiaFS/Write_Text_File.sh.ps1 new file mode 100644 index 0000000..c78dec2 --- /dev/null +++ b/automataCI/services/hestiaFS/Write_Text_File.sh.ps1 @@ -0,0 +1,138 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Exist.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaFS-Write-Text-File { + param ( + [string]$___target, + [string]$___content + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___content) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory "$(hestiaFS-Get-Directory $___target)") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + if ($(hestiaFS-Is-Exist $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + + # execute + $null = Set-Content -NoNewline -Path $___target -Value $___content + if ($?) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Exist.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaFS_Write_Text_File() { + #___target="$1" + #___content="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$(hestiaFS_Get_Directory "$1")") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + + # execute + printf -- "%b" "$2" > "$1" + if [ $? -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGIT/Change_Branch.sh.ps1 b/automataCI/services/hestiaGIT/Change_Branch.sh.ps1 new file mode 100644 index 0000000..07eff75 --- /dev/null +++ b/automataCI/services/hestiaGIT/Change_Branch.sh.ps1 @@ -0,0 +1,154 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaGIT-Change-Branch { + param ( + [string]$___directory, + [string]$___branch + ) + + + # validate input + if ($(hestiaGIT-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___branch) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-Directory "${___directory}\.git") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + + # execute + $___current_path = Get-Location + $null = Set-Location $___directory + $___process = hestiaOS-Exec "git" "checkout `"${___branch}`"" + $null = Set-Location $___current_path + $null = Remove-Variable ___current_path + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaGIT_Change_Branch() { + #___directory="$1" + #___branch="$2" + + + # validate input + if [ $(hestiaGIT_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_Directory "${1}/.git") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + + # execute + ___current_path="$PWD" + cd "$1" + git checkout "$2" + ___process=$? + cd "$___current_path" + unset ___current_path + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGIT/Clone.sh.ps1 b/automataCI/services/hestiaGIT/Clone.sh.ps1 new file mode 100644 index 0000000..a757350 --- /dev/null +++ b/automataCI/services/hestiaGIT/Clone.sh.ps1 @@ -0,0 +1,156 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaGIT-Clone { + param ( + [string]$___url, + [string]$___directory + ) + + + # validate input + if ($(hestiaGIT-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___url) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + + # execute + $___process = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___directory)" + if ($___process -ne $hestiaKERNEL_ERROR_OK) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $___current_path = Get-Location + $null = Set-Location "$(hestiaFS-Get-Directory $___directory)" + $___process = hestiaOS-Exec "git" "clone `"${___url}`" `"${___directory}`"" + $null = Set-Location $___current_path + $null = Remove-Variable ___current_path + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaGIT_Clone() { + #___url="$1" + #___directory="$2" + + + # validate input + if [ $(hestiaGIT_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + + # execute + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$2")" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ___current_path="$PWD" + cd "$(hestiaFS_Get_Directory "$2")" + git clone "$1" "$2" + ___process=$? + cd "$___current_path" + unset ___current_path + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGIT/Is_Available.sh.ps1 b/automataCI/services/hestiaGIT/Is_Available.sh.ps1 new file mode 100644 index 0000000..3544fa9 --- /dev/null +++ b/automataCI/services/hestiaGIT/Is_Available.sh.ps1 @@ -0,0 +1,86 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaGIT-Is-Available { + # execute + if ($(hestiaOS-Is-Command-Available "git") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaGIT_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "git") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGIT/Vanilla.sh.ps1 b/automataCI/services/hestiaGIT/Vanilla.sh.ps1 new file mode 100644 index 0000000..4ff9e35 --- /dev/null +++ b/automataCI/services/hestiaGIT/Vanilla.sh.ps1 @@ -0,0 +1,58 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaGIT\Clone.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Change_Branch.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGIT\Is_Available.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaGIT/Clone.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Change_Branch.sh.ps1" +. "${LIBS_HESTIA}/hestiaGIT/Is_Available.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGZ/Compress.sh.ps1 b/automataCI/services/hestiaGZ/Compress.sh.ps1 new file mode 100644 index 0000000..f3f4d9f --- /dev/null +++ b/automataCI/services/hestiaGZ/Compress.sh.ps1 @@ -0,0 +1,142 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Vanilla.sh.ps1" + + + + +function hestiaGZ-Compress { + param ( + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-File $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} + } + + + # execute + $___source = $___source -replace "\.gz$" + if ($(hestiaOS-Is-Command-Available "gzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "gzip" "-9 `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } elseif ($(hestiaOS-Is-Command-Available "gunzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "gunzip" "-9 `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaGZ_Compress() { + #___source="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_FILE + fi + + + # execute + ___source="${1%.gz*}" + if [ $(hestiaOS_Is_Command_Available "gzip") -eq $hestiaKERNEL_ERROR_OK ]; then + gzip -9 "$___source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + elif [ $(hestiaOS_Is_Command_Available "gunzip") -eq $hestiaKERNEL_ERROR_OK ]; then + gunzip -9 "$___source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_NOT_POSSIBLE +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGZ/Deflate.sh.ps1 b/automataCI/services/hestiaGZ/Deflate.sh.ps1 new file mode 100644 index 0000000..51d5488 --- /dev/null +++ b/automataCI/services/hestiaGZ/Deflate.sh.ps1 @@ -0,0 +1,140 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaGZ\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Vanilla.sh.ps1" + + + + +function hestiaGZ-Deflate { + param ( + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaGZ-Is-Target-Valid $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + if ($(hestiaOS-Is-Command-Available "gzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "gzip" "-d `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } elseif ($(hestiaOS-Is-Command-Available "gunzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "gunzip" "-d `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaGZ_Deflate() { + #___source="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaGZ_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + if [ $(hestiaOS_Is_Command_Available "gzip") -eq $hestiaKERNEL_ERROR_OK ]; then + gzip -d "$___source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + elif [ $(hestiaOS_Is_Command_Available "gunzip") -eq $hestiaKERNEL_ERROR_OK ]; then + gzip -d "$___source" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_NOT_POSSIBLE +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGZ/Is_Available.sh.ps1 b/automataCI/services/hestiaGZ/Is_Available.sh.ps1 new file mode 100644 index 0000000..4afea0f --- /dev/null +++ b/automataCI/services/hestiaGZ/Is_Available.sh.ps1 @@ -0,0 +1,93 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Available.sh.ps1" + + + + +function hestiaGZ-Is-Available { + # execute + if ($(hestiaOS-Is-Command-Available "gzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaOS-Is-Command-Available "gunzip") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaGZ_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "gzip") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + elif [ $(hestiaOS_Is_Command_Available "gunzip") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGZ/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaGZ/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..58d994a --- /dev/null +++ b/automataCI/services/hestiaGZ/Is_Target_Valid.sh.ps1 @@ -0,0 +1,120 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaGZ-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq $hestiaKERNEL_ERROR_OK) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___target = hestiaFS-Get-File $___target + if ($($___target -replace '.*\.tgz$', '') -ne $___target) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($($___target -replace '.*\.gz$', '') -ne $___target) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaGZ_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%.tgz*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + if [ ! "${___target%%.gz*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaGZ/Vanilla.sh.ps1 b/automataCI/services/hestiaGZ/Vanilla.sh.ps1 new file mode 100644 index 0000000..00665ae --- /dev/null +++ b/automataCI/services/hestiaGZ/Vanilla.sh.ps1 @@ -0,0 +1,60 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaGZ\Compress.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Deflate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Is_Target_Valid.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaGZ/Compress.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Deflate.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Is_Target_Valid.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHOMEBREW/Install.sh.ps1 b/automataCI/services/hestiaHOMEBREW/Install.sh.ps1 new file mode 100644 index 0000000..b9814af --- /dev/null +++ b/automataCI/services/hestiaHOMEBREW/Install.sh.ps1 @@ -0,0 +1,117 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHOMEBREW\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaHOMEBREW-Install { + param ( + [string]$___package + ) + + + # validate input + if ($(hestiaHOMEBREW-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___package) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___process = hestiaOS-Exec "brew" "install `"${___package}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaHOMEBREW/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaHOMEBREW_Install() { + #___package="$1" + + + # validate input + if [ $(hestiaHOMEBREW_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + brew install "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHOMEBREW/Is_Available.sh.ps1 b/automataCI/services/hestiaHOMEBREW/Is_Available.sh.ps1 new file mode 100644 index 0000000..b75cd2f --- /dev/null +++ b/automataCI/services/hestiaHOMEBREW/Is_Available.sh.ps1 @@ -0,0 +1,86 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaHOMEBREW-Is-Available { + # execute + if ($(hestiaOS-Is-Command-Available "brew") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaHOMEBREW_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "brew") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHOMEBREW/Package.sh.ps1 b/automataCI/services/hestiaHOMEBREW/Package.sh.ps1 new file mode 100644 index 0000000..2ab3dc4 --- /dev/null +++ b/automataCI/services/hestiaHOMEBREW/Package.sh.ps1 @@ -0,0 +1,504 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSHASUM\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Pack.sh.ps1" + + + + +function hestiaHOMEBREW-Package { + param ( + [string]$___formula, + [string]$___archive_name, + [string]$___workspace, + [string]$___sku, + [string]$___description, + [string]$___website, + [string]$___license, + [string]$___base_url + ) + + + # validate input + if ( + ($(hestiaSTRING-Is-Empty $___formula) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___archive_name) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___workspace) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___sku) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___description) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___website) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___license) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___base_url) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSHASUM-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaFS-Is-Directory $___workspace) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} + } + + $___export_directory = hestiaFS-Get-Directory $___formula + if ($___export_directory -eq $___formula) { + return ${env:hestiaKERNEL_ERROR_DATA_BAD} + } + $null = hestiaFS-Create-Directory $___export_directory + + + # execute + ## generate the init script + $___process = hestiaFS-Write-File "${___workspace}/init.sh" @" +#!/bin/sh +OS_Get_Arch() { + ___output="`$(uname -m)" + ___output="`$(printf -- "%b" "`$___output" | tr '[:upper:]' '[:lower:]')" + case "`$___output" in + i686-64|ia64) + export ___output='ia64' # Intel Itanium. + ;; + 386|i386|486|i486|586|i586|686|i686) + export ___output='i386' + ;; + x86_64|x64) + export ___output='amd64' + ;; + sun4u) + export ___output='sparc' + ;; + 'power macintosh') + export ___output='powerpc' + ;; + ip*) + export ___output='mips' + ;; + *) + ;; + esac + + + # report status + printf -- "%b" "`$___output" + return 0 +} + + +OS_Get() { + # execute + ___output="`$(uname)" + ___output="`$(printf -- "%b" "`${___output}" | tr '[:upper:]' '[:lower:]')" + case "`$___output" in + windows*|ms-dos*) + ___output='windows' + ;; + cygwin*|mingw*|mingw32*|msys*) + ___output='windows' + ;; + *freebsd) + ___output='freebsd' + ;; + dragonfly*) + ___output='dragonfly' + ;; + *) + ;; + esac + + + # report status + printf -- "%b" "`$___output" + return 0 +} + + +main() { + host_os="`$(OS_Get)" + host_arch="`$(OS_Get_Arch)" + for ___file in './bin/'*; do + if [ ! -e "`$___file" ]; then + continue + fi + + ___system="`${___file##*/}" + ___system="`${___system%%.*}" + ___system="`${___system##*_}" + ___os="`${___system%%-*}" + ___arch="`${___system##*-}" + + case "`$___os" in + any|"`$host_os") + ;; + *) + rm -f "`$___file" &> /dev/null + continue + ;; + esac + + case "`$___arch" in + any|"`$host_arch") + mv "`$___file" "`${___file%%_*}" + ;; + *) + rm -f "`$___file" &> /dev/null + ;; + esac + done + + return 0 +} +main `$* +return `$? + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + ## seal the workspace + $___process = hestiaTAR-Pack "${___export_directory}\${___archive_name}" $___workspace "xz" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + ## create the formula + $___shasum = hestiaSHASUM-Create-From-File "${___export_directory}\${___archive_name}" "256" + if ($(hestiaSTRING-Is-Empty $___shasum) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___formula)" + $___process = hestiaFS-Write-File $___formula @" +class $(hestiaSTRING-To-Titlecase "${___sku}") < Formula + desc "${___description}" + homepage "${___website}" + license "${___license}" + url "${___base_url}/${___archive_name}" + sha256 "${___shasum}" + + def install + if File.file?('init.sh.ps1') + chmod 755, './init.sh.ps1' + system './init.sh.ps1' + else + chmod 755, './init.sh' + system './init.sh' + end + + if File.directory?('bin') + Dir.foreach('bin') do |filename| + next if filename == '.' or filename == '..' + chmod 0755, filename + libexec.install 'bin/' + filename + bin.install_symlink 'libexec/bin/' + filename => filename + end + end + + if File.directory?('lib') + Dir.foreach('lib') do |filename| + next if filename == '.' or filename == '..' + chmod 0544, filename + libexec.install 'lib/' + filename + lib.install_symlink 'libexec/lib/' + filename => filename + end + end + end + + test do + if File.file?('init.sh.ps1') + assert_predicate 'init.sh.ps1', :exist? + else + assert_predicate 'init.sh', :exist? + end + end +end + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSHASUM/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Pack.sh.ps1" + + + + +hestiaHOMEBREW_Package() { + #___formula="$1" + #___archive_name="$2" + #___workspace="$3" + #___sku="$4" + #___description="$5" + #___website="$6" + #___license="$7" + #___base_url="$8" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$8") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSHASUM_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaFS_Is_Directory "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY + fi + + ___export_directory="$(hestiaFS_Get_Directory "$1")" + if [ "$___export_directory" = "$1" ]; then + return $hestiaKERNEL_ERROR_DATA_BAD + fi + hestiaFS_Create_Directory "$___export_directory" + + + # execute + ## generate the init script + hestiaFS_Write_File "${3}/init.sh" "\ +#!/bin/sh +OS_Get_Arch() { + ___output=\"\$(uname -m)\" + ___output=\"\$(printf -- \"%b\" \"\$___output\" | tr '[:upper:]' '[:lower:]')\" + case \"\$___output\" in + i686-64|ia64) + export ___output='ia64' # Intel Itanium. + ;; + 386|i386|486|i486|586|i586|686|i686) + export ___output='i386' + ;; + x86_64|x64) + export ___output='amd64' + ;; + sun4u) + export ___output='sparc' + ;; + 'power macintosh') + export ___output='powerpc' + ;; + ip*) + export ___output='mips' + ;; + *) + ;; + esac + + + # report status + printf -- \"%b\" \"\$___output\" + return 0 +} + + +OS_Get() { + # execute + ___output=\"\$(uname)\" + ___output=\"\$(printf -- \"%b\" \"\${___output}\" | tr '[:upper:]' '[:lower:]')\" + case \"\$___output\" in + windows*|ms-dos*) + ___output='windows' + ;; + cygwin*|mingw*|mingw32*|msys*) + ___output='windows' + ;; + *freebsd) + ___output='freebsd' + ;; + dragonfly*) + ___output='dragonfly' + ;; + *) + ;; + esac + + + # report status + printf -- \"%b\" \"\$___output\" + return 0 +} + + +main() { + host_os=\"\$(OS_Get)\" + host_arch=\"\$(OS_Get_Arch)\" + for ___file in './bin/'*; do + if [ ! -e \"\$___file\" ]; then + continue + fi + + ___system=\"\${___file##*/}\" + ___system=\"\${___system%%.*}\" + ___system=\"\${___system##*_}\" + ___os=\"\${___system%%-*}\" + ___arch=\"\${___system##*-}\" + + case \"\$___os\" in + any|\"\$host_os\") + ;; + *) + rm -f \"\$___file\" &> /dev/null + continue + ;; + esac + + case \"\$___arch\" in + any|\"\$host_arch\") + mv \"\$___file\" \"\${___file%%_*}\" + ;; + *) + rm -f \"\$___file\" &> /dev/null + ;; + esac + done + + return 0 +} +main \$* +return \$? +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + ## seal the workspace + hestiaTAR_Pack "${___export_directory}/${2}" "$3" "xz" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + ## create the formula + ___shasum="$(hestiaSHASUM_Create_From_File "${___export_directory}/${2}" "256")" + if [ $(hestiaSTRING_Is_Empty "$___shasum") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + hestiaFS_Write_File "$1" "\ +class $(hestiaSTRING_To_Titlecase "$4") < Formula + desc \"${5}\" + homepage \"${6}\" + license \"${7}\" + url \"${8}/${2}\" + sha256 \"${___shasum}\" + + def install + if File.file?('init.sh.ps1') + chmod 755, './init.sh.ps1' + system './init.sh.ps1' + else + chmod 755, './init.sh' + system './init.sh' + end + + if File.directory?('bin') + Dir.foreach('bin') do |filename| + next if filename == '.' or filename == '..' + chmod 0755, filename + libexec.install 'bin/' + filename + bin.install_symlink 'libexec/bin/' + filename => filename + end + end + + if File.directory?('lib') + Dir.foreach('lib') do |filename| + next if filename == '.' or filename == '..' + chmod 0544, filename + libexec.install 'lib/' + filename + lib.install_symlink 'libexec/lib/' + filename => filename + end + end + end + + test do + if File.file?('init.sh.ps1') + assert_predicate 'init.sh.ps1', :exist? + else + assert_predicate 'init.sh', :exist? + end + end +end +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHOMEBREW/Vanilla.sh.ps1 b/automataCI/services/hestiaHOMEBREW/Vanilla.sh.ps1 new file mode 100644 index 0000000..9414ba9 --- /dev/null +++ b/automataCI/services/hestiaHOMEBREW/Vanilla.sh.ps1 @@ -0,0 +1,58 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaHOMEBREW\Install.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHOMEBREW\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHOMEBREW\Package.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaHOMEBREW/Install.sh.ps1" +. "${LIBS_HESTIA}/hestiaHOMEBREW/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaHOMEBREW/Package.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHTTP/Call.sh.ps1 b/automataCI/services/hestiaHTTP/Call.sh.ps1 new file mode 100644 index 0000000..4d648c6 --- /dev/null +++ b/automataCI/services/hestiaHTTP/Call.sh.ps1 @@ -0,0 +1,272 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaHTTP-Call { + param ( + [string]$___method, + [string]$___url, + [string]$___headers, + [string]$___data, + [string]$___filepath + ) + + + # validate input + if ($(hestiaHTTP-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + if ($(hestiaSTRING-Is-Empty $___method) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + if ($(hestiaSTRING-Is-Empty $___url) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + if ( + ($(hestiaSTRING-Is-Empty $___data) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return "" + } + + + # execute + ## prepare baseline arguments + $___arguments = "--location --request '${___method}' --url `"${___url}`"" + + ## prepare header arguments + $___has_user_agent = $false + if ($(hestiaSTRING-Is-Empty $___headers) -ne ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($___line in ($___headers.Split("`n"))) { + if ($(hestiaSTRING-Is-Empty $___line) -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + if ($($___line -replace "^User-Agent:", '') -ne $___line) { + $___has_user_agent = $true + } + + $___arguments = "${___arguments} --header `"${___line}`"" + } + } + + if (-not $___has_user_agent) { + $___arguments = "${___arguments} --header 'User-Agent: " + $___arguments += "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " + $___arguments += "AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 " + $___arguments += "Safari/605.1.15" + $___arguments += "'" + } + + ## prepare data arguments + if ($(hestiaSTRING-Is-Empty $___data) -ne ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($___line in ($___data.Split("`n"))) { + if ($(hestiaSTRING-Is-Empty $___line) -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___arguments = "${___arguments} --data-binary `"${___line}`"" + } + } + + ## prepare output argument + if ($(hestiaSTRING-Is-Empty $___filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaFS-Is-Exist $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + $___arguments = "${___arguments} --output `"${___filepath}`"" + } + + ## make the call + try { + $___output = Get-Command 'curl' -ErrorAction SilentlyContinue + $___output = Invoke-Expression -Command "${___output} ${___arguments}" + if ($LASTEXITCODE -ne ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaSTRING-Is-Empty $___filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___filepath + } + } + + return $___output + } catch { + return "" + } +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaHTTP_Call() { + #___method="$1" + #___url="$2" + #___headers="$3" + #___data="$4" + #___filepath="$5" + + + # validate input + if [ $(hestiaHTTP_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKENREL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ## prepare baseline arguments + ___arguments="--location --request '${1}' --url \"$2\"" + + ## prepare header arguments + ___has_user_agent=1 + if [ $(hestiaSTRING_Is_Empty "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + ___old_IFS="$IFS" + while IFS= read -r ___line || [ -n "$___line" ]; do + if [ $(hestiaSTRING_Is_Empty "$___line") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + if [ ! "${___line##*User-Agent:}" = "${___line}" ]; then + ___has_user_agent=0 + fi + + ___arguments="${___arguments} --header \"${___line}\"" + done < diff --git a/automataCI/services/hestiaHTTP/Download.sh.ps1 b/automataCI/services/hestiaHTTP/Download.sh.ps1 new file mode 100644 index 0000000..eedbf78 --- /dev/null +++ b/automataCI/services/hestiaHTTP/Download.sh.ps1 @@ -0,0 +1,195 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Call.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSHASUM\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaHTTP-Download { + param ( + [string]$___method, + [string]$___url, + [string]$___filepath, + [string]$___headers, + [string]$___shasum_type, + [string]$___shasum_value, + [string]$___data + ) + + + # validate input + if ($(hestiaHTTP-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKENREL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___method) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaSTRING-Is-Empty $___url) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___filepath) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + + # execute + ## clean up workspace + $null = hestiaFS-Remove $___filepath + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___filepath)" + + ## make the call + $null = hestiaHTTP-Call $___method $___url $___headers $___data $___filepath + if ($(hestiaFS-Is-File $___filepath) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## checksum payload + if ( + ($(hestiaSTRING-Is-Empty $___shasum_type) -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty $___shasum_value) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaSHASUM-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_UNSUPPORTED} + } + + if (-not "$(hestiaSHASUM-Create-From-File $___filepath $___shasum_type)" -eq $___shasum_value) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISMATCHED} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Call.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSHASUM/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaHTTP_Download() { + #___method="$1" + #___url="$2" + #___filepath="$3" + #___headers="$4" + #___shasum_type="$5" + #___shasum_value="$6" + #___data="$7" + + + # validate input + if [ $(hestiaHTTP_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKENREL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + + # execute + ## clean up workspace + hestiaFS_Remove "$3" + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$3")" + + ## download payload + hestiaHTTP_Call "$1" "$2" "$4" "$7" "$3" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$3" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + if [ $(hestiaFS_Is_File "$3") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## checksum payload + if [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaSHASUM_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_UNSUPPORTED + fi + + if [ ! "$(hestiaSHASUM_Create_From_File "$3" "$5")" = "$6" ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISMATCHED + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHTTP/Is_Available.sh.ps1 b/automataCI/services/hestiaHTTP/Is_Available.sh.ps1 new file mode 100644 index 0000000..9446f3c --- /dev/null +++ b/automataCI/services/hestiaHTTP/Is_Available.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" + + + + +function hestiaHTTP-Is-Available { + # execute + if (Get-Command curl -ErrorAction SilentlyContinue) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" + + + + +hestiaHTTP_Is_Available() { + # execute + if [ ! -z "$(type -t "curl")" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHTTP/Setup.sh.ps1 b/automataCI/services/hestiaHTTP/Setup.sh.ps1 new file mode 100644 index 0000000..f857dff --- /dev/null +++ b/automataCI/services/hestiaHTTP/Setup.sh.ps1 @@ -0,0 +1,108 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCHOCOLATEY\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" + + + + +function hestiaHTTP-Setup { + # validate input + if ($(hestiaHTTP-Is-Available) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaCHOCOLATEY-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # execute + $___process = hestiaCHOCOLATEY-Install "curl" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaHOMEBREW/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" + + + + +hestiaHTTP_Setup() { + # validate input + if [ $(hestiaHTTP_Is_Available) -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaHOMEBREW_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + hestiaHOMEBREW_Install "curl" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaHTTP/Vanilla.sh.ps1 b/automataCI/services/hestiaHTTP/Vanilla.sh.ps1 new file mode 100644 index 0000000..fdc45bb --- /dev/null +++ b/automataCI/services/hestiaHTTP/Vanilla.sh.ps1 @@ -0,0 +1,60 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaHTTP\Call.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Download.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Setup.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaHTTP/Call.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Download.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Setup.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 b/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 old mode 100755 new mode 100644 index 6f4a16b..452c086 --- a/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 +++ b/automataCI/services/hestiaI18N/Get_Languages_List.sh.ps1 @@ -33,7 +33,7 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null # Windows POWERSHELL Codes # ################################################################################ function hestiaI18N-Get-Languages-List { - return @" + return @" en zh-hans diff --git a/automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_All_Components_Description.sh.ps1 old mode 100755 new mode 100644 similarity index 80% rename from automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_All_Components_Description.sh.ps1 index 47f41d2..8490bfd --- a/automataCI/services/hestiaI18N/Translate-All-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_All_Components_Description.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-All-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-All-Components-Description { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "包装里的所有元件。" - } default { - # fallback to default english - return "All components in this package." - }} - - - # report status - return 0 + # execute + switch ($___locale) { + "zh-hans*" { + # 简体中文 + return "包装里的所有元件。" + } default { + # fallback to default english + return "All components in this package." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -71,19 +67,15 @@ hestiaI18N_Translate_All_Components_Description() { # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "包装里的所有元件。" + printf -- "%s" "包装里的所有元件。" ;; *) # fallback to default english - printf -- "%b" "All components in this package." + printf -- "%s" "All components in this package." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_All_Components_Title.sh.ps1 old mode 100755 new mode 100644 similarity index 82% rename from automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_All_Components_Title.sh.ps1 index 6f5a520..e9db6a0 --- a/automataCI/services/hestiaI18N/Translate-All-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_All_Components_Title.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-All-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-All-Components-Title { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有元件" - } default { - # fallback to default english - return "All Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有元件" + } default { + # fallback to default english + return "All Components" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -71,19 +67,15 @@ hestiaI18N_Translate_All_Components_Title() { # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有元件" + printf -- "%s" "所有元件" ;; *) # fallback to default english - printf -- "%b" "All Components" + printf -- "%s" "All Components" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Already_Latest_Version.sh.ps1 old mode 100755 new mode 100644 similarity index 78% rename from automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Already_Latest_Version.sh.ps1 index a69b790..091ef14 --- a/automataCI/services/hestiaI18N/Translate-Already-Latest-Version.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Already_Latest_Version.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Already-Latest-Version() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Already-Latest-Version { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" - } default { - # fallback to default english - return "You have the same/latest version. No further action is required." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" + } default { + # fallback to default english + return "You have the same/latest version. No further action is required." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -71,18 +67,15 @@ hestiaI18N_Translate_Already_Latest_Version() { # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" + printf -- "%s" "您已经有同样或是最新的版本了。那就不需要任何另外加工吧。" ;; *) # fallback to default english - printf -- "%b" "You have the same/latest version. No further action is required." + printf -- "%s" "You have the same/latest version. No further action is required." + ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Assemble.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Assemble.sh.ps1 new file mode 100644 index 0000000..e639b8d --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Assemble.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Assemble { + param ( + [string]$___locale, + [string]$___destination, + [string]$___source + ) + + + # execute + if ($___destination -eq "") { + $___destination = "???" + } + + if ($___source -eq "") { + $___source = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "聚集着‘${___source}’成‘${___destination}’。。。" + } default { + # fallback to default english + return "assembling '${___source}' as '${___destination}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Assemble() { + #___locale="$1" + #___destination="$2" + #___source="$3" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "聚集着‘${3:-???}’成‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "assembling '${3:-???}' as '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Assemble_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Assemble_Failed.sh.ps1 new file mode 100644 index 0000000..6c293db --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Assemble_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Assemble-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "聚集失败!" + } default { + # fallback to default english + return "assemble failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Assemble_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "聚集失败!" + ;; + *) + # fallback to default english + printf -- "%s" "assemble failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Assemble_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Assemble_Simulate.sh.ps1 new file mode 100644 index 0000000..7efd0ca --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Assemble_Simulate.sh.ps1 @@ -0,0 +1,83 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Assemble-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着聚集行动。。。" + } default { + # fallback to default english + return "simulating assembling activities..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Assemble_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着聚集行动。。。" + ;; + *) + # fallback to default english + printf -- "%s" "simulating assembling activities..." + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Assemble_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Assemble_Skipped.sh.ps1 new file mode 100644 index 0000000..9ee975d --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Assemble_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Assemble-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过聚集步骤。" + } default { + # fallback to default english + return "assemble skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Assemble_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过聚集步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "assemble skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Bin_Component_Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Bin_Component_Description.sh.ps1 new file mode 100644 index 0000000..a6517cb --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Bin_Component_Description.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Bin-Component-Description { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有可启动的软件产品。" + } default { + # fallback to default english + return "All executable software products." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Bin_Component_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "所有可启动的软件产品。" + ;; + *) + # fallback to default english + printf -- "%s" "All executable software products." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Bin_Component_Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Bin_Component_Title.sh.ps1 new file mode 100644 index 0000000..6c07e7f --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Bin_Component_Title.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Bin-Component-Title { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "启动软件元件" + } default { + # fallback to default english + return "Executables Component" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Bin_Component_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "启动软件元件" + ;; + *) + # fallback to default english + printf -- "%s" "Executables Component" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Check.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Check.sh.ps1 new file mode 100644 index 0000000..1e58c8a --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Check.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Check { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "检查着‘${___name}’。。。" + } default { + # fallback to default english + return "checking '${___name}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Check() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "检查着‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "checking '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Check_Availability.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Check_Availability.sh.ps1 new file mode 100644 index 0000000..62c30cd --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Check_Availability.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Check-Availability { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "检查着‘${___name}’的存在。。。" + } default { + # fallback to default english + return "checking '${___name}' availability..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Check_Availability() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "检查着‘${2:-???}’的存在。。。" + ;; + *) + # fallback to default english + printf -- "%s" "checking '${2:-???}' availability..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Check_Failed.sh.ps1 old mode 100755 new mode 100644 similarity index 81% rename from automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Check_Failed.sh.ps1 index f6133dd..90512ef --- a/automataCI/services/hestiaI18N/Translate-Docs-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Check_Failed.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Docs-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Check-Failed { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "书写笔记元件" - } default { - # fallback to default english - return "Documentations Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "检查失败!" + } default { + # fallback to default english + return "check failed!" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Docs_Components_Title() { +hestiaI18N_Translate_Check_Failed() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "书写笔记元件" + printf -- "%s" "检查失败!" ;; *) # fallback to default english - printf -- "%b" "Documentations Components" + printf -- "%s" "check failed!" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Check_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Check_Simulate.sh.ps1 new file mode 100644 index 0000000..4615c12 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Check_Simulate.sh.ps1 @@ -0,0 +1,83 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Check-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着检查行动。。。" + } default { + # fallback to default english + return "simulating checking activities..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Check_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着检查行动。。。" + ;; + *) + # fallback to default english + printf -- "%s" "simulating checking activities..." + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Check_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Check_Skipped.sh.ps1 new file mode 100644 index 0000000..06d7caa --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Check_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Check-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过检查步骤。" + } default { + # fallback to default english + return "assemble skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Assemble_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过检查步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "assemble skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Create.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Create.sh.ps1 new file mode 100644 index 0000000..04b77fd --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Create.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Create { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "制作着‘${___name}’。。。" + } default { + # fallback to default english + return "creating '${___name}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Create() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "制作着‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "creating '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Create_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Create_Failed.sh.ps1 new file mode 100644 index 0000000..7b44dac --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Create_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Create-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "制作失败!" + } default { + # fallback to default english + return "create failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Create_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "制作失败!" + ;; + *) + # fallback to default english + printf -- "%s" "create failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Create_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Create_Simulate.sh.ps1 new file mode 100644 index 0000000..308c274 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Create_Simulate.sh.ps1 @@ -0,0 +1,83 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Create-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着制作行动。。。" + } default { + # fallback to default english + return "simulating creating activities..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Create_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着制作行动。。。" + ;; + *) + # fallback to default english + printf -- "%s" "simulating creating activities..." + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Create_Skipped.sh.ps1 old mode 100755 new mode 100644 similarity index 80% rename from automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Create_Skipped.sh.ps1 index 2820d6a..ac87aa7 --- a/automataCI/services/hestiaI18N/Translate-Config-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Create_Skipped.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Config-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Create-Skipped { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有设定的文件。" - } default { - # fallback to default english - return "All configuration files." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过制作步骤。" + } default { + # fallback to default english + return "create skipped." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Config_Components_Description() { +hestiaI18N_Translate_Create_Skipped() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有设定的文件。" + printf -- "%s" "跳过制作步骤。" ;; *) # fallback to default english - printf -- "%b" "All configuration files." + printf -- "%s" "create skipped." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Doc_Component_Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Doc_Component_Description.sh.ps1 new file mode 100644 index 0000000..2b95afb --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Doc_Component_Description.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Doc-Component-Description { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有笔记书写文稿。" + } default { + # fallback to default english + return "All articles and documentations." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Doc_Component_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "所有笔记书写文稿。" + ;; + *) + # fallback to default english + printf -- "%s" "All articles and documentations." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Doc_Component_Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Doc_Component_Title.sh.ps1 new file mode 100644 index 0000000..f3678a1 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Doc_Component_Title.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Doc-Component-Title { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "书写笔记元件" + } default { + # fallback to default english + return "Documentations Component" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Doc_Component_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "书写笔记元件" + ;; + *) + # fallback to default english + printf -- "%s" "Documentations Component" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Done.sh.ps1 old mode 100755 new mode 100644 similarity index 82% rename from automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Done.sh.ps1 index 5eabc9d..db5cf59 --- a/automataCI/services/hestiaI18N/Translate-Main-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Done.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Main-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Done { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "主要元件" - } default { - # fallback to default english - return "Main Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "搞定" + } default { + # fallback to default english + return "done" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Main_Components_Title() { +hestiaI18N_Translate_Done() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "主要元件" + printf -- "%s" "搞定" ;; *) # fallback to default english - printf -- "%b" "Main Components" + printf -- "%s" "done" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Error.sh.ps1 old mode 100755 new mode 100644 similarity index 81% rename from automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Error.sh.ps1 index cc9bac9..00d06f8 --- a/automataCI/services/hestiaI18N/Translate-Bin-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Error.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Bin-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Error { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "软件元件" - } default { - # fallback to default english - return "Executables Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "错误" + } default { + # fallback to default english + return "error" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Bin_Components_Title() { +hestiaI18N_Translate_Error() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "软件元件" + printf -- "%s" "错误" ;; *) # fallback to default english - printf -- "%b" "Executables Components" + printf -- "%s" "error" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Etc_Component_Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Etc_Component_Description.sh.ps1 new file mode 100644 index 0000000..26a7383 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Etc_Component_Description.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Etc-Component-Description { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有设定的文件。" + } default { + # fallback to default english + return "All configuration files." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Etc_Component_Description() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "所有设定的文件。" + ;; + *) + # fallback to default english + printf -- "%s" "All configuration files." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Etc_Component_Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Etc_Component_Title.sh.ps1 new file mode 100644 index 0000000..b41149c --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Etc_Component_Title.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Etc-Component-Title { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "设定元件" + } default { + # fallback to default english + return "Configurations Component" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Etc_Component_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "设定元件" + ;; + *) + # fallback to default english + printf -- "%s" "Configurations Component" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Info.sh.ps1 old mode 100755 new mode 100644 similarity index 81% rename from automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Info.sh.ps1 index ce0214c..a4ae5f5 --- a/automataCI/services/hestiaI18N/Translate-Config-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Info.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Config-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Info { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "设定元件" - } default { - # fallback to default english - return "Configurations Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "详情" + } default { + # fallback to default english + return "info" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Config_Components_Title() { +hestiaI18N_Translate_Info() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "设定元件" + printf -- "%s" "详情" ;; *) # fallback to default english - printf -- "%b" "Configurations Components" + printf -- "%s" "info" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Lib_Component_Description.sh.ps1 old mode 100755 new mode 100644 similarity index 78% rename from automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Lib_Component_Description.sh.ps1 index 8f480f3..2b7ff3f --- a/automataCI/services/hestiaI18N/Translate-Lib-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Lib_Component_Description.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Lib-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Lib-Component-Description { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有可开发的码库类产品。" - } default { - # fallback to default english - return "All importable libraries products." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有可开发的码库类产品。" + } default { + # fallback to default english + return "All importable libraries products." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Lib_Components_Description() { +hestiaI18N_Translate_Lib_Component_Description() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有可开发的码库类产品。" + printf -- "%s" "所有可开发的码库类产品。" ;; *) # fallback to default english - printf -- "%b" "All importable libraries products." + printf -- "%s" "All importable libraries products." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Lib_Component_Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Lib_Component_Title.sh.ps1 new file mode 100644 index 0000000..fddbb19 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Lib_Component_Title.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Lib-Component-Title { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "代码库类型元件" + } default { + # fallback to default english + return "Libraries Component" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Lib_Component_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "代码库类型元件" + ;; + *) + # fallback to default english + printf -- "%s" "Libraries Component" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Main_Component_Description.sh.ps1 old mode 100755 new mode 100644 similarity index 78% rename from automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Main_Component_Description.sh.ps1 index 644af0c..a5e4ca4 --- a/automataCI/services/hestiaI18N/Translate-Main-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Main_Component_Description.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Main-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Main-Component-Description { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有第一重要无法缺乏的产品。" - } default { - # fallback to default english - return "All critical and core products." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "所有第一重要无法缺乏的产品。" + } default { + # fallback to default english + return "All critical and core products." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Main_Components_Description() { +hestiaI18N_Translate_Main_Component_Description() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有第一重要无法缺乏的产品。" + printf -- "%s" "所有第一重要无法缺乏的产品。" ;; *) # fallback to default english - printf -- "%b" "All critical and core products." + printf -- "%s" "All critical and core products." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Main_Component_Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Main_Component_Title.sh.ps1 new file mode 100644 index 0000000..34f8237 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Main_Component_Title.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Main-Component-Title { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "主要元件" + } default { + # fallback to default english + return "Main Component" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Main_Component_Title() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "主要元件" + ;; + *) + # fallback to default english + printf -- "%s" "Main Component" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Merge.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Merge.sh.ps1 new file mode 100644 index 0000000..220c198 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Merge.sh.ps1 @@ -0,0 +1,96 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Merge { + param ( + [string]$___locale, + [string]$___destination, + [string]$___source + ) + + + # execute + if ($___destination -eq "") { + $___destination = "???" + } + + if ($___source -eq "") { + $___source = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "合并着‘${___source}’进入‘${___destination}’。。。" + } default { + # fallback to default english + return "merging '${___source}' into '${___destination}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Merge() { + #___locale="$1" + #___destination="$2" + #___source="$3" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "合并着‘${3:-???}’进入‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "merging '${3:-???}' into '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Merge_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Merge_Failed.sh.ps1 new file mode 100644 index 0000000..4390f25 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Merge_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Merge-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "合并失败!" + } default { + # fallback to default english + return "merge failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Merge_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "合并失败!" + ;; + *) + # fallback to default english + printf -- "%s" "merge failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Merge_Simulate.sh.ps1 old mode 100755 new mode 100644 similarity index 78% rename from automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Merge_Simulate.sh.ps1 index cfdd493..924ea1a --- a/automataCI/services/hestiaI18N/Translate-Docs-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Merge_Simulate.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Docs-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Merge-Simulate { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有笔记书写文稿。" - } default { - # fallback to default english - return "All articles and documentations." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着合并行动。。。" + } default { + # fallback to default english + return "simulating merging activities..." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Docs_Components_Description() { +hestiaI18N_Translate_Merge_Simulate() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有笔记书写文稿。" + printf -- "%s" "正在仿真着合并行动。。。" ;; *) # fallback to default english - printf -- "%b" "All articles and documentations." + printf -- "%s" "simulating merging activities..." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Merge_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Merge_Skipped.sh.ps1 new file mode 100644 index 0000000..a03e427 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Merge_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Merge-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过合并步骤。" + } default { + # fallback to default english + return "merge skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Merge_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过合并步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "merge skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Note.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Note.sh.ps1 new file mode 100644 index 0000000..36eb413 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Note.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Note { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "信息" + } default { + # fallback to default english + return "note" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Note() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "信息" + ;; + *) + # fallback to default english + printf -- "%s" "note" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_OK.sh.ps1 b/automataCI/services/hestiaI18N/Translate_OK.sh.ps1 new file mode 100644 index 0000000..971ee4b --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_OK.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-OK { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "可行" + } default { + # fallback to default english + return "ok" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_OK() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "可行" + ;; + *) + # fallback to default english + printf -- "%s" "ok" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Only_Install_On_Windows.sh.ps1 old mode 100755 new mode 100644 similarity index 73% rename from automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Only_Install_On_Windows.sh.ps1 index 198b5d0..46a1710 --- a/automataCI/services/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Only_Install_On_Windows.sh.ps1 @@ -32,84 +32,80 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Only-Install-On-Windows() { - param( - [string]$___locale, - [string]$___arch - ) - - - # execute - switch (${___locale}) { - "zh-hans" { - # 简体中文 - switch ("${___arch}") { - "32" { - return @" +function hestiaI18N-Translate-Only-Install-On-Windows { + param ( + [string]$___locale, + [string]$___arch + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + switch ($___arch) { + "32" { + return @" 真遗憾。您只能在32位微软Windows操作系统里安装。 "@ - } "64" { - return @" + } "64" { + return @" 真遗憾。您只能在64位微软Windows操作系统里安装。 "@ - } "amd64" { - return @" + } "amd64" { + return @" 真遗憾。您只能在amd64型芯片的微软Windows操作系统里安装。 "@ - } "arm64" { - return @" + } "arm64" { + return @" 真遗憾。您只能在arm64型芯片的微软Windows操作系统里安装。 "@ - } "i386" { - return @" + } "i386" { + return @" 真遗憾。您只能在i386型芯片的微软Windows操作系统里安装。 "@ - } "arm" { - return @" + } "arm" { + return @" 真遗憾。您只能在arm型芯片的微软Windows操作系统里安装。 "@ - } default { - return @" + } default { + return @" 真遗憾。您只能在微软Windows操作系统里安装。 "@ - }} - } default { - # fallback to default english - switch ("${___arch}") { - "32" { - return @" + }} + } default { + # fallback to default english + switch ($___arch) { + "32" { + return @" Unfortunately, you can only install this in a 32-bits Microsoft Windows operating system. "@ - } "64" { - return @" + } "64" { + return @" Unfortunately, you can only install this in a 64-bits Microsoft Windows operating system. "@ - } "amd64" { - return @" + } "amd64" { + return @" Unfortunately, you can only install this in an amd64 Microsoft Windows operating system. "@ - } "arm64" { - return @" + } "arm64" { + return @" Unfortunately, you can only install this in an arm64 Microsoft Windows operating system. "@ - } "i386" { - return @" + } "i386" { + return @" Unfortunately, you can only install this in an i386 Microsoft Windows operating system. "@ - } "arm" { - return @" + } "arm" { + return @" Unfortunately, you can only install this in an arm Microsoft Windows operating system. "@ - } default { - return @" + } default { + return @" Unfortunately, you can only install this in a Microsoft Windows operating system. "@ - }} - }} - - - # report status - return 0 + }} + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -131,35 +127,35 @@ hestiaI18N_Translate_Only_Install_On_Windows() { # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 case "$2" in 32) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在32位微软Windows操作系统里安装。" ;; 64) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在64位微软Windows操作系统里安装。" ;; amd64) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在amd64型芯片的微软Windows操作系统里安装。" ;; arm64) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在arm64型芯片的微软Windows操作系统里安装。" ;; i386) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在i386型芯片的微软Windows操作系统里安装。" ;; arm) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在arm型芯片的微软Windows操作系统里安装。" ;; *) - printf -- "%b" "\ + printf -- "%s" "\ 真遗憾。您只能在微软Windows操作系统里安装。" ;; esac @@ -168,39 +164,35 @@ hestiaI18N_Translate_Only_Install_On_Windows() { # fallback to default english case "$2" in 32) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in a 32-bits Microsoft Windows operating system." ;; 64) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in a 64-bits Microsoft Windows operating system." ;; amd64) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in an amd64 Microsoft Windows operating system." ;; arm64) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in an arm64 Microsoft Windows operating system." ;; i386) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in an i386 Microsoft Windows operating system." ;; arm) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in an arm Microsoft Windows operating system." ;; *) - printf -- "%b" "\ + printf -- "%s" "\ Unfortunately, you can only install this in a Microsoft Windows operating system." ;; esac esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Package.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Package.sh.ps1 new file mode 100644 index 0000000..b6f1ae3 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Package.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Package { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "包装着‘${___name}’。。。" + } default { + # fallback to default english + return "packaging '${___name}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Package() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "包装着‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "packaging '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Package_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Package_Failed.sh.ps1 new file mode 100644 index 0000000..af00fce --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Package_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Package-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "包装失败!" + } default { + # fallback to default english + return "package failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Package_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "包装失败!" + ;; + *) + # fallback to default english + printf -- "%s" "package failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Package_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Package_Simulate.sh.ps1 new file mode 100644 index 0000000..320d523 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Package_Simulate.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Package-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着包装行动。。。" + } default { + # fallback to default english + return "simulating packaging activities..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Package_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着包装行动。。。" + ;; + *) + # fallback to default english + printf -- "%s" "simulating packaging activities..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Package_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Package_Skipped.sh.ps1 new file mode 100644 index 0000000..b2cd2d2 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Package_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Package-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过包装步骤。" + } default { + # fallback to default english + return "package skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Package_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过包装步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "package skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Publish.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Publish.sh.ps1 new file mode 100644 index 0000000..fb52722 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Publish.sh.ps1 @@ -0,0 +1,86 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Publish { + param ( + [string]$___locale, + [string]$___subject + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在发布‘${___subject}’。。。" + } default { + # fallback to default english + return "Publishing '${___subject}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Publish() { + #___locale="$1" + #___subject="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在发布‘${___subject}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "Publishing '${___subject}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Publish_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Publish_Failed.sh.ps1 new file mode 100644 index 0000000..2f25d2a --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Publish_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Publish-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "发布失败!" + } default { + # fallback to default english + return "publish failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Publish_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "发布失败!" + ;; + *) + # fallback to default english + printf -- "%s" "publish failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Publish_Simulate.sh.ps1 old mode 100755 new mode 100644 similarity index 79% rename from automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Publish_Simulate.sh.ps1 index d170f5f..07b552d --- a/automataCI/services/hestiaI18N/Translate-Bin-Components-Description.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Publish_Simulate.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Bin-Components-Description() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Publish-Simulate { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "所有可启动的软件产品。" - } default { - # fallback to default english - return "All executable software products." - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着发布。。。" + } default { + # fallback to default english + return "Simulate Publishing..." + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Bin_Components_Description() { +hestiaI18N_Translate_Publish_Simulate() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "所有可启动的软件产品。" + printf -- "%s" "正在仿真着发布。。。" ;; *) # fallback to default english - printf -- "%b" "All executable software products." + printf -- "%s" "Simulate Publishing..." ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Publish_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Publish_Skipped.sh.ps1 new file mode 100644 index 0000000..a10a09a --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Publish_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Publish-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过发布步骤。" + } default { + # fallback to default english + return "publish skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Publish_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过发布步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "publish skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Recreate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Recreate.sh.ps1 new file mode 100644 index 0000000..bcfbfb9 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Recreate.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Recreate { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "从新制作着‘${___name}’。。。" + } default { + # fallback to default english + return "recreating '${___name}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Recreate() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "从新制作着‘${2:-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "recreating '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Recreate_Failed.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Recreate_Failed.sh.ps1 new file mode 100644 index 0000000..30c4776 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Recreate_Failed.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Recreate-Failed { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "从新制作失败!" + } default { + # fallback to default english + return "recreate failed!" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Recreate_Failed() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "从新制作失败!" + ;; + *) + # fallback to default english + printf -- "%s" "recreate failed!" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Recreate_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Recreate_Simulate.sh.ps1 new file mode 100644 index 0000000..4f4d3c5 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Recreate_Simulate.sh.ps1 @@ -0,0 +1,83 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Recreate-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着从新制作行动。。。" + } default { + # fallback to default english + return "simulating recreating activities..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Recreate_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着从新制作行动。。。" + ;; + *) + # fallback to default english + printf -- "%s" "simulating recreating activities..." + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Recreate_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Recreate_Skipped.sh.ps1 new file mode 100644 index 0000000..2ed52f2 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Recreate_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Recreate-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过从新制作步骤。" + } default { + # fallback to default english + return "recreate skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Recreate_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过从新制作步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "recreate skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Run.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Run.sh.ps1 new file mode 100644 index 0000000..eb46c8f --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Run.sh.ps1 @@ -0,0 +1,90 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Run { + param ( + [string]$___locale, + [string]$___name + ) + + + # execute + if ($___name -eq "") { + $___name = "???" + } + + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在执行‘${___name}’。。。" + } default { + # fallback to default english + return "running '${___name}'..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Run() { + #___locale="$1" + #___name="$2" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在执行‘${2-???}’。。。" + ;; + *) + # fallback to default english + printf -- "%s" "running '${2:-???}'..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Run_Failed.sh.ps1 old mode 100755 new mode 100644 similarity index 81% rename from automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 rename to automataCI/services/hestiaI18N/Translate_Run_Failed.sh.ps1 index b438df2..51e4c4b --- a/automataCI/services/hestiaI18N/Translate-Lib-Components-Title.sh.ps1 +++ b/automataCI/services/hestiaI18N/Translate_Run_Failed.sh.ps1 @@ -32,25 +32,21 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -function hestiaI18N-Translate-Lib-Components-Title() { - param( - [string]$___locale - ) +function hestiaI18N-Translate-Run-Failed { + param ( + [string]$___locale + ) - # execute - switch ("${___locale}") { - "zh-hans" { - # 简体中文 - return "代码库类型元件" - } default { - # fallback to default english - return "Libraries Components" - }} - - - # report status - return 0 + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "执行失败!" + } default { + # fallback to default english + return "run failed!" + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -65,25 +61,21 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -hestiaI18N_Translate_Lib_Components_Title() { +hestiaI18N_Translate_Run_Failed() { #___locale="$1" # execute case "$1" in - zh-hans) + zh-hans*) # 简体中文 - printf -- "%b" "代码库类型元件" + printf -- "%s" "执行失败!" ;; *) # fallback to default english - printf -- "%b" "Libraries Components" + printf -- "%s" "run failed!" ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaI18N/Translate_Run_Simulate.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Run_Simulate.sh.ps1 new file mode 100644 index 0000000..5839ff8 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Run_Simulate.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Run-Simulate { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "正在仿真着执行。。。" + } default { + # fallback to default english + return "Simulate Running..." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Run_Simulate() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "正在仿真着执行。。。" + ;; + *) + # fallback to default english + printf -- "%s" "Simulate Running..." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Run_Skipped.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Run_Skipped.sh.ps1 new file mode 100644 index 0000000..76a4d34 --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Run_Skipped.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Run-Skipped { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "跳过执行步骤。" + } default { + # fallback to default english + return "run skipped." + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Run_Skipped() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "跳过执行步骤。" + ;; + *) + # fallback to default english + printf -- "%s" "run skipped." + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Success.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Success.sh.ps1 new file mode 100644 index 0000000..6a44e4f --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Success.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Success { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "成功" + } default { + # fallback to default english + return "success" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Success() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "成功" + ;; + *) + # fallback to default english + printf -- "%s" "success" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Translate_Warning.sh.ps1 b/automataCI/services/hestiaI18N/Translate_Warning.sh.ps1 new file mode 100644 index 0000000..7f4ec6a --- /dev/null +++ b/automataCI/services/hestiaI18N/Translate_Warning.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaI18N-Translate-Warning { + param ( + [string]$___locale + ) + + + # execute + switch -Wildcard ($___locale) { + "zh-hans*" { + # 简体中文 + return "注意" + } default { + # fallback to default english + return "warning" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaI18N_Translate_Warning() { + #___locale="$1" + + + # execute + case "$1" in + zh-hans*) + # 简体中文 + printf -- "%s" "注意" + ;; + *) + # fallback to default english + printf -- "%s" "warning" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaI18N/Vanilla.sh.ps1 b/automataCI/services/hestiaI18N/Vanilla.sh.ps1 old mode 100755 new mode 100644 index 2dc2478..1a65d57 --- a/automataCI/services/hestiaI18N/Vanilla.sh.ps1 +++ b/automataCI/services/hestiaI18N/Vanilla.sh.ps1 @@ -33,20 +33,60 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null # Windows POWERSHELL Codes # ################################################################################ . "${env:LIBS_HESTIA}\hestiaI18N\Get_Languages_List.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Already-Latest-Version.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-All-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-All-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Bin-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Bin-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Docs-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Docs-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Config-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Config-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Lib-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Lib-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Main-Components-Description.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Main-Components-Title.sh.ps1" -. "${env:LIBS_HESTIA}\hestiaI18N\Translate-Only-Install-On-Windows.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_All_Components_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_All_Components_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Already_Latest_Version.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Assemble_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Bin_Component_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Bin_Component_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Availability.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Check_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Create_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Doc_Component_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Doc_Component_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Done.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Error.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Etc_Component_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Etc_Component_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Info.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Lib_Component_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Lib_Component_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Main_Component_Description.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Main_Component_Title.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Merge_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Note.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_OK.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Only_Install_On_Windows.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Package_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Publish_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Recreate_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Failed.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Simulate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Run_Skipped.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Success.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Translate_Warning.sh.ps1" ################################################################################ # Windows POWERSHELL Codes # ################################################################################ @@ -61,20 +101,60 @@ RUN_AS_POWERSHELL # Unix Main Codes # ################################################################################ . "${LIBS_HESTIA}/hestiaI18N/Get_Languages_List.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Already-Latest-Version.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-All-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-All-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Bin-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Bin-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Docs-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Docs-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Config-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Config-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Lib-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Lib-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Main-Components-Description.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Main-Components-Title.sh.ps1" -. "${LIBS_HESTIA}/hestiaI18N/Translate-Only-Install-On-Windows.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_All_Components_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_All_Components_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Already_Latest_Version.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Assemble_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Bin_Component_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Bin_Component_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Availability.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Check_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Create_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Doc_Component_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Doc_Component_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Done.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Error.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Etc_Component_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Etc_Component_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Info.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Lib_Component_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Lib_Component_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Main_Component_Description.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Main_Component_Title.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Merge_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Note.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_OK.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Only_Install_On_Windows.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Package_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Publish_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Recreate_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Failed.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Simulate.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Run_Skipped.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Success.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Translate_Warning.sh.ps1" ################################################################################ # Unix Main Codes # ################################################################################ diff --git a/automataCI/services/hestiaKERNEL/Error_Codes.sh.ps1 b/automataCI/services/hestiaKERNEL/Error_Codes.sh.ps1 new file mode 100644 index 0000000..9870650 --- /dev/null +++ b/automataCI/services/hestiaKERNEL/Error_Codes.sh.ps1 @@ -0,0 +1,621 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +${env:hestiaKERNEL_ERROR_OK} = 0 +${env:hestiaKERNEL_ERROR_BAD_EXEC} = 1 +${env:hestiaKERNEL_ERROR_BAD_BUSY} = 2 +${env:hestiaKERNEL_ERROR_BAD_DESCRIPTOR} = 3 +${env:hestiaKERNEL_ERROR_BAD_EXCHANGE} = 4 +${env:hestiaKERNEL_ERROR_BAD_MOUNT} = 5 +${env:hestiaKERNEL_ERROR_BAD_PIPE} = 6 +${env:hestiaKERNEL_ERROR_BAD_REQUEST} = 7 +${env:hestiaKERNEL_ERROR_BAD_STREAM_PIPE} = 8 +${env:hestiaKERNEL_ERROR_PROCESS_IS_DEAD} = 9 +${env:hestiaKERNEL_ERROR_CANCELLED} = 10 +${env:hestiaKERNEL_ERROR_CLEANING_REQUIRED} = 11 +${env:hestiaKERNEL_ERROR_DEADLOCK} = 12 +${env:hestiaKERNEL_ERROR_EXPIRED} = 13 +${env:hestiaKERNEL_ERROR_ILLEGAL_BYTE_SEQUENCE} = 14 +${env:hestiaKERNEL_ERROR_ILLEGAL_SEEK} = 15 +${env:hestiaKERNEL_ERROR_INVALID_ARGUMENT} = 16 +${env:hestiaKERNEL_ERROR_IS_EMPTY} = 17 +${env:hestiaKERNEL_ERROR_MAXED_EXCHANGE} = 18 +${env:hestiaKERNEL_ERROR_MAXED_QUOTA} = 19 +${env:hestiaKERNEL_ERROR_MISSING_LOCK} = 20 +${env:hestiaKERNEL_ERROR_IS_NOT_EMPTY} = 21 +${env:hestiaKERNEL_ERROR_NOT_PERMITTED} = 22 +${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} = 23 +${env:hestiaKERNEL_ERROR_NOT_POSSIBLE_BY_RFKILL} = 24 +${env:hestiaKERNEL_ERROR_NOT_RECOVERABLE} = 25 +${env:hestiaKERNEL_ERROR_OUT_OF_RANGE} = 26 +${env:hestiaKERNEL_ERROR_PERMISSION_DENIED} = 27 +${env:hestiaKERNEL_ERROR_TIMEOUT} = 28 +${env:hestiaKERNEL_ERROR_TOO_MANY_READ} = 29 +${env:hestiaKERNEL_ERROR_TOO_MANY_LOOP} = 30 +${env:hestiaKERNEL_ERROR_TOO_MANY_REFERENCES} = 31 +${env:hestiaKERNEL_ERROR_TOO_MANY_LINK} = 32 +${env:hestiaKERNEL_ERROR_TOO_MANY_OPENED} = 33 +${env:hestiaKERNEL_ERROR_TRY_AGAIN} = 34 +${env:hestiaKERNEL_ERROR_UNSUPPORTED} = 35 +${env:hestiaKERNEL_ERROR_WOULD_BLOCK} = 36 + + + + +# lifecycle states +${env:hestiaKERNEL_ERROR_RESTART} = 37 +${env:hestiaKERNEL_ERROR_RESUME} = 38 +${env:hestiaKERNEL_ERROR_SHUTDOWN} = 39 +${env:hestiaKERNEL_ERROR_SLEEP} = 40 +${env:hestiaKERNEL_ERROR_STALLED} = 41 +${env:hestiaKERNEL_ERROR_STANDBY} = 42 +${env:hestiaKERNEL_ERROR_UNRESPONSIVE} = 43 +${env:hestiaKERNEL_ERROR_TERMINATE} = 44 +${env:hestiaKERNEL_ERROR_PROGRESS_SCHEDULED} = 45 +${env:hestiaKERNEL_ERROR_PROGRESS_ALREADY_EXECUTING} = 46 +${env:hestiaKERNEL_ERROR_PROGRESS_EXECUTING} = 47 +${env:hestiaKERNEL_ERROR_PROGRESS_COMPLETED} = 48 +${env:hestiaKERNEL_ERROR_PROGRESS_UNRESPONSIVE} = 49 +${env:hestiaKERNEL_ERROR_PROGRESS_TERMINATE} = 50 + + + + +# tri-tier inter-package communications +${env:hestiaKERNEL_ERROR_LV1_NOT_SYNC} = 51 +${env:hestiaKERNEL_ERROR_LV1_PAUSED} = 52 +${env:hestiaKERNEL_ERROR_LV1_RESET} = 53 +${env:hestiaKERNEL_ERROR_LV2_NOT_SYNC} = 54 +${env:hestiaKERNEL_ERROR_LV2_PAUSED} = 55 +${env:hestiaKERNEL_ERROR_LV2_RESET} = 56 +${env:hestiaKERNEL_ERROR_LV3_NOT_SYNC} = 57 +${env:hestiaKERNEL_ERROR_LV3_PAUSED} = 58 +${env:hestiaKERNEL_ERROR_LV3_RESET} = 59 + + + + +# data (input/output parameters type etc) +${env:hestiaKERNEL_ERROR_DATA_BAD} = 60 +${env:hestiaKERNEL_ERROR_DATA_EMPTY} = 61 +${env:hestiaKERNEL_ERROR_DATA_INVALID} = 62 +${env:hestiaKERNEL_ERROR_DATA_IS_UNIQUE} = 63 +${env:hestiaKERNEL_ERROR_DATA_IS_NOT_UNIQUE} = 64 +${env:hestiaKERNEL_ERROR_DATA_BUSY} = 65 +${env:hestiaKERNEL_ERROR_DATA_DEAD} = 66 +${env:hestiaKERNEL_ERROR_DATA_EXISTS} = 67 +${env:hestiaKERNEL_ERROR_DATA_FAULTY} = 68 +${env:hestiaKERNEL_ERROR_DATA_MISSING} = 69 +${env:hestiaKERNEL_ERROR_DATA_OVERFLOW} = 70 +${env:hestiaKERNEL_ERROR_DATA_POISONED} = 71 +${env:hestiaKERNEL_ERROR_DATA_REMOVED} = 72 +${env:hestiaKERNEL_ERROR_DATA_TOO_BIG} = 73 +${env:hestiaKERNEL_ERROR_DATA_TOO_MANY_OPENED} = 74 +${env:hestiaKERNEL_ERROR_DATA_TOO_LONG} = 75 +${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} = 76 +${env:hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY} = 77 +${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} = 78 +${env:hestiaKERNEL_ERROR_DATA_IS_NOT_LINK} = 79 +${env:hestiaKERNEL_ERROR_DATA_IS_NOT_SOCKET} = 80 +${env:hestiaKERNEL_ERROR_DATA_REMOTE_CHANGED} = 81 +${env:hestiaKERNEL_ERROR_DATA_REMOTE_ERROR} = 82 +${env:hestiaKERNEL_ERROR_DATA_REMOTE_IO} = 83 +${env:hestiaKERNEL_ERROR_DATA_MISSING_STREAMABLE_RESOURCES} = 84 +${env:hestiaKERNEL_ERROR_DATA_NOT_STREAMABLE} = 85 + + + + +# entity (device file directory object etc) +${env:hestiaKERNEL_ERROR_ENTITY_BAD} = 86 +${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} = 87 +${env:hestiaKERNEL_ERROR_ENTITY_INVALID} = 88 +${env:hestiaKERNEL_ERROR_ENTITY_IS_UNIQUE} = 89 +${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_UNIQUE} = 90 +${env:hestiaKERNEL_ERROR_ENTITY_BUSY} = 91 +${env:hestiaKERNEL_ERROR_ENTITY_DEAD} = 92 +${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} = 93 +${env:hestiaKERNEL_ERROR_ENTITY_FAULTY} = 94 +${env:hestiaKERNEL_ERROR_ENTITY_MISSING} = 95 +${env:hestiaKERNEL_ERROR_ENTITY_MISSING_CHILD} = 96 +${env:hestiaKERNEL_ERROR_ENTITY_OUT_OF_BUFFER} = 97 +${env:hestiaKERNEL_ERROR_ENTITY_POISONED} = 98 +${env:hestiaKERNEL_ERROR_ENTITY_REMOVED} = 99 +${env:hestiaKERNEL_ERROR_ENTITY_TOO_BIG} = 100 +${env:hestiaKERNEL_ERROR_ENTITY_TOO_MANY_OPENED} = 101 +${env:hestiaKERNEL_ERROR_ENTITY_UNATTACHED} = 102 +${env:hestiaKERNEL_ERROR_ENTITY_MISMATCHED} = 103 +${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} = 104 +${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} = 105 +${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_LINK} = 106 +${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_SOCKET} = 107 +${env:hestiaKERNEL_ERROR_ENTITY_REMOTE_CHANGED} = 108 +${env:hestiaKERNEL_ERROR_ENTITY_REMOTE_ERROR} = 109 +${env:hestiaKERNEL_ERROR_ENTITY_REMOTE_IO} = 110 +${env:hestiaKERNEL_ERROR_ENTITY_MISSING_STREAMABLE_RESOURCES} = 111 +${env:hestiaKERNEL_ERROR_ENTITY_NOT_STREAMABLE} = 112 +${env:hestiaKERNEL_ERROR_ENTITY_STREAMABLE} = 113 +${env:hestiaKERNEL_ERROR_ENTITY_A_TYPEWRITER} = 114 +${env:hestiaKERNEL_ERROR_ENTITY_NOT_A_TYPEWRITER} = 115 +${env:hestiaKERNEL_ERROR_ENTITY_BAD_DESCRIPTOR} = 116 +${env:hestiaKERNEL_ERROR_ENTITY_FILETABLE_OVERFLOW} = 117 + + + + +# key (cryptography) +${env:hestiaKERNEL_ERROR_KEY_BAD} = 118 +${env:hestiaKERNEL_ERROR_KEY_DESTROYED} = 119 +${env:hestiaKERNEL_ERROR_KEY_EXPIRED} = 120 +${env:hestiaKERNEL_ERROR_KEY_MISSING} = 121 +${env:hestiaKERNEL_ERROR_KEY_REJECTED} = 122 +${env:hestiaKERNEL_ERROR_KEY_REVOKED} = 123 + + + + +# library +${env:hestiaKERNEL_ERROR_LIBRARY_BAD} = 124 +${env:hestiaKERNEL_ERROR_LIBRARY_CORRUPTED} = 125 +${env:hestiaKERNEL_ERROR_LIBRARY_EXEC_FAILED} = 126 +${env:hestiaKERNEL_ERROR_LIBRARY_MAXED} = 127 +${env:hestiaKERNEL_ERROR_LIBRARY_MISSING} = 128 + + + + +# network +${env:hestiaKERNEL_ERROR_NETWORK_BAD} = 129 +${env:hestiaKERNEL_ERROR_NETWORK_BAD_AD} = 130 +${env:hestiaKERNEL_ERROR_NETWORK_DOWN} = 131 +${env:hestiaKERNEL_ERROR_NETWORK_NOT_CONNECTED} = 132 +${env:hestiaKERNEL_ERROR_NETWORK_RESET} = 133 +${env:hestiaKERNEL_ERROR_NETWORK_RFS} = 134 +${env:hestiaKERNEL_ERROR_NETWORK_UNREACHABLE} = 135 + +${env:hestiaKERNEL_ERROR_NETWORK_HOST_DOWN} = 136 +${env:hestiaKERNEL_ERROR_NETWORK_HOST_UNREACHABLE} = 137 +${env:hestiaKERNEL_ERROR_NETWORK_SOCKET_UNSUPPORTED} = 138 + +${env:hestiaKERNEL_ERROR_NETWORK_ADDRESS_IN_USE} = 139 +${env:hestiaKERNEL_ERROR_NETWORK_ADDRESS_UNAVAILABLE} = 140 + +${env:hestiaKERNEL_ERROR_NETWORK_CONN_ABORTED} = 141 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_IS_CONNECTED} = 142 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_MISSING_DEST_ADDRESS} = 143 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_MULTIHOP} = 144 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_NOT_CONNECTED} = 145 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_REFUSED} = 146 +${env:hestiaKERNEL_ERROR_NETWORK_CONN_RESET} = 147 + +${env:hestiaKERNEL_ERROR_NETWORK_PAYLOAD_BAD} = 148 +${env:hestiaKERNEL_ERROR_NETWORK_PAYLOAD_EMPTY} = 149 +${env:hestiaKERNEL_ERROR_NETWORK_PAYLOAD_MISSING} = 150 +${env:hestiaKERNEL_ERROR_NETWORK_PAYLOAD_TOO_LONG} = 151 + + + + +# protocol +${env:hestiaKERNEL_ERROR_PROTOCOL_ADDRESS_UNSUPPORTED} = 152 +${env:hestiaKERNEL_ERROR_PROTOCOL_BAD} = 153 +${env:hestiaKERNEL_ERROR_PROTOCOL_FAMILY_UNSUPPORTED} = 154 +${env:hestiaKERNEL_ERROR_PROTOCOL_MISSING} = 155 +${env:hestiaKERNEL_ERROR_PROTOCOL_INVALID} = 156 +${env:hestiaKERNEL_ERROR_PROTOCOL_FAULTY} = 157 +${env:hestiaKERNEL_ERROR_PROTOCOL_EMPTY} = 158 +${env:hestiaKERNEL_ERROR_PROTOCOL_UNSUPPORTED} = 159 + + + + +# system (e.g. os interactable system) +${env:hestiaKERNEL_ERROR_SYSTEM_BAD_IO} = 160 +${env:hestiaKERNEL_ERROR_SYSTEM_DEVICE_CROSS_LINK} = 161 +${env:hestiaKERNEL_ERROR_SYSTEM_INTERRUPT_CALL} = 162 +${env:hestiaKERNEL_ERROR_SYSTEM_INVALID} = 163 +${env:hestiaKERNEL_ERROR_SYSTEM_MISSING_BLOCK_DEVICE} = 164 +${env:hestiaKERNEL_ERROR_SYSTEM_MISSING_DEVICE} = 165 +${env:hestiaKERNEL_ERROR_SYSTEM_MISSING_IO} = 166 +${env:hestiaKERNEL_ERROR_SYSTEM_MISSING_PROCESS} = 167 +${env:hestiaKERNEL_ERROR_SYSTEM_OUT_OF_DOMAIN} = 168 +${env:hestiaKERNEL_ERROR_SYSTEM_OUT_OF_MEMORY} = 169 +${env:hestiaKERNEL_ERROR_SYSTEM_OUT_OF_SPACE} = 170 +${env:hestiaKERNEL_ERROR_SYSTEM_READ_ONLY_FILESYSTEM} = 171 + + + + +# user +${env:hestiaKERNEL_ERROR_USER_ACCESS_BANNED} = 172 +${env:hestiaKERNEL_ERROR_USER_ACCESS_LOCKED} = 173 +${env:hestiaKERNEL_ERROR_USER_ACCESS_NOT_VERIFIED} = 174 +${env:hestiaKERNEL_ERROR_USER_ACCESS_BAD} = 175 +${env:hestiaKERNEL_ERROR_USER_ACCESS_REJECTED} = 176 +${env:hestiaKERNEL_ERROR_USER_ACCESS_REVOKED} = 177 +${env:hestiaKERNEL_ERROR_USER_ACCESS_EXISTS} = 178 +${env:hestiaKERNEL_ERROR_USER_ACCESS_EMPTY} = 179 +${env:hestiaKERNEL_ERROR_USER_ACCESS_MISSING} = 180 +${env:hestiaKERNEL_ERROR_USER_ACCESS_INVALID} = 181 +${env:hestiaKERNEL_ERROR_USER_ACCESS_EXPIRED} = 182 +${env:hestiaKERNEL_ERROR_USER_ACCESS_MISMATCHED} = 183 + +${env:hestiaKERNEL_ERROR_USER_MFA_BANNED} = 184 +${env:hestiaKERNEL_ERROR_USER_MFA_LOCKED} = 185 +${env:hestiaKERNEL_ERROR_USER_MFA_NOT_VERIFIED} = 186 +${env:hestiaKERNEL_ERROR_USER_MFA_BAD} = 188 +${env:hestiaKERNEL_ERROR_USER_MFA_REJECTED} = 189 +${env:hestiaKERNEL_ERROR_USER_MFA_REVOKED} = 190 +${env:hestiaKERNEL_ERROR_USER_MFA_EXISTS} = 191 +${env:hestiaKERNEL_ERROR_USER_MFA_EMPTY} = 192 +${env:hestiaKERNEL_ERROR_USER_MFA_MISSING} = 193 +${env:hestiaKERNEL_ERROR_USER_MFA_INVALID} = 194 +${env:hestiaKERNEL_ERROR_USER_MFA_EXPIRED} = 195 +${env:hestiaKERNEL_ERROR_USER_MFA_MISMATCHED} = 196 + +${env:hestiaKERNEL_ERROR_USER_ID_EXISTS} = 197 +${env:hestiaKERNEL_ERROR_USER_ID_BANNED} = 198 +${env:hestiaKERNEL_ERROR_USER_ID_BAD} = 199 +${env:hestiaKERNEL_ERROR_USER_ID_LOCKED} = 200 +${env:hestiaKERNEL_ERROR_USER_ID_NOT_VERIFIED} = 201 +${env:hestiaKERNEL_ERROR_USER_ID_EMPTY} = 202 +${env:hestiaKERNEL_ERROR_USER_ID_MISSING} = 203 +${env:hestiaKERNEL_ERROR_USER_ID_INVALID} = 204 +${env:hestiaKERNEL_ERROR_USER_ID_EXPIRED} = 205 +${env:hestiaKERNEL_ERROR_USER_ID_MISMATCHED} = 206 +${env:hestiaKERNEL_ERROR_USER_ID_DELETED} = 207 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_EXISTS} = 208 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_BANNED} = 209 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_BAD} = 210 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_REJECTED} = 211 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_REVOKED} = 212 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_EMPTY} = 213 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_MISSING} = 214 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_INVALID} = 215 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_EXPIRED} = 216 +${env:hestiaKERNEL_ERROR_USER_PASSWORD_MISMATCHED} = 217 +${env:hestiaKERNEL_ERROR_USER_KEY_EXISTS} = 218 +${env:hestiaKERNEL_ERROR_USER_KEY_BANNED} = 219 +${env:hestiaKERNEL_ERROR_USER_KEY_BAD} = 220 +${env:hestiaKERNEL_ERROR_USER_KEY_REJECTED} = 221 +${env:hestiaKERNEL_ERROR_USER_KEY_REVOKED} = 222 +${env:hestiaKERNEL_ERROR_USER_KEY_EMPTY} = 223 +${env:hestiaKERNEL_ERROR_USER_KEY_MISSING} = 224 +${env:hestiaKERNEL_ERROR_USER_KEY_INVALID} = 225 +${env:hestiaKERNEL_ERROR_USER_KEY_EXPIRED} = 226 +${env:hestiaKERNEL_ERROR_USER_KEY_MISMATCHED} = 227 +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +# standard errors +hestiaKERNEL_ERROR_OK=0 +hestiaKERNEL_ERROR_BAD_EXEC=1 +hestiaKERNEL_ERROR_BAD_BUSY=2 +hestiaKERNEL_ERROR_BAD_DESCRIPTOR=3 +hestiaKERNEL_ERROR_BAD_EXCHANGE=4 +hestiaKERNEL_ERROR_BAD_MOUNT=5 +hestiaKERNEL_ERROR_BAD_PIPE=6 +hestiaKERNEL_ERROR_BAD_REQUEST=7 +hestiaKERNEL_ERROR_BAD_STREAM_PIPE=8 +hestiaKERNEL_ERROR_PROCESS_IS_DEAD=9 +hestiaKERNEL_ERROR_CANCELLED=10 +hestiaKERNEL_ERROR_CLEANING_REQUIRED=11 +hestiaKERNEL_ERROR_DEADLOCK=12 +hestiaKERNEL_ERROR_EXPIRED=13 +hestiaKERNEL_ERROR_ILLEGAL_BYTE_SEQUENCE=14 +hestiaKERNEL_ERROR_ILLEGAL_SEEK=15 +hestiaKERNEL_ERROR_INVALID_ARGUMENT=16 +hestiaKERNEL_ERROR_IS_EMPTY=17 +hestiaKERNEL_ERROR_MAXED_EXCHANGE=18 +hestiaKERNEL_ERROR_MAXED_QUOTA=19 +hestiaKERNEL_ERROR_MISSING_LOCK=20 +hestiaKERNEL_ERROR_IS_NOT_EMPTY=21 +hestiaKERNEL_ERROR_NOT_PERMITTED=22 +hestiaKERNEL_ERROR_NOT_POSSIBLE=23 +hestiaKERNEL_ERROR_NOT_POSSIBLE_BY_RFKILL=24 +hestiaKERNEL_ERROR_NOT_RECOVERABLE=25 +hestiaKERNEL_ERROR_OUT_OF_RANGE=26 +hestiaKERNEL_ERROR_PERMISSION_DENIED=27 +hestiaKERNEL_ERROR_TIMEOUT=28 +hestiaKERNEL_ERROR_TOO_MANY_READ=29 +hestiaKERNEL_ERROR_TOO_MANY_LOOP=30 +hestiaKERNEL_ERROR_TOO_MANY_REFERENCES=31 +hestiaKERNEL_ERROR_TOO_MANY_LINK=32 +hestiaKERNEL_ERROR_TOO_MANY_OPENED=33 +hestiaKERNEL_ERROR_TRY_AGAIN=34 +hestiaKERNEL_ERROR_UNSUPPORTED=35 +hestiaKERNEL_ERROR_WOULD_BLOCK=36 + + + + +# lifecycle states +hestiaKERNEL_ERROR_RESTART=37 +hestiaKERNEL_ERROR_RESUME=38 +hestiaKERNEL_ERROR_SHUTDOWN=39 +hestiaKERNEL_ERROR_SLEEP=40 +hestiaKERNEL_ERROR_STALLED=41 +hestiaKERNEL_ERROR_STANDBY=42 +hestiaKERNEL_ERROR_UNRESPONSIVE=43 +hestiaKERNEL_ERROR_TERMINATE=44 +hestiaKERNEL_ERROR_PROGRESS_SCHEDULED=45 +hestiaKERNEL_ERROR_PROGRESS_ALREADY_EXECUTING=46 +hestiaKERNEL_ERROR_PROGRESS_EXECUTING=47 +hestiaKERNEL_ERROR_PROGRESS_COMPLETED=48 +hestiaKERNEL_ERROR_PROGRESS_UNRESPONSIVE=49 +hestiaKERNEL_ERROR_PROGRESS_TERMINATE=50 + + + + +# tri-tier inter-package communications +hestiaKERNEL_ERROR_LV1_NOT_SYNC=51 +hestiaKERNEL_ERROR_LV1_PAUSED=52 +hestiaKERNEL_ERROR_LV1_RESET=53 +hestiaKERNEL_ERROR_LV2_NOT_SYNC=54 +hestiaKERNEL_ERROR_LV2_PAUSED=55 +hestiaKERNEL_ERROR_LV2_RESET=56 +hestiaKERNEL_ERROR_LV3_NOT_SYNC=57 +hestiaKERNEL_ERROR_LV3_PAUSED=58 +hestiaKERNEL_ERROR_LV3_RESET=59 + + + + +# data (input/output parameters type etc) +hestiaKERNEL_ERROR_DATA_BAD=60 +hestiaKERNEL_ERROR_DATA_EMPTY=61 +hestiaKERNEL_ERROR_DATA_INVALID=62 +hestiaKERNEL_ERROR_DATA_IS_UNIQUE=63 +hestiaKERNEL_ERROR_DATA_IS_NOT_UNIQUE=64 +hestiaKERNEL_ERROR_DATA_BUSY=65 +hestiaKERNEL_ERROR_DATA_DEAD=66 +hestiaKERNEL_ERROR_DATA_EXISTS=67 +hestiaKERNEL_ERROR_DATA_FAULTY=68 +hestiaKERNEL_ERROR_DATA_MISSING=69 +hestiaKERNEL_ERROR_DATA_OVERFLOW=70 +hestiaKERNEL_ERROR_DATA_POISONED=71 +hestiaKERNEL_ERROR_DATA_REMOVED=72 +hestiaKERNEL_ERROR_DATA_TOO_BIG=73 +hestiaKERNEL_ERROR_DATA_TOO_MANY_OPENED=74 +hestiaKERNEL_ERROR_DATA_TOO_LONG=75 +hestiaKERNEL_ERROR_DATA_MISMATCHED=76 +hestiaKERNEL_ERROR_DATA_IS_NOT_DIRECTORY=77 +hestiaKERNEL_ERROR_DATA_IS_NOT_FILE=78 +hestiaKERNEL_ERROR_DATA_IS_NOT_LINK=79 +hestiaKERNEL_ERROR_DATA_IS_NOT_SOCKET=80 +hestiaKERNEL_ERROR_DATA_REMOTE_CHANGED=81 +hestiaKERNEL_ERROR_DATA_REMOTE_ERROR=82 +hestiaKERNEL_ERROR_DATA_REMOTE_IO=83 +hestiaKERNEL_ERROR_DATA_MISSING_STREAMABLE_RESOURCES=84 +hestiaKERNEL_ERROR_DATA_NOT_STREAMABLE=85 + + + + +# entity (device file directory object etc) +hestiaKERNEL_ERROR_ENTITY_BAD=86 +hestiaKERNEL_ERROR_ENTITY_EMPTY=87 +hestiaKERNEL_ERROR_ENTITY_INVALID=88 +hestiaKERNEL_ERROR_ENTITY_IS_UNIQUE=89 +hestiaKERNEL_ERROR_ENTITY_IS_NOT_UNIQUE=90 +hestiaKERNEL_ERROR_ENTITY_BUSY=91 +hestiaKERNEL_ERROR_ENTITY_DEAD=92 +hestiaKERNEL_ERROR_ENTITY_EXISTS=93 +hestiaKERNEL_ERROR_ENTITY_FAULTY=94 +hestiaKERNEL_ERROR_ENTITY_MISSING=95 +hestiaKERNEL_ERROR_ENTITY_MISSING_CHILD=96 +hestiaKERNEL_ERROR_ENTITY_OUT_OF_BUFFER=97 +hestiaKERNEL_ERROR_ENTITY_POISONED=98 +hestiaKERNEL_ERROR_ENTITY_REMOVED=99 +hestiaKERNEL_ERROR_ENTITY_TOO_BIG=100 +hestiaKERNEL_ERROR_ENTITY_TOO_MANY_OPENED=101 +hestiaKERNEL_ERROR_ENTITY_UNATTACHED=102 +hestiaKERNEL_ERROR_ENTITY_MISMATCHED=103 +hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY=104 +hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE=105 +hestiaKERNEL_ERROR_ENTITY_IS_NOT_LINK=106 +hestiaKERNEL_ERROR_ENTITY_IS_NOT_SOCKET=107 +hestiaKERNEL_ERROR_ENTITY_REMOTE_CHANGED=108 +hestiaKERNEL_ERROR_ENTITY_REMOTE_ERROR=109 +hestiaKERNEL_ERROR_ENTITY_REMOTE_IO=110 +hestiaKERNEL_ERROR_ENTITY_MISSING_STREAMABLE_RESOURCES=111 +hestiaKERNEL_ERROR_ENTITY_NOT_STREAMABLE=112 +hestiaKERNEL_ERROR_ENTITY_STREAMABLE=113 +hestiaKERNEL_ERROR_ENTITY_A_TYPEWRITER=114 +hestiaKERNEL_ERROR_ENTITY_NOT_A_TYPEWRITER=115 +hestiaKERNEL_ERROR_ENTITY_BAD_DESCRIPTOR=116 +hestiaKERNEL_ERROR_ENTITY_FILETABLE_OVERFLOW=117 + + + + +# key (cryptography) +hestiaKERNEL_ERROR_KEY_BAD=118 +hestiaKERNEL_ERROR_KEY_DESTROYED=119 +hestiaKERNEL_ERROR_KEY_EXPIRED=120 +hestiaKERNEL_ERROR_KEY_MISSING=121 +hestiaKERNEL_ERROR_KEY_REJECTED=122 +hestiaKERNEL_ERROR_KEY_REVOKED=123 + + + + +# library +hestiaKERNEL_ERROR_LIBRARY_BAD=124 +hestiaKERNEL_ERROR_LIBRARY_CORRUPTED=125 +hestiaKERNEL_ERROR_LIBRARY_EXEC_FAILED=126 +hestiaKERNEL_ERROR_LIBRARY_MAXED=127 +hestiaKERNEL_ERROR_LIBRARY_MISSING=128 + + + + +# network +hestiaKERNEL_ERROR_NETWORK_BAD=129 +hestiaKERNEL_ERROR_NETWORK_BAD_AD=130 +hestiaKERNEL_ERROR_NETWORK_DOWN=131 +hestiaKERNEL_ERROR_NETWORK_NOT_CONNECTED=132 +hestiaKERNEL_ERROR_NETWORK_RESET=133 +hestiaKERNEL_ERROR_NETWORK_RFS=134 +hestiaKERNEL_ERROR_NETWORK_UNREACHABLE=135 + +hestiaKERNEL_ERROR_NETWORK_HOST_DOWN=136 +hestiaKERNEL_ERROR_NETWORK_HOST_UNREACHABLE=137 +hestiaKERNEL_ERROR_NETWORK_SOCKET_UNSUPPORTED=138 + +hestiaKERNEL_ERROR_NETWORK_ADDRESS_IN_USE=139 +hestiaKERNEL_ERROR_NETWORK_ADDRESS_UNAVAILABLE=140 + +hestiaKERNEL_ERROR_NETWORK_CONN_ABORTED=141 +hestiaKERNEL_ERROR_NETWORK_CONN_IS_CONNECTED=142 +hestiaKERNEL_ERROR_NETWORK_CONN_MISSING_DEST_ADDRESS=143 +hestiaKERNEL_ERROR_NETWORK_CONN_MULTIHOP=144 +hestiaKERNEL_ERROR_NETWORK_CONN_NOT_CONNECTED=145 +hestiaKERNEL_ERROR_NETWORK_CONN_REFUSED=146 +hestiaKERNEL_ERROR_NETWORK_CONN_RESET=147 + +hestiaKERNEL_ERROR_NETWORK_PAYLOAD_BAD=148 +hestiaKERNEL_ERROR_NETWORK_PAYLOAD_EMPTY=149 +hestiaKERNEL_ERROR_NETWORK_PAYLOAD_MISSING=150 +hestiaKERNEL_ERROR_NETWORK_PAYLOAD_TOO_LONG=151 + + + + +# protocol +hestiaKERNEL_ERROR_PROTOCOL_ADDRESS_UNSUPPORTED=152 +hestiaKERNEL_ERROR_PROTOCOL_BAD=153 +hestiaKERNEL_ERROR_PROTOCOL_FAMILY_UNSUPPORTED=154 +hestiaKERNEL_ERROR_PROTOCOL_MISSING=155 +hestiaKERNEL_ERROR_PROTOCOL_INVALID=156 +hestiaKERNEL_ERROR_PROTOCOL_FAULTY=157 +hestiaKERNEL_ERROR_PROTOCOL_EMPTY=158 +hestiaKERNEL_ERROR_PROTOCOL_UNSUPPORTED=159 + + + + +# system (e.g. os interactable system) +hestiaKERNEL_ERROR_SYSTEM_BAD_IO=160 +hestiaKERNEL_ERROR_SYSTEM_DEVICE_CROSS_LINK=161 +hestiaKERNEL_ERROR_SYSTEM_INTERRUPT_CALL=162 +hestiaKERNEL_ERROR_SYSTEM_INVALID=163 +hestiaKERNEL_ERROR_SYSTEM_MISSING_BLOCK_DEVICE=164 +hestiaKERNEL_ERROR_SYSTEM_MISSING_DEVICE=165 +hestiaKERNEL_ERROR_SYSTEM_MISSING_IO=166 +hestiaKERNEL_ERROR_SYSTEM_MISSING_PROCESS=167 +hestiaKERNEL_ERROR_SYSTEM_OUT_OF_DOMAIN=168 +hestiaKERNEL_ERROR_SYSTEM_OUT_OF_MEMORY=169 +hestiaKERNEL_ERROR_SYSTEM_OUT_OF_SPACE=170 +hestiaKERNEL_ERROR_SYSTEM_READ_ONLY_FILESYSTEM=171 + + + + +# user +hestiaKERNEL_ERROR_USER_ACCESS_BANNED=172 +hestiaKERNEL_ERROR_USER_ACCESS_LOCKED=173 +hestiaKERNEL_ERROR_USER_ACCESS_NOT_VERIFIED=174 +hestiaKERNEL_ERROR_USER_ACCESS_BAD=175 +hestiaKERNEL_ERROR_USER_ACCESS_REJECTED=176 +hestiaKERNEL_ERROR_USER_ACCESS_REVOKED=177 +hestiaKERNEL_ERROR_USER_ACCESS_EXISTS=178 +hestiaKERNEL_ERROR_USER_ACCESS_EMPTY=179 +hestiaKERNEL_ERROR_USER_ACCESS_MISSING=180 +hestiaKERNEL_ERROR_USER_ACCESS_INVALID=181 +hestiaKERNEL_ERROR_USER_ACCESS_EXPIRED=182 +hestiaKERNEL_ERROR_USER_ACCESS_MISMATCHED=183 + +hestiaKERNEL_ERROR_USER_MFA_BANNED=184 +hestiaKERNEL_ERROR_USER_MFA_LOCKED=185 +hestiaKERNEL_ERROR_USER_MFA_NOT_VERIFIED=186 +hestiaKERNEL_ERROR_USER_MFA_BAD=188 +hestiaKERNEL_ERROR_USER_MFA_REJECTED=189 +hestiaKERNEL_ERROR_USER_MFA_REVOKED=190 +hestiaKERNEL_ERROR_USER_MFA_EXISTS=191 +hestiaKERNEL_ERROR_USER_MFA_EMPTY=192 +hestiaKERNEL_ERROR_USER_MFA_MISSING=193 +hestiaKERNEL_ERROR_USER_MFA_INVALID=194 +hestiaKERNEL_ERROR_USER_MFA_EXPIRED=195 +hestiaKERNEL_ERROR_USER_MFA_MISMATCHED=196 + +hestiaKERNEL_ERROR_USER_ID_EXISTS=197 +hestiaKERNEL_ERROR_USER_ID_BANNED=198 +hestiaKERNEL_ERROR_USER_ID_BAD=199 +hestiaKERNEL_ERROR_USER_ID_LOCKED=200 +hestiaKERNEL_ERROR_USER_ID_NOT_VERIFIED=201 +hestiaKERNEL_ERROR_USER_ID_EMPTY=202 +hestiaKERNEL_ERROR_USER_ID_MISSING=203 +hestiaKERNEL_ERROR_USER_ID_INVALID=204 +hestiaKERNEL_ERROR_USER_ID_EXPIRED=205 +hestiaKERNEL_ERROR_USER_ID_MISMATCHED=206 +hestiaKERNEL_ERROR_USER_ID_DELETED=207 + +hestiaKERNEL_ERROR_USER_PASSWORD_EXISTS=208 +hestiaKERNEL_ERROR_USER_PASSWORD_BANNED=209 +hestiaKERNEL_ERROR_USER_PASSWORD_BAD=210 +hestiaKERNEL_ERROR_USER_PASSWORD_REJECTED=211 +hestiaKERNEL_ERROR_USER_PASSWORD_REVOKED=212 +hestiaKERNEL_ERROR_USER_PASSWORD_EMPTY=213 +hestiaKERNEL_ERROR_USER_PASSWORD_MISSING=214 +hestiaKERNEL_ERROR_USER_PASSWORD_INVALID=215 +hestiaKERNEL_ERROR_USER_PASSWORD_EXPIRED=216 +hestiaKERNEL_ERROR_USER_PASSWORD_MISMATCHED=217 + +hestiaKERNEL_ERROR_USER_KEY_EXISTS=218 +hestiaKERNEL_ERROR_USER_KEY_BANNED=219 +hestiaKERNEL_ERROR_USER_KEY_BAD=220 +hestiaKERNEL_ERROR_USER_KEY_REJECTED=221 +hestiaKERNEL_ERROR_USER_KEY_REVOKED=222 +hestiaKERNEL_ERROR_USER_KEY_EMPTY=223 +hestiaKERNEL_ERROR_USER_KEY_MISSING=224 +hestiaKERNEL_ERROR_USER_KEY_INVALID=225 +hestiaKERNEL_ERROR_USER_KEY_EXPIRED=226 +hestiaKERNEL_ERROR_USER_KEY_MISMATCHED=227 +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1 b/automataCI/services/hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1 new file mode 100644 index 0000000..9c2c2a0 --- /dev/null +++ b/automataCI/services/hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1 @@ -0,0 +1,339 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaKERNEL-Run-Parallel-Sentinel { + param( + [string]$____parallel_command, + [string]$____parallel_control_directory, + [string]$____parallel_available + ) + + + # validate input + if ([string]::IsNullOrEmpty($____parallel_command)) { + return 61 # data is empty + } + + if ([string]::IsNullOrEmpty($____parallel_control_directory)) { + return 87 # entity is empty + } + + if (-not (Test-Path -PathType Container -Path $____parallel_control_directory)) { + return 104 # entity is not directory + } + + $____parallel_control = "${____parallel_control_directory}\control.txt" + if (-not (Test-Path -PathType Leaf -Path $____parallel_control)) { + return 88 # entity is invalid + } + + try { + if ( + ([string]::IsNullOrEmpty($____parallel_available)) -or + ($____parallel_available -le 0) + ) { + $____parallel_available = [System.Environment]::ProcessorCount + if ($____parallel_available -le 0) { + $____parallel_available = 1 + } + } + } catch { + $____parallel_available = [System.Environment]::ProcessorCount + if ($____parallel_available -le 0) { + $____parallel_available = 1 + } + } + + + # execute + $____parallel_flags = "${____parallel_control_directory}\flags" + $____parallel_total = 0 + + + # scan total tasks + foreach ($____line in (Get-Content $____parallel_control)) { + $____parallel_total += 1 + } + + + # bail early if no task is available + if ($____parallel_total -le 0) { + return 0 # ok + } + + + # run in singular when only 1 task is required + if ( + ($____parallel_available -le 1) -or + ($____parallel_total -eq 1) + ) { + ${function:SYNC-Run} = $___parallel_command + foreach ($____line in (Get-Content $____parallel_control)) { + $____process = SYNC-Run $____line + if ($____process -ne 0) { + return 1 # bad exec + } + + + # report status + return 0 # ok + } + } + + + # run in parallel + $____jobs = @() + $____line_number = 0 + foreach ($____line in (Get-Content $____parallel_control)) { + $____line_number += 1 + + $____jobs += Start-ThreadJob -ScriptBlock { + $____parallel_flag = "${using:____parallel_flags}\l${using:____line_number}" + + + # secure parallel working lock + $null = New-Item -ItemType Directory ` + -Force ` + -Path "${____parallel_flag}_working" + + + # initiate parallel execution + ${function:SYNC-Run} = ${using:____parallel_command} + $____process = SYNC-Run ${using:____line} + + try { + $null = Remove-Item ` + -Recurse ` + -Force ` + -Path "${____parallel_flag}_working" + } catch { + $____process = 1 + } + + switch ($____process) { + 0 { + $null = New-Item -ItemType Directory ` + -Force ` + -Path "${____parallel_flag}_done" + return 0 # ok + } default { + $null = New-Item -ItemType Directory ` + -Force ` + -Path "${____parallel_flag}_error" + return 1 # bad exec + }} + } + } + + $null = Wait-Job -Job $____jobs + foreach ($____job in $____jobs) { + $____process = Receive-Job -Job $____job + if ($____process -ne 0) { + return 1 # bad exec + } + } + + + # report status + return 0 # ok +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaKERNEL_Run_Parallel_Sentinel() { + ____parallel_command="$1" + ____parallel_control_directory="$2" + ____parallel_available="$3" + + + # validate input + if [ -z "$____parallel_command" ]; then + return 61 # data is empty + fi + + if [ -z "$____parallel_control_directory" ]; then + return 87 # entity is empty + fi + + if [ ! -d "$____parallel_control_directory" ]; then + return 104 # entity is not directory + fi + + ____parallel_control="${____parallel_control_directory}/control.txt" + if [ ! -f "$____parallel_control" ]; then + return 88 # entity is invalid + fi + + if [ -z "$____parallel_available" ]; then + ____parallel_available=$(getconf _NPROCESSORS_ONLN) + fi + + + # execute + ____parallel_flags="${____parallel_control_directory}/flags" + ____parallel_total=0 + + + # scan total tasks + ____old_IFS="$IFS" + while IFS= read -r ____line || [ -n "$____line" ]; do + ____parallel_total=$(($____parallel_total + 1)) + done < "$____parallel_control" + IFS="$____old_IFS" && unset ____old_IFS + + + # bail early if no task is available + if [ $____parallel_total -le 0 ]; then + return 0 # ok + fi + + + # run in singular when only 1 task is required + if [ $____parallel_available -le 1 ] || [ $____parallel_total -eq 1 ]; then + ____old_IFS="$IFS" + while IFS= read -r ____line || [ -n "$____line" ]; do + "$____parallel_command" "$____line" + if [ $? -ne 0 ]; then + return 1 # bad exec + fi + done < "$____parallel_control" + IFS="$____old_IFS" && unset ____old_IFS + + + # report status + return 0 # ok + fi + + + # run in parallel + ____parallel_error=0 + ____parallel_done=0 + rm -rf "$____parallel_flags" &> /dev/null + mkdir -p "$____parallel_flags" &> /dev/null + while [ $____parallel_done -ne $____parallel_total ]; do + ____parallel_done=0 + ____parallel_current=0 + ____parallel_working=0 + + + # scan state + ____line_number=0 + ____old_IFS="$IFS" + while IFS= read -r ____line || [ -n "$____line" ]; do + ____line_number=$(($____line_number + 1)) + ____parallel_flag="${____parallel_flags}/l${____line_number}" + + + # skip if error flag is found + if [ -d "${____parallel_flag}_error" ]; then + ____parallel_error=$(($____parallel_error + 1)) + continue + fi + + + # skip if working flag is found + if [ -d "${____parallel_flag}_working" ]; then + ____parallel_working=$(($____parallel_working + 1)) + ____parallel_current=$(($____parallel_current + 1)) + continue + fi + + + # break entire scan when run is completed + if [ $____parallel_done -ge $____parallel_total ]; then + break + fi + + + # skip if done flag is found + if [ -d "${____parallel_flag}_done" ]; then + ____parallel_done=$(($____parallel_done + 1)) + ____parallel_current=$(($____parallel_current + 1)) + continue + fi + + + # it's a working state + if [ $____parallel_working -lt $____parallel_available ]; then + # secure parallel working lock + mkdir -p "${____parallel_flag}_working" + ____parallel_working=$(($____parallel_working + 1)) + + + # initiate parallel execution + { + "$____parallel_command" $____line + case $? in + 0) + mkdir -p "${____parallel_flag}_done" + ;; + *) + mkdir -p "${____parallel_flag}_error" + ;; + esac + rm -rf "${____parallel_flag}_working" &> /dev/null + } & + fi + + ____parallel_current=$(($____parallel_current + 1)) + done < "$____parallel_control" + IFS="$____old_IFS" && unset ____old_IFS + + + # stop the entire operation if error is detected and no more + # running tasks + if [ $____parallel_error -gt 0 ] && [ $____parallel_working -eq 0 ]; then + return 1 # bad exec + fi + done + + + # report status + return 0 # ok +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaKERNEL/Vanilla.sh.ps1 b/automataCI/services/hestiaKERNEL/Vanilla.sh.ps1 new file mode 100644 index 0000000..1649184 --- /dev/null +++ b/automataCI/services/hestiaKERNEL/Vanilla.sh.ps1 @@ -0,0 +1,56 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Run_Parallel_Sentinel.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Run_Parallel_Sentinel.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 b/automataCI/services/hestiaLOCALE/Get_LCID.sh.ps1 old mode 100755 new mode 100644 similarity index 79% rename from automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 rename to automataCI/services/hestiaLOCALE/Get_LCID.sh.ps1 index 72d2291..dbaab0d --- a/automataCI/services/hestiaLOCALE/Get-LCID.sh.ps1 +++ b/automataCI/services/hestiaLOCALE/Get_LCID.sh.ps1 @@ -35,30 +35,26 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ## More Info: ## https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/70feba9f-294e-491e-b6eb-56532684c37f function hestiaLOCALE-Get-LCID { - param( - [string]$___locale - ) - - - # execute - switch ("${___locale}") { - "en" { - return 9 - } { $_ -in "en-US", "en-us" } { - return 1033 - } "zh" { - return 30724 - } { $_ -in "zh-CN", "zh-cn" } { - return 2052 - } { $_ -in "zh-Hans", "zh-hans" } { - return 4 - } default { - return - }} - - - # report status - return 0 + param( + [string]$___locale + ) + + + # execute + switch ($___locale) { + "en" { + return 9 + } { $_ -in "en-US", "en-us" } { + return 1033 + } "zh" { + return 30724 + } { $_ -in "zh-CN", "zh-cn" } { + return 2052 + } { $_ -in "zh-Hans", "zh-hans" } { + return 4 + } default { + return 0 + }} } ################################################################################ # Windows POWERSHELL Codes # @@ -82,29 +78,25 @@ hestiaLOCALE_Get_LCID() { # execute case "$1" in en) - printf -- "9" + printf -- "%d" 9 ;; en-US|en-us) - printf -- "1033" + printf -- "%d" 1033 ;; zh) - printf -- "30724" + printf -- "%d" 30724 ;; zh-CN|zh-cn) - printf -- "2052" + printf -- "%d" 2052 ;; zh-Hans|zh-hans) - printf -- "4" + printf -- "%d" 4 ;; *) - printf -- "" - return 1 + printf -- "%d" 0 + return 0 ;; esac - - - # report status - return 0 } ################################################################################ # Unix Main Codes # diff --git a/automataCI/services/hestiaLOCALE/Get_Lang.sh.ps1 b/automataCI/services/hestiaLOCALE/Get_Lang.sh.ps1 new file mode 100644 index 0000000..ea2bd80 --- /dev/null +++ b/automataCI/services/hestiaLOCALE/Get_Lang.sh.ps1 @@ -0,0 +1,105 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaLOCALE-Get-Lang { + param ( + [string]$___lang + ) + + + # execute + if (-not [string]::IsNullOrEmpty($___lang)) { + return $___lang + } elseif (-not [string]::IsNullOrEmpty(${env:PROJECT_LANG})) { + return "${env:PROJECT_LANG}" + } elseif (-not [string]::IsNullOrEmpty(${env:AUTOMATACI_LANG})) { + return "${env:AUTOMATACI_LANG}" # compatible with AutomataCI + } + + + # fallback to getting from system settings + $___lang = Get-WinSystemLocale + $___lang = $___lang -replace '[_-][A-Z]*$', '' + $___lang = $___lang -replace '_', '-' + return $___lang +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaLOCALE_Get_Lang() { + #___lang="$1" + + + # execute + if [ ! "$1" = "" ]; then + printf -- "%s" "$1" + return 0 + elif [ ! "$PROJECT_LANG" = "" ]; then + printf -- "%s" "$PROJECT_LANG" + return 0 + elif [ ! "$AUTOMATACI_LANG" = "" ]; then + printf -- "%s" "$AUTOMATACI_LANG" # comaptible with AutomataCI + return 0 + fi + + + # fallback to getting from system settings + ___lang="${LC_ALL:$LANG}" + ___lang="${___lang%.*}" + ___lang="${___lang%_[A-Z]*}" + ___lang="$(printf -- "%b" "$___lang" | tr '_' '-')" + if [ "$___lang" = "C" ] || [ "$___lang" = "" ]; then + ___lang="en" # fallback to english then + fi + printf -- "%s" "$___lang" + + + # report status + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 b/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 old mode 100755 new mode 100644 index eda087c..95df664 --- a/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 +++ b/automataCI/services/hestiaLOCALE/Vanilla.sh.ps1 @@ -32,7 +32,8 @@ echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null ################################################################################ # Windows POWERSHELL Codes # ################################################################################ -. "${env:LIBS_HESTIA}\hestiaLOCALE\Get-LCID.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_Lang.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_LCID.sh.ps1" ################################################################################ # Windows POWERSHELL Codes # ################################################################################ @@ -46,7 +47,8 @@ RUN_AS_POWERSHELL ################################################################################ # Unix Main Codes # ################################################################################ -. "${LIBS_HESTIA}/hestiaLOCALE/Get-LCID.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_Lang.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_LCID.sh.ps1" ################################################################################ # Unix Main Codes # ################################################################################ diff --git a/automataCI/services/hestiaMSI/Compile.sh.ps1 b/automataCI/services/hestiaMSI/Compile.sh.ps1 new file mode 100644 index 0000000..09f5cca --- /dev/null +++ b/automataCI/services/hestiaMSI/Compile.sh.ps1 @@ -0,0 +1,175 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Get_Culture.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\To_Arch_MSFT.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaMSI-Compile { + param ( + [string]$___wxs, + [string]$___arch, + [string]$___lang, + [string]$___dotnet_directory + ) + + + # validate input + if ($(hestiaMSI-Is-Available $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___wxs) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___wxs) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + $___arch = hestiaOS-To-Arch-MSFT $___arch + if ($(hestiaSTRING-Is-Empty $___arch) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} + } + + $___lang = hestiaMSI-Get-Culture $___lang + if ($(hestiaSTRING-Is-Empty $___lang) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} + } + + + # execute + $___arguments = @" +build -arch ${___arch} -culture ${___lang} -out `"$(hestiaFS-Replace-Extension "${___target}" ".wxs" ".msi")`" +"@ + + foreach ($___ext in ( + Get-ChildItem -File ` + -Path "$(hestiaFS-Get-Directory $___wxs)" ` + -Filter "*.dll" + )) { + $___arguments += " -ext ${___ext}" + } + $___arguments += " ${___wxs}" + + $___process = hestiaOS-Exec "wix" $___arguments + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/To_Arch_MSFT.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaMSI_Compile() { + #___wxs="$1" + #___arch="$2" + + + # validate input + if [ $(hestiaMSI_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + ___arch="$(hestiaOS_To_Arch_MSFT "$2")" + if [ $(hestiaSTRING_Is_Empty "$___arch") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISMATCHED + fi + + for ___file in "$(hestiaFS_Get_Directory "$1")/"*; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + if [ ! "${___file%%.dll*}" = "$___file" ]; then + ___ext="${___ext} --ext \"${___file}\"" + fi + done + + + # execute + wixl --verbose \ + --arch "${___arch}" \ + ${___ext} \ + --output "$(hestiaFS_Replace_Extension "$1" ".wxs" ".msi")" \ + "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Get_Culture.sh.ps1 b/automataCI/services/hestiaMSI/Get_Culture.sh.ps1 new file mode 100644 index 0000000..2719b92 --- /dev/null +++ b/automataCI/services/hestiaMSI/Get_Culture.sh.ps1 @@ -0,0 +1,283 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\To_Lowercase.sh.ps1" + + + + +function hestiaMSI-Get-Culture { + param ( + [string]$___lang + ) + + + # execute + # IMPORTANT NOTICE: this is a temporary function for handling WiX's + # localization bug. More info: + # (1) https://github.com/wixtoolset/issues/issues/7896 + # (2) https://wixtoolset.org/docs/tools/wixext/wixui/#translated-strings + switch (hestiaSTRING-To-Lowercase $___lang) { + "ar" { + return "ar-SA" + } "bg" { + return "bg-BG" + } "ca" { + return "ca-ES" + } "cs" { + return "cs-CZ" + } "da" { + return "da-DK" + } "de" { + return "de-DE" + } "el" { + return "el-GR" + } "en" { + return "en-US" + } "es" { + return "es-ES" + } "et" { + return "et-EE" + } "fi" { + return "fi-FI" + } "fr" { + return "fr-FR" + } "he" { + return "he-IL" + } "hi" { + return "hi-IN" + } "hr" { + return "hr-HR" + } "hu" { + return "hu-HU" + } "it" { + return "it-IT" + } "ja" { + return "ja-JP" + } "kk" { + return "kk-KZ" + } "ko" { + return "ko-KR" + } "lt" { + return "lt-LT" + } "lv" { + return "lv-LV" + } "nb" { + return "nb-NO" + } "nl" { + return "nl-NL" + } "pl" { + return "pl-PL" + } "pt" { + return "pt-PT" + } "ro" { + return "ro-RO" + } "ru" { + return "ru-RU" + } "sk" { + return "sk-SK" + } "sl" { + return "sl-SI" + } "sq" { + return "sq-AL" + } "sr" { + return "sr-Latn-RS" + } "sv" { + return "sv-SE" + } "th" { + return "th-TH" + } "tr" { + return "tr-TR" + } "uk" { + return "uk-UA" + } "zh-hant" { + return "zh-TW" + } { $_ -in "zh", "zh-hans" } { + return "zh-CN" + } default { + return "" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaSTRING/To_Lowercase.sh.ps1" + + + + +hestiaMSI_Get_Culture() { + #___lang="$1" + + + # execute + # IMPORTANT NOTICE: this is a temporary function for handling WiX's + # localization bug. More info: + # (1) https://github.com/wixtoolset/issues/issues/7896 + # (2) https://wixtoolset.org/docs/tools/wixext/wixui/#translated-strings + case "$(hestiaSTRING_To_Lowercase "$1")" in + ar) + printf -- "%s" "ar-SA" + ;; + bg) + printf -- "%s" "bg-BG" + ;; + ca) + printf -- "%s" "ca-ES" + ;; + cs) + printf -- "%s" "cs-CZ" + ;; + da) + printf -- "%s" "da-DK" + ;; + de) + printf -- "%s" "de-DE" + ;; + el) + printf -- "%s" "el-GR" + ;; + en) + printf -- "%s" "en-US" + ;; + es) + printf -- "%s" "es-ES" + ;; + et) + printf -- "%s" "et-EE" + ;; + fi) + printf -- "%s" "fi-FI" + ;; + fr) + printf -- "%s" "fr-FR" + ;; + he) + printf -- "%s" "he-IL" + ;; + hi) + printf -- "%s" "hi-IN" + ;; + hr) + printf -- "%s" "hr-HR" + ;; + hu) + printf -- "%s" "hu-HU" + ;; + it) + printf -- "%s" "it-IT" + ;; + ja) + printf -- "%s" "ja-JP" + ;; + kk) + printf -- "%s" "kk-KZ" + ;; + ko) + printf -- "%s" "ko-KR" + ;; + lt) + printf -- "%s" "lt-LT" + ;; + lv) + printf -- "%s" "lv-LV" + ;; + nb) + printf -- "%s" "nb-NO" + ;; + nl) + printf -- "%s" "nl-NL" + ;; + pl) + printf -- "%s" "pl-PL" + ;; + pt) + printf -- "%s" "pt-PT" + ;; + ro) + printf -- "%s" "ro-RO" + ;; + ru) + printf -- "%s" "ru-RU" + ;; + sk) + printf -- "%s" "sk-SK" + ;; + sl) + printf -- "%s" "sl-SI" + ;; + sq) + printf -- "%s" "sq-AL" + ;; + sr) + printf -- "%s" "sr-Latn-RS" + ;; + sv) + printf -- "%s" "sv-SE" + ;; + th) + printf -- "%s" "th-TH" + ;; + tr) + printf -- "%s" "tr-TR" + ;; + uk) + printf -- "%s" "uk-UA" + ;; + zh-hant) + printf -- "%s" "zh-TW" + ;; + zh|zh-hans) + printf -- "%s" "zh-CN" + ;; + *) + printf -- "" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Get_Program_Files_Directory.sh.ps1 b/automataCI/services/hestiaMSI/Get_Program_Files_Directory.sh.ps1 new file mode 100644 index 0000000..585682d --- /dev/null +++ b/automataCI/services/hestiaMSI/Get_Program_Files_Directory.sh.ps1 @@ -0,0 +1,85 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaMSI-Get-Program-Files-Directory { + param ( + [string]$___arch + ) + + + # execute + switch ($___arch) { + { $_ -in "amd64", "arm64" } { + return "ProgramFiles64Folder" + } { $_ -in "i386", "arm" } { + return "ProgramFilesFolder" + } default { + return "ProgramFiles6432Folder" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaMSI_Get_Program_Files_Directory() { + #___arch="$1" + + + # execute + case "$1" in + amd64|arm64) + printf -- "%s" "ProgramFiles64Folder" + ;; + i386|arm) + printf -- "%s" "ProgramFilesFolder" + ;; + *) + printf -- "" + ;; + esac +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Install_Quietly.sh.ps1 b/automataCI/services/hestiaMSI/Install_Quietly.sh.ps1 new file mode 100644 index 0000000..3f63d7e --- /dev/null +++ b/automataCI/services/hestiaMSI/Install_Quietly.sh.ps1 @@ -0,0 +1,129 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaMSI-Install-Quietly { + param ( + [string]$___installer + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___installer) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File $___installer) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_NOT_A_FILE} + } + + if ($(hestiaMSI-Is-Target-Valid $___installer) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + try { + $null = Start-Process -FilePath $___installer ` + -ArgumentList "/qn /norestart" ` + -Wait + } catch { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaMSI_Install_Quietly() { + #___installer="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_NOT_A_FILE + fi + + if [ $(hestiaMSI_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + $1 /qn /norestart + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Is_Available.sh.ps1 b/automataCI/services/hestiaMSI/Is_Available.sh.ps1 new file mode 100644 index 0000000..cebba1a --- /dev/null +++ b/automataCI/services/hestiaMSI/Is_Available.sh.ps1 @@ -0,0 +1,97 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Activate_Environment.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaMSI-Is-Available { + param ( + [string]$___dotnet_directory + ) + + + # execute + if ($(hestiaNUPKG-Activate-Environment $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_DEAD} + } + + + if ($(hestiaOS-Is-Command-Available "wix") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaMSI_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "wixl") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaMSI/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..f905814 --- /dev/null +++ b/automataCI/services/hestiaMSI/Is_Target_Valid.sh.ps1 @@ -0,0 +1,111 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaMSI-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File $___target + if ($($___target -replace '.*\.msi$', '') -ne $___target) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaMSI_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%.msi*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Package.sh.ps1 b/automataCI/services/hestiaMSI/Package.sh.ps1 new file mode 100644 index 0000000..f2c7cf6 --- /dev/null +++ b/automataCI/services/hestiaMSI/Package.sh.ps1 @@ -0,0 +1,1406 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaCRYPTO\Create_Random_String.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaI18N\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaLOCALE\Get_LCID.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Compile.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaMSI-Package { + param ( + [string]$___directory_dest, + [string]$___directory_workspace, + [string]$___sku, + [string]$___version, + [string]$___uuid, + [string]$___project_scope, + [string]$___project_name, + [string]$___contact_name, + [string]$___contact_website, + [string]$___installer_version, + [string]$___installer_scope, + [string]$___registry_key, + [string]$___uuid_component_bin, + [string]$___uuid_component_etc, + [string]$___uuid_component_lib, + [string]$___uuid_component_docs, + [string]$___uuid_component_registries, + [string]$___codepage, + [string]$___dotnet_directory + ) + + + # validate input + if ($(hestiaMSI-Is-Available $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___directory_dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___directory_workspace) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___sku) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___project_scope) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___project_name) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___contact_name) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___contact_website) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___installer_version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___installer_scope) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___registry_key) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid_component_bin) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid_component_etc) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid_component_lib) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid_component_docs) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___uuid_component_registries) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___codepage) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___directory_dest) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_INVALID} + } + + if ($(hestiaFS-Is-Directory $___directory_workspace) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaFS-Is-File "${___directory_workspace}\icon.ico") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-File "${___directory_workspace}\msi-banner.jpg") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-File "${___directory_workspace}\msi-dialog.jpg") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + foreach ($___language in (-split $(hestiaI18N-Get-Languages-List))) { + # validate arch + $___arch = hestiaFS-Get-File $___directory_workspace + switch ($___arch) { + { $_ -in "amd64", "arm64", "i386", "arm" } { + # accepted + } default { + # WiX4 does not support other arch aside the above + continue + }} + + + # validate LICENSE_[LANG}.rtf availability + $___license = "${___directory_workspace}\share\doc\LICENSE_${___language}.rtf" + if ($(hestiaFS-Is-File $___license) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___license = "${___directory_workspace}\share\doc\LICENSE.rtf" + if ($(hestiaFS-Is-File $___license) -ne ${env:hestiaKERNEL_ERROR_OK}) { + continue ## no available license file - skipping + } + } + + + # create wxs formula + $___package = "${___sku}_${___language}_windows-${___arch}" + $___wxs = "${___directory_workspace}\${___package}.wxs" + $___msi = "${___directory_workspace}\${___package}.msi" + if ($(hestiaFS-Is-File $___wxs) -eq ${env:hestiaKERNEL_ERROR_OK}) { + ## user supplied - begin packaging and export + $___process = hestiaMSI-Compile $___wxs $___arch $___language + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## export packaged file + $___process = hestiaFS-Copy-File ` + "${___directory_dest}\${___package}.msi" ` + $___msi + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## move on to next language + continue + } + + + # create wxs header + $___process = hestiaFS-Write-File $___wxs @" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # create bin/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\bin") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # create etc/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\etc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## append the opener + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # create lib/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\lib") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # create share/ directory when available + if ( + ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\share\doc") -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # create share/doc/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\share\doc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # close share/ directory when available + if ( + ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\share\doc") -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + + # close directory tree definitions + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + # assemble bin/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\bin") -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## append the opener + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## loop through each file and register + foreach ($___file in ( + Get-ChildItem -File -Recurse -Path "${___directory_workspace}\bin" + )) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + ## append the closer + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # assemble etc/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\etc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## append the opener + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## loop through each file and register + foreach ($___file in ( + Get-ChildItem -File -Recurse -Path "${___directory_workspace}\etc" + )) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + ## append the closer + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # assemble lib/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\lib") -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## append the opener + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## loop through each file and register + foreach ($___file in ( + Get-ChildItem -File -Recurse -Path "${___directory_workspace}\lib" + )) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + ## append the closer + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # assemble share/doc/ directory when available + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\share\doc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + ## append the opener + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + ## loop through each file and register + foreach ($___file in ( + Get-ChildItem -File ` + -Recurse ` + -Path "${___directory_workspace}\share\doc" + )) { + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + ## append the closer + $___process = hestiaFS-Append-File $___wxs @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # create registry component + $___process = hestiaFS-Append-File $___wxs @" + + + + + + + + + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # define features tree + $___process = hestiaFS-Append-File $___wxs @" + + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # define bin/ feature + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\bin") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # define etc/ feature + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\etc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # define lib/ feature + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\lib") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # define share/doc/ feature + if ($(hestiaFS-Is-Directory-Empty "${___directory_workspace}\share\doc") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaFS-Append-File $___wxs @" + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # conclude feature tree + $___process = hestiaFS-Append-File "${___directory_workspace}\${___package}.wxs" @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # define standard UI + $___process = hestiaFS-Append-File $___wxs @" + + + + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # conclude wxs creation + $___process = hestiaFS-Append-File $___wxs @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # package into msi + $___process = hestiaMSI-Compile $___wxs $___arch $___language $___dotnet_directory + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # export packaged file + $___process = hestiaFS-Copy-File ` + "${___directory_dest}\${___package}.msi" ` + $___msi + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaCRYPTO/Create_Random_String.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaI18N/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaLOCALE/Get_LCID.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Compile.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaMSI_Package() { + #___directory_dest="$1" + #___directory_workspace="$2" + #___sku="$3" + #___version="$4" + #___uuid="$5" + #___project_scope="$6" + #___project_name="$7" + #___contact_name="$8" + #___contact_website="$9" + #___installer_version="${10}" + #___installer_scope="${11}" + #___registry_key="${12}" + #___uuid_component_bin="${13}" + #___uuid_component_etc="${14}" + #___uuid_component_lib="${15}" + #___uuid_component_docs="${16}" + #___uuid_component_registries="${17}" + #___codepage="${18}" + #___dotnet_directory="${19}" + + + # validate input + if [ $(hestiaMSI_Is_Available "${19}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$4") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$5") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$8") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$9") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${10}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${11}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${12}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${13}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${14}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${15}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${16}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${17}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "${18}") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_INVALID + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $(hestiaFS_Is_File "${2}/icon.ico") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_File "${2}/msi-banner.jpg") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_File "${2}/msi-dialog.jpg") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___old_IFS="$IFS" + while IFS="" read -r ___language || [ -n "$___language" ]; do + # validate arch + ___arch="$(hestiaFS_Get_File "$2")" + case "$___arch" in + amd64) + ;; + *) + # msitools does not support other arch aside amd64 + continue + ;; + esac + + + # create wxs formula + ___package="${3}_${___language}_windows-${___arch}" + if [ $(hestiaFS_Is_File "${2}/${___package}.wxs") -eq $hestiaKERNEL_ERROR_OK ]; then + ## user supplied - begin packaging and export + hestiaMSI_Compile "${2}/${___package}.wxs" "$___arch" "$___language" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## export packaged file + hestiaFS_Copy_File "${1}/${___package}.msi" "${2}/${___package}.msi" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## move on to next language + continue + fi + + + # create wxs header + hestiaFS_Write_File "${2}/${___package}.wxs" "\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CMDLINE_INSTALLDIR + + + + CMDLINE_INSTALLDIR + + + + + + + + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # create bin/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/bin") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## loop through each file and register + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < /dev/null) +EOF + + ## append the closer + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # create etc/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/etc") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## loop through each file and register + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < /dev/null) +EOF + + ## append the closer + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # create lib/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/lib") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## loop through each file and register + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < /dev/null) +EOF + + ## append the closer + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # create share/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/share/doc") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # create share/doc/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/share/doc") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + ## loop through each file and register + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ $(hestiaFS_Is_File "$___file") -ne $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < /dev/null) +EOF + + ## append the closer + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # close share/ directory when available + if [ $(hestiaFS_Is_Directory_Empty "${2}/share/doc") -ne $hestiaKERNEL_ERROR_OK ]; then + ## append the opener + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # close directory section + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + + + + + + + + + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # define features tree + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # append bin/ feature if available + if [ $(hestiaFS_Is_Directory_Empty "${2}/bin") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # append etc/ feature if available + if [ $(hestiaFS_Is_Directory_Empty "${2}/etc") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # append lib/ feature if available + if [ $(hestiaFS_Is_Directory_Empty "${2}/lib") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # append share/doc/ feature if available + if [ $(hestiaFS_Is_Directory_Empty "${2}/share/doc") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # close features tree + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # conclude wxs creation + hestiaFS_Append_File "${2}/${___package}.wxs" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # package into msi + hestiaMSI_Compile "${2}/${___package}.wxs" "$___arch" "$___language" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # export packaged file + if [ $(hestiaFS_Is_File "${2}/${___package}.msi") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + hestiaFS_Copy_File "${1}/${___package}.msi" "${2}/${___package}.msi" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < diff --git a/automataCI/services/hestiaMSI/Setup.sh.ps1 b/automataCI/services/hestiaMSI/Setup.sh.ps1 new file mode 100644 index 0000000..5abfd4d --- /dev/null +++ b/automataCI/services/hestiaMSI/Setup.sh.ps1 @@ -0,0 +1,108 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Vanilla.sh.ps1" + + + + +function hestiaMSI-Setup { + # validate input + if ($(hestiaMSI-Is-Available) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaNUPKG-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # execute + $___process = hestiaNUPKG-Install "wix" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaHOMEBREW/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Available.sh.ps1" + + + + +hestiaMSI_Setup() { + # validate input + if [ $(hestiaMSI_Is_Available) -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaHOMEBREW_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + hestiaHOMEBREW_Install "msitools" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaMSI/Vanilla.sh.ps1 b/automataCI/services/hestiaMSI/Vanilla.sh.ps1 new file mode 100644 index 0000000..212dd11 --- /dev/null +++ b/automataCI/services/hestiaMSI/Vanilla.sh.ps1 @@ -0,0 +1,68 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaMSI\Compile.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Get_Culture.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Get_Program_Files_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Install_Quietly.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Package.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaMSI\Setup.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaMSI/Compile.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Get_Culture.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Get_Program_Files_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Install_Quietly.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Package.sh.ps1" +. "${LIBS_HESTIA}/hestiaMSI/Setup.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNPM/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaNPM/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..61e5f2f --- /dev/null +++ b/automataCI/services/hestiaNPM/Is_Target_Valid.sh.ps1 @@ -0,0 +1,129 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Is_Target_Valid.sh.ps1" + + + + +function hestiaNPM-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaTAR-Is-Target-Valid $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File $___target + if ($($___target -replace '.*_js-js\.tgz$', '') -ne $___target) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Is_Target_Valid.sh.ps1" + + + + +hestiaNPM_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaTAR_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED + fi + + if [ $(hestiaGZ_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%_js-js.tgz*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNPM/Vanilla.sh.ps1 b/automataCI/services/hestiaNPM/Vanilla.sh.ps1 new file mode 100644 index 0000000..9709611 --- /dev/null +++ b/automataCI/services/hestiaNPM/Vanilla.sh.ps1 @@ -0,0 +1,54 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaNPM\Is_Target_Valid.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaNPM/Is_Target_Valid.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Activate_Environment.sh.ps1 b/automataCI/services/hestiaNUPKG/Activate_Environment.sh.ps1 new file mode 100644 index 0000000..158e1da --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Activate_Environment.sh.ps1 @@ -0,0 +1,126 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Activated.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Vanilla.sh.ps1" + + + + +function hestiaNUPKG-Activate-Environment { + param ( + [string]$___dotnet_directory + ) + + + # validate input + if ($(hestiaNUPKG-Is-Activated) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($(hestiaNUPKG-Is-Available $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # execute + ${env:DOTNET_ROOT} = $___dotnet_directory + ${env:PATH} += ";${env:DOTNET_ROOT};${env:DOTNET_ROOT}\bin" + if ($(hestiaNUPKG-Is-Activated) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Activated.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaNUPKG_Activate_Environment() { + #___dotnet_directory="$1" + + + # validate input + if [ $(hestiaNUPKG_Is_Activated) -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + if [ $(hestiaNUPKG_Is_Available "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + DOTNET_ROOT="$1" + alias dotnet="${1}/dotnet" + if [ $(hestiaSTRING_Is_Empty "$DOTNET_CLI_TELEMETRY_OPTOUT") -ne $hestiaKERNEL_ERROR_OK ]; then + DOTNET_CLI_TELEMETRY_OPTOUT=1 + fi + + if [ $(hestiaNUPKG_Is_Activated) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Get.sh.ps1 b/automataCI/services/hestiaNUPKG/Get.sh.ps1 new file mode 100644 index 0000000..824c2b9 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Get.sh.ps1 @@ -0,0 +1,383 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Download.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Unpack.sh.ps1" + + + + +function hestiaNUPKG-Get { + param ( + [string]$___dotnet_directory, + [string]$___base_url, + [string]$___product, + [string]$___version, + [string]$___purge_cache, + [string]$___destination, + [string]$___extractions, + [string]$___shasum_type, + [string]$___shasum_value + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___dotnet_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___base_url) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___product) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + $___version = hestiaSTRING-To-Lowercase $___version + if ($(hestiaSTRING-Is-Empty $___version) -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___version = "latest" + } + + if ($(hestiaFS-Is-Exist $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Create-Directory $___dotnet_directory + } + + if ($(hestiaFS-Is-Directory $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + + + # execute + $___pkg = "${___dotnet_directory}\${___product}_${___version}" + + ## clean up existing package + $___should_cleanup = $false + + if ($___version -eq "latest") { + $___should_cleanup = $true + } + + if ($(hestiaSTRING-Is-Empty $___purge_cache) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___should_cleanup = $true + } + + if ($(hestiaSTRING-Is-Empty $___extractions) -ne ${env:hestiaKERNEL_ERROR_OK}) { + foreach ($___target in ($___extractions -split "`n")) { + $___src = "${___pkg}\${___target}" + + if ($(hestiaSTRING-Is-Empty $___target) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___should_cleanup = $false + } + } + } + + if ($___should_cleanup) { + $null = hestiaFS-Remove $___pkg + } + + + ## begin sourcing nupkg when required + if ($(hestiaFS-Is-Directory $___pkg) -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___provider_url = "${___base_url}\${___product}" + if ($___version -ne "latest") { + $___provider_url = "${___provider_url}/${___version}" + } + + $null = hestiaFS-Create-Directory $___pkg + + $___process = hestiaHTTP-Download ` + "GET" ` + $___provider_url ` + "${___pkg}\nupkg.zip" ` + "" ` + $___shasum_type ` + $___shasum_value ` + "" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___pkg + return ${env:hestiaKERNEL_ERROR_DATA_REMOTE_ERROR} + } + + if ($(hestiaFS-Is-File "${___pkg}\nupkg.zip") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___pkg + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + $___process = hestiaZIP-Unpack $___pkg "${___pkg}\nupkg.zip" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___pkg + return ${env:hestiaKERNEL_ERROR_DATA_BAD} + } + } + + ## begin extraction + if ( + ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty $___extractions) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_DATA_OK} # not requested + } + + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaSTRING-Is-Empty $___extractions) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ( + ($(hestiaFS-Is-Exist $___extractions) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaFS-Is-Directory $___extractions) -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + + $null = hestiaFS-Create-Directory $___destination + foreach ($___target in ($___extractions -split "`n")) { + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + continue + } + + $___src = "${___pkg}\${___target}" + $___dest = "${___destination}\$(hestiaFS-Get-File $___target)" + + if ($(hestiaFS-Is-File $___src) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-File $___dest) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + $___process = hestiaFS-Copy-File $___dest $___src + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_FAULTY} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Download.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Unpack.sh.ps1" + + + + +hestiaNUPKG_Get() { + #___dotnet_directory="$1" + #___base_url="$2" + #___product="$3" + #___version="$4" + #___purge_cache="$5" + #___destination="$6" + #___extractions="$7" + #___shasum_type="$8" + #___shasum_value="$9" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$3") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + ___version="$(hestiaSTRING_To_Lowercase "$4")" + if [ $(hestiaSTRING_Is_Empty "$___version") -eq $hestiaKERNEL_ERROR_OK ]; then + ___version="latest" + fi + + if [ $(hestiaFS_Is_Exist "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Create_Directory "$1" + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + + # execute + ___pkg="${1}/${3}_${4}" + + ## clean up existing package + ___should_cleanup=1 + + if [ "$___version" = "latest" ]; then + ___should_cleanup=0 + fi + + if [ $(hestiaSTRING_Is_Empty "$5") -ne $hestiaKERNEL_ERROR_OK ]; then + ___should_cleanup=0 + fi + + if [ $(hestiaSTRING_Is_Empty "$7") -ne $hestiaKERNEL_ERROR_OK ]; then + ___old_IFS="$IFS" + while IFS= read -r ___target || [ -n "$___target" ]; do + ___src="${___pkg}/${___target}" + + if [ $(hestiaFS_Is_File "$___src") -ne $hestiaKERNEL_ERROR_OK ]; then + ___should_cleanup=0 + break + fi + done << EOF +$7 +EOF + IFS="$___old_IFS" && unset ___old_IFS + fi + + if [ $___should_cleanup -eq 0 ]; then + hestiaFS_Remove "$___pkg" + fi + + + ## begin sourcing nupkg when required + if [ $(hestiaFS_Is_Directory "$___pkg") -ne $hestiaKERNEL_ERROR_OK ]; then + ___provider_url="${2}/${3}" + if [ ! "$___version" = "latest" ]; then + ___provider_url="${___provider_url}/${___version}" + fi + + hestiaFS_Create_Directory "$___pkg" + + hestiaHTTP_Download \ + "GET" \ + "$___provider_url" \ + "${___pkg}/nupkg.zip" \ + "" \ + "$8" \ + "$9" \ + "" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___pkg" + return $hestiaKERNEL_ERROR_DATA_REMOTE_ERROR + fi + + # making sure remote is not doing something funky + if [ $(hestiaFS_Is_File "${___pkg}/nupkg.zip") -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___pkg" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + hestiaZIP_Unpack "$___pkg" "${___pkg}/nupkg.zip" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___pkg" + return $hestiaKERNEL_ERROR_DATA_BAD + fi + fi + + + ## begin extraction + if [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK # not requested + fi + + if [ $(hestiaSTRING_Is_Empty "$6") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $(hestiaSTRING_Is_Empty "$7") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaFS_Is_Exist "$6") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaFS_Is_Directory "$6") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + hestiaFS_Create_Directory "$6" + ___old_IFS="$IFS" + while IFS= read -r ___target || [ -n "$___target" ]; do + if [ $(hestiaSTRING_Is_Empty "$___target") -eq $hestiaKERNEL_ERROR_OK ]; then + continue + fi + + ___src="${___pkg}/${___target}" + ___dest="${6}/$(hestiaFS_Get_File "$___target")" + + if [ $(hestiaFS_Is_File "$___src") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_File "$___dest") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + hestiaFS_Copy_File "$___dest" "$___src" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_FAULTY + fi + done << EOF +$7 +EOF + IFS="$___old_IFS" && unset ___old_IFS + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Install.sh.ps1 b/automataCI/services/hestiaNUPKG/Install.sh.ps1 new file mode 100644 index 0000000..694bfd8 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Install.sh.ps1 @@ -0,0 +1,140 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Activate_Environment.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaNUPKG-Install { + param ( + [string]$___dotnet_directory, + [string]$___order + ) + + + # execute + if ($(hestiaNUPKG-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___dotnet_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___order) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + $___process = hestiaNUPKG-Activate-Environment $___dotnet_directory + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_BAD} + } + + + # execute + $___process = Start-Process -Wait -NoNewWindow -PassThru ` + -FilePath "${___dotnet_directory}\dotnet.exe" ` + -ArgumentList "tool install --tool-path `"${___dotnet_directory}\bin`" ${___order}" + if ($___process.ExitCode -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Activate_Environment.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaNUPKG_Install() { + #___dotnet_directory="$1" + #___order="$2" + + + # execute + if [ $(hestiaNUPKG_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + hestiaNUPKG_Activate_Environment "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_BAD + fi + + + # execute + dotnet tool install --tool-path "${1}/bin" "$2" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Is_Activated.sh.ps1 b/automataCI/services/hestiaNUPKG/Is_Activated.sh.ps1 new file mode 100644 index 0000000..97f6204 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Is_Activated.sh.ps1 @@ -0,0 +1,103 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaNUPKG-Is-Activated { + # execute + if ($(hestiaSTRING-Is-Empty ${env:DOTNET_ROOT}) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaOS-Is-Command-Available "dotnet") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaNUPKG_Is_Activated() { + # execute + if [ $(hestiaSTRING_Is_Empty "$DOTNET_ROOT") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaFS_Is_File "${DOTNET_ROOT}/dotnet") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + "${DOTNET_ROOT}/dotnet" help &> /dev/null + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Is_Available.sh.ps1 b/automataCI/services/hestiaNUPKG/Is_Available.sh.ps1 new file mode 100644 index 0000000..005014c --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Is_Available.sh.ps1 @@ -0,0 +1,114 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaNUPKG-Is-Available { + param ( + [string]$___dotnet_directory + ) + + + # execute + if ($(hestiaSTRING-Is-Empty $___dotnet_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-Directory $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-File "${___dotnet_directory}\dotnet.exe") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaNUPKG_Is_Available() { + #___dotnet_directory="$1" + + + # execute + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_NOT_DIRECTORY + return $hestiaKERNEL_ERROR_DATA_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_File "${1}/dotnet") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_NOT_POSSIBLE + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaNUPKG/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..87562a0 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Is_Target_Valid.sh.ps1 @@ -0,0 +1,122 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Vanilla.sh.ps1" + + + + +function hestiaNUPKG-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaZIP-Is-Target-Valid "${___target}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ($("${___target}" -replace '^.*\.nupkg$', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Vanilla.sh.ps1" + + + + +hestiaNUPKG_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaZIP_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%.nupkg*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Package.sh.ps1 b/automataCI/services/hestiaNUPKG/Package.sh.ps1 new file mode 100644 index 0000000..7886578 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Package.sh.ps1 @@ -0,0 +1,438 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Pack.sh.ps1" + + + + +function hestiaNUPKG-Package { + param ( + [string]$___destination, + [string]$___directory, + [string]$___id, + [string]$___version, + [string]$___description, + [string]$___author, + [string]$___project_url, + [string]$___license_file, + [string]$___icon, + [string]$___readme, + [string]$___license_acceptance, + [string]$___source_url, + [string]$___title + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___destination}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaFS-Is-Exist "${___destination}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaFS-Is-Directory "${___destination}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} + } + + if ($(hestiaSTRING-Is-Empty "${___directory}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_IS_EMPTY} + } + + if ($(hestiaFS-Is-Directory "${___directory}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_DESCRIPTOR} + } + + if ($(hestiaSTRING-Is-Empty "${___id}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___version}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___description}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___author}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___project_url}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___license_file}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File "${___directory}\${___license_file}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaSTRING-Is-Empty "${___icon}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File "${___directory}\${___icon}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaSTRING-Is-Empty "${___readme}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaFS-Is-File "${___directory}\${___readme}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($___license_acceptance -ne "yes") { + $___license_acceptance = "no" + } + + if ($(hestiaSTRING-Is-Empty "${___source_url}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty "${___title}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___nuspec = "" + foreach ($___file in ( + Get-ChildItem -File -Path "${___directory}" ` + | Where-Object { $_.Name -like "*.nuspec" } + )) { $___file = $___file.FullName + if ($(hestiaFS-Get-File "${___file}") -eq ".nuspec") { + return ${env:hestiaKERNEL_ERROR_BAD_DESCRIPTOR} + } + + if ($(hestiaSTRING-Is-Empty "${___nuspec}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_TOO_MANY_REFERENCES} + } + + $___nuspec = $___file -replace [regex]::Escape("${___directory}\"), '' + } + + if ($(hestiaSTRING-Is-Empty "${___nuspec}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + # missing nuspec - create one + $___nuspec = "${___directory}\${___id}.nuspec" + $___process = hestiaFS-Write-File "${___nuspec}" @" + + + + ${___id} + ${___version} + ${___description} + ${___author} + ${___author} + ${___project_url} + ${___license_file} + ${___icon} + ${___readme} + ${___license_acceptance} + + ${___title} + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # loop through each detected files and register into the nuspec + foreach ($___file in + (Get-ChildItem -File -Recurse -Path "${___directory}") + ) { $___file = $___file.FullName + if ( + ("$($___file -replace ".*\.nuspec$", '')" -ne "${___file}") -or + ("$($___file -replace ".*Chocolatey.*", '')" -ne "${___file}") -or + ("$($___file -replace ".*chocolatey.*", '')" -ne "${___file}") + ) { + continue + } + + # valid payload - register + $___file = $___file -replace [regex]::Escape("${___directory}\"), '' + $___process = hestiaFS-Append-File "${___nuspec}" @" + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # close the nuspec + $___process = hestiaFS-Append-File "${___nuspec}" @" + + + +"@ + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + } + + + # package the file + $___process = hestiaZIP-Pack "${___destination}" "${___directory}" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Pack.sh.ps1" + + + + +hestiaNUPKG_Package() { + ___destination="$1" + ___directory="$2" + ___id="$3" + ___version="$4" + ___description="$5" + ___author="$6" + ___project_url="$7" + ___license_file="$8" + ___icon="$9" + ___readme="${10}" + ___license_acceptance="${11}" + ___source_url="${12}" + ___title="${13}" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$___destination") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaFS_Is_Exist "$___destination") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaFS_Is_Directory "$___destination") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE + fi + + if [ $(hestiaSTRING_Is_Empty "$___directory") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_IS_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$___directory") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_DESCRIPTOR + fi + + if [ $(hestiaSTRING_Is_Empty "$___id") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___version") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___description") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___author") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___project_url") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___license_file") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "${___directory}/${___license_file}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$___icon") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "${___directory}/${___icon}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$___readme") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "${___directory}/${___readme}") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ ! "$___license_acceptance" = "yes" ]; then + ___license_acceptance="no" + fi + + if [ $(hestiaSTRING_Is_Empty "$___source_url") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$___title") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + ___nuspec="" + ___old_IFS="$IFS" + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ "$(hestiaFS_Get_File "$___file")" = ".nuspec" ]; then + return $hestiaKERNEL_ERROR_BAD_DESCRIPTOR + fi + + if [ $(hestiaSTRING_Is_Empty "$___nuspec") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_TOO_MANY_REFERENCES + fi + + ___nuspec="${___file##*${___directory}/}" + done < /dev/null) +EOF + IFS="$___old_IFS" && unset ___old_IFS + + if [ $(hestiaSTRING_Is_Empty "$___nuspec") -eq $hestiaKERNEL_ERROR_OK ]; then + # missing nuspec - create one + ___nuspec="${___directory}/${___id}.nuspec" + hestiaFS_Write_File "$___nuspec" "\ + + + + ${___id} + ${___version} + ${___description} + ${___author} + ${___author} + ${___project_url} + ${___license_file} + ${___icon} + ${___readme} + ${___license_acceptance} + + ${___title} + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # loop through each detected files and register into the nuspec + ___old_IFS="$IFS" + while IFS= read -r ___file || [ -n "$___file" ]; do + if [ ! "${___file%%.nuspec*}" = "$___file" ] || + [ ! "${___file%%Chocolatey*}" = "$___file" ] || + [ ! "${___file%%chocolatey*}" = "$___file" ]; then + continue + fi + + # valid payload - register + ___file="${___file#*${___directory}/}" + hestiaFS_Append_File "$___nuspec" "\ + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + done < /dev/null) +EOF + IFS="$___old_IFS" && unset ___old_IFS + + + # close the nuspec + hestiaFS_Append_File "$___nuspec" "\ + + +" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + fi + + + # package the file + hestiaZIP_Pack "$___destination" "$___directory" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Publish.sh.ps1 b/automataCI/services/hestiaNUPKG/Publish.sh.ps1 new file mode 100644 index 0000000..753e8fc --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Publish.sh.ps1 @@ -0,0 +1,133 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaHTTP\Is_Available.sh.ps1" + + + + +function hestiaNUPKG-Publish { + param ( + [string]$___url, + [string]$___target, + [string]$___auth_token + ) + + + # validate input + if ($(hestiaHTTP-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if (($(hestiaSTRING-Is-Empty "${___url}") -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty "${___auth_token}") -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK})) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + $___arguments = "--request PUT " + + "--header `"X-NuGet-ApiKey: ${___auth_token}`"" + + "--header `"Authorization: ${___auth_token}`"" + + "--form `"package=@${___target}`"" + + "${___url}" + $___process = hestiaOS-Exec "curl" "${___arguments}" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaHTTP/Vanilla.sh.ps1" + + + + +hestiaNUPKG_Publish() { + ___url="$1" + ___auth_token="$2" + ___target="$3" + + + # validate input + if [ $(hestiaHTTP_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$___url") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$___auth_token") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$___target") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + curl --request "PUT" \ + --header "X-NuGet-ApiKey: ${___auth_token}" \ + --header "Authorization: ${___auth_token}" \ + --form "package=@${___target}" \ + "$___url" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Setup.sh.ps1 b/automataCI/services/hestiaNUPKG/Setup.sh.ps1 new file mode 100644 index 0000000..f5c7d7f --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Setup.sh.ps1 @@ -0,0 +1,148 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_Directory.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaNUPKG-Setup { + param ( + [string]$___dotnet_directory, + [string]$___dotnet_channel + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___dotnet_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ($(hestiaSTRING-Is-Empty $___dotnet_channel) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaFS-Is-Directory $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_NOT_DIRECTORY} + } + + if ($(hestiaNUPKG-Is-Available $___dotnet_directory) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # execute + $___arguments = "-ExecutionPolicy RemoteSigned " ` + + "${env:LIBS_HESTIA}\hestiaNUPKG\dotnet-install.ps1 " ` + + "-Channel ${___dotnet_channel} " ` + + "-InstallDir `"${___dotnet_directory}`"" + $___process = hestiaOS-Exec "powershell" "${___arguments}" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($(hestiaNUPKG-Is-Available $___dotnet_directory) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Is_Directory.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaNUPKG_Setup() { + #___dotnet_directory="$1" + #___dotnet_channel="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENITTY_EMPTY + fi + + if [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_NOT_DIRECTORY + fi + + if [ $(hestiaNUPKG_Is_Available "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # execute + "${LIBS_HESTIA}/hestiaNUPKG/dotnet-install.sh" --channel "$2" --install-dir "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + if [ $(hestiaNUPKG_Is_Available "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/Vanilla.sh.ps1 b/automataCI/services/hestiaNUPKG/Vanilla.sh.ps1 new file mode 100644 index 0000000..0939d57 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/Vanilla.sh.ps1 @@ -0,0 +1,70 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaNUPKG\Activate_Environment.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Get.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Install.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Activated.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Package.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Publish.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaNUPKG\Setup.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaNUPKG/Activate_Environment.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Get.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Install.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Activated.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Package.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Publish.sh.ps1" +. "${LIBS_HESTIA}/hestiaNUPKG/Setup.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaNUPKG/dotnet-install.ps1 b/automataCI/services/hestiaNUPKG/dotnet-install.ps1 new file mode 100644 index 0000000..e58412b --- /dev/null +++ b/automataCI/services/hestiaNUPKG/dotnet-install.ps1 @@ -0,0 +1,1569 @@ +# +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +<# +.SYNOPSIS + Installs dotnet cli +.DESCRIPTION + Installs dotnet cli. If dotnet installation already exists in the given directory + it will update it only if the requested version differs from the one already installed. + + Note that the intended use of this script is for Continuous Integration (CI) scenarios, where: + - The SDK needs to be installed without user interaction and without admin rights. + - The SDK installation doesn't need to persist across multiple CI runs. + To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer. + +.PARAMETER Channel + Default: LTS + Download from the Channel specified. Possible values: + - STS - the most recent Standard Term Support release + - LTS - the most recent Long Term Support release + - 2-part version in a format A.B - represents a specific release + examples: 2.0, 1.0 + - 3-part version in a format A.B.Cxx - represents a specific SDK release + examples: 5.0.1xx, 5.0.2xx + Supported since 5.0 release + Warning: Value "Current" is deprecated for the Channel parameter. Use "STS" instead. + Note: The version parameter overrides the channel parameter when any version other than 'latest' is used. +.PARAMETER Quality + Download the latest build of specified quality in the channel. The possible values are: daily, signed, validated, preview, GA. + Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used. + For SDK use channel in A.B.Cxx format: using quality together with channel in A.B format is not supported. + Supported since 5.0 release. + Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality. +.PARAMETER Version + Default: latest + Represents a build version on specific channel. Possible values: + - latest - the latest build on specific channel + - 3-part version in a format A.B.C - represents specific version of build + examples: 2.0.0-preview2-006120, 1.1.0 +.PARAMETER Internal + Download internal builds. Requires providing credentials via -FeedCredential parameter. +.PARAMETER FeedCredential + Token to access Azure feed. Used as a query string to append to the Azure feed. + This parameter typically is not specified. +.PARAMETER InstallDir + Default: %LocalAppData%\Microsoft\dotnet + Path to where to install dotnet. Note that binaries will be placed directly in a given directory. +.PARAMETER Architecture + Default: - this value represents currently running OS architecture + Architecture of dotnet binaries to be installed. + Possible values are: , amd64, x64, x86, arm64, arm +.PARAMETER SharedRuntime + This parameter is obsolete and may be removed in a future version of this script. + The recommended alternative is '-Runtime dotnet'. + Installs just the shared runtime bits, not the entire SDK. +.PARAMETER Runtime + Installs just a shared runtime, not the entire SDK. + Possible values: + - dotnet - the Microsoft.NETCore.App shared runtime + - aspnetcore - the Microsoft.AspNetCore.App shared runtime + - windowsdesktop - the Microsoft.WindowsDesktop.App shared runtime +.PARAMETER DryRun + If set it will not perform installation but instead display what command line to use to consistently install + currently requested version of dotnet cli. In example if you specify version 'latest' it will display a link + with specific version so that this command can be used deterministicly in a build script. + It also displays binaries location if you prefer to install or download it yourself. +.PARAMETER NoPath + By default this script will set environment variable PATH for the current process to the binaries folder inside installation folder. + If set it will display binaries location but not set any environment variable. +.PARAMETER Verbose + Displays diagnostics information. +.PARAMETER AzureFeed + Default: https://dotnetcli.azureedge.net/dotnet + For internal use only. + Allows using a different storage to download SDK archives from. + This parameter is only used if $NoCdn is false. +.PARAMETER UncachedFeed + For internal use only. + Allows using a different storage to download SDK archives from. + This parameter is only used if $NoCdn is true. +.PARAMETER ProxyAddress + If set, the installer will use the proxy when making web requests +.PARAMETER ProxyUseDefaultCredentials + Default: false + Use default credentials, when using proxy address. +.PARAMETER ProxyBypassList + If set with ProxyAddress, will provide the list of comma separated urls that will bypass the proxy +.PARAMETER SkipNonVersionedFiles + Default: false + Skips installing non-versioned files if they already exist, such as dotnet.exe. +.PARAMETER NoCdn + Disable downloading from the Azure CDN, and use the uncached feed directly. +.PARAMETER JSonFile + Determines the SDK version from a user specified global.json file + Note: global.json must have a value for 'SDK:Version' +.PARAMETER DownloadTimeout + Determines timeout duration in seconds for dowloading of the SDK file + Default: 1200 seconds (20 minutes) +.PARAMETER KeepZip + If set, downloaded file is kept +.PARAMETER ZipPath + Use that path to store installer, generated by default +#> +[cmdletbinding()] +param( + [string]$Channel="LTS", + [string]$Quality, + [string]$Version="Latest", + [switch]$Internal, + [string]$JSonFile, + [Alias('i')][string]$InstallDir="", + [string]$Architecture="", + [string]$Runtime, + [Obsolete("This parameter may be removed in a future version of this script. The recommended alternative is '-Runtime dotnet'.")] + [switch]$SharedRuntime, + [switch]$DryRun, + [switch]$NoPath, + [string]$AzureFeed, + [string]$UncachedFeed, + [string]$FeedCredential, + [string]$ProxyAddress, + [switch]$ProxyUseDefaultCredentials, + [string[]]$ProxyBypassList=@(), + [switch]$SkipNonVersionedFiles, + [switch]$NoCdn, + [int]$DownloadTimeout=1200, + [switch]$KeepZip, + [string]$ZipPath=[System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName()) +) + +Set-StrictMode -Version Latest +$ErrorActionPreference="Stop" +$ProgressPreference="SilentlyContinue" + +function Say($str) { + try { + Write-Host "dotnet-install: $str" + } + catch { + # Some platforms cannot utilize Write-Host (Azure Functions, for instance). Fall back to Write-Output + Write-Output "dotnet-install: $str" + } +} + +function Say-Warning($str) { + try { + Write-Warning "dotnet-install: $str" + } + catch { + # Some platforms cannot utilize Write-Warning (Azure Functions, for instance). Fall back to Write-Output + Write-Output "dotnet-install: Warning: $str" + } +} + +# Writes a line with error style settings. +# Use this function to show a human-readable comment along with an exception. +function Say-Error($str) { + try { + # Write-Error is quite oververbose for the purpose of the function, let's write one line with error style settings. + $Host.UI.WriteErrorLine("dotnet-install: $str") + } + catch { + Write-Output "dotnet-install: Error: $str" + } +} + +function Say-Verbose($str) { + try { + Write-Verbose "dotnet-install: $str" + } + catch { + # Some platforms cannot utilize Write-Verbose (Azure Functions, for instance). Fall back to Write-Output + Write-Output "dotnet-install: $str" + } +} + +function Measure-Action($name, $block) { + $time = Measure-Command $block + $totalSeconds = $time.TotalSeconds + Say-Verbose "⏱ Action '$name' took $totalSeconds seconds" +} + +function Get-Remote-File-Size($zipUri) { + try { + $response = Invoke-WebRequest -Uri $zipUri -Method Head + $fileSize = $response.Headers["Content-Length"] + if ((![string]::IsNullOrEmpty($fileSize))) { + Say "Remote file $zipUri size is $fileSize bytes." + + return $fileSize + } + } + catch { + Say-Verbose "Content-Length header was not extracted for $zipUri." + } + + return $null +} + +function Say-Invocation($Invocation) { + $command = $Invocation.MyCommand; + $args = (($Invocation.BoundParameters.Keys | foreach { "-$_ `"$($Invocation.BoundParameters[$_])`"" }) -join " ") + Say-Verbose "$command $args" +} + +function Invoke-With-Retry([ScriptBlock]$ScriptBlock, [System.Threading.CancellationToken]$cancellationToken = [System.Threading.CancellationToken]::None, [int]$MaxAttempts = 3, [int]$SecondsBetweenAttempts = 1) { + $Attempts = 0 + $local:startTime = $(get-date) + + while ($true) { + try { + return & $ScriptBlock + } + catch { + $Attempts++ + if (($Attempts -lt $MaxAttempts) -and -not $cancellationToken.IsCancellationRequested) { + Start-Sleep $SecondsBetweenAttempts + } + else { + $local:elapsedTime = $(get-date) - $local:startTime + if (($local:elapsedTime.TotalSeconds - $DownloadTimeout) -gt 0 -and -not $cancellationToken.IsCancellationRequested) { + throw New-Object System.TimeoutException("Failed to reach the server: connection timeout: default timeout is $DownloadTimeout second(s)"); + } + throw; + } + } + } +} + +function Get-Machine-Architecture() { + Say-Invocation $MyInvocation + + # On PS x86, PROCESSOR_ARCHITECTURE reports x86 even on x64 systems. + # To get the correct architecture, we need to use PROCESSOR_ARCHITEW6432. + # PS x64 doesn't define this, so we fall back to PROCESSOR_ARCHITECTURE. + # Possible values: amd64, x64, x86, arm64, arm + if( $ENV:PROCESSOR_ARCHITEW6432 -ne $null ) { + return $ENV:PROCESSOR_ARCHITEW6432 + } + + try { + if( ((Get-CimInstance -ClassName CIM_OperatingSystem).OSArchitecture) -like "ARM*") { + if( [Environment]::Is64BitOperatingSystem ) + { + return "arm64" + } + return "arm" + } + } + catch { + # Machine doesn't support Get-CimInstance + } + + return $ENV:PROCESSOR_ARCHITECTURE +} + +function Get-CLIArchitecture-From-Architecture([string]$Architecture) { + Say-Invocation $MyInvocation + + if ($Architecture -eq "") { + $Architecture = Get-Machine-Architecture + } + + switch ($Architecture.ToLowerInvariant()) { + { ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" } + { $_ -eq "x86" } { return "x86" } + { $_ -eq "arm" } { return "arm" } + { $_ -eq "arm64" } { return "arm64" } + default { throw "Architecture '$Architecture' not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" } + } +} + +function ValidateFeedCredential([string] $FeedCredential) +{ + if ($Internal -and [string]::IsNullOrWhitespace($FeedCredential)) { + $message = "Provide credentials via -FeedCredential parameter." + if ($DryRun) { + Say-Warning "$message" + } else { + throw "$message" + } + } + + #FeedCredential should start with "?", for it to be added to the end of the link. + #adding "?" at the beginning of the FeedCredential if needed. + if ((![string]::IsNullOrWhitespace($FeedCredential)) -and ($FeedCredential[0] -ne '?')) { + $FeedCredential = "?" + $FeedCredential + } + + return $FeedCredential +} +function Get-NormalizedQuality([string]$Quality) { + Say-Invocation $MyInvocation + + if ([string]::IsNullOrEmpty($Quality)) { + return "" + } + + switch ($Quality) { + { @("daily", "signed", "validated", "preview") -contains $_ } { return $Quality.ToLowerInvariant() } + #ga quality is available without specifying quality, so normalizing it to empty + { $_ -eq "ga" } { return "" } + default { throw "'$Quality' is not a supported value for -Quality option. Supported values are: daily, signed, validated, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." } + } +} + +function Get-NormalizedChannel([string]$Channel) { + Say-Invocation $MyInvocation + + if ([string]::IsNullOrEmpty($Channel)) { + return "" + } + + if ($Channel.Contains("Current")) { + Say-Warning 'Value "Current" is deprecated for -Channel option. Use "STS" instead.' + } + + if ($Channel.StartsWith('release/')) { + Say-Warning 'Using branch name with -Channel option is no longer supported with newer releases. Use -Quality option with a channel in X.Y format instead, such as "-Channel 5.0 -Quality Daily."' + } + + switch ($Channel) { + { $_ -eq "lts" } { return "LTS" } + { $_ -eq "sts" } { return "STS" } + { $_ -eq "current" } { return "STS" } + default { return $Channel.ToLowerInvariant() } + } +} + +function Get-NormalizedProduct([string]$Runtime) { + Say-Invocation $MyInvocation + + switch ($Runtime) { + { $_ -eq "dotnet" } { return "dotnet-runtime" } + { $_ -eq "aspnetcore" } { return "aspnetcore-runtime" } + { $_ -eq "windowsdesktop" } { return "windowsdesktop-runtime" } + { [string]::IsNullOrEmpty($_) } { return "dotnet-sdk" } + default { throw "'$Runtime' is not a supported value for -Runtime option, supported values are: dotnet, aspnetcore, windowsdesktop. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." } + } +} + + +# The version text returned from the feeds is a 1-line or 2-line string: +# For the SDK and the dotnet runtime (2 lines): +# Line 1: # commit_hash +# Line 2: # 4-part version +# For the aspnetcore runtime (1 line): +# Line 1: # 4-part version +function Get-Version-From-LatestVersion-File-Content([string]$VersionText) { + Say-Invocation $MyInvocation + + $Data = -split $VersionText + + $VersionInfo = @{ + CommitHash = $(if ($Data.Count -gt 1) { $Data[0] }) + Version = $Data[-1] # last line is always the version number. + } + return $VersionInfo +} + +function Load-Assembly([string] $Assembly) { + try { + Add-Type -Assembly $Assembly | Out-Null + } + catch { + # On Nano Server, Powershell Core Edition is used. Add-Type is unable to resolve base class assemblies because they are not GAC'd. + # Loading the base class assemblies is not unnecessary as the types will automatically get resolved. + } +} + +function GetHTTPResponse([Uri] $Uri, [bool]$HeaderOnly, [bool]$DisableRedirect, [bool]$DisableFeedCredential) +{ + $cts = New-Object System.Threading.CancellationTokenSource + + $downloadScript = { + + $HttpClient = $null + + try { + # HttpClient is used vs Invoke-WebRequest in order to support Nano Server which doesn't support the Invoke-WebRequest cmdlet. + Load-Assembly -Assembly System.Net.Http + + if(-not $ProxyAddress) { + try { + # Despite no proxy being explicitly specified, we may still be behind a default proxy + $DefaultProxy = [System.Net.WebRequest]::DefaultWebProxy; + if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))) { + if ($null -ne $DefaultProxy.GetProxy($Uri)) { + $ProxyAddress = $DefaultProxy.GetProxy($Uri).OriginalString + } else { + $ProxyAddress = $null + } + $ProxyUseDefaultCredentials = $true + } + } catch { + # Eat the exception and move forward as the above code is an attempt + # at resolving the DefaultProxy that may not have been a problem. + $ProxyAddress = $null + Say-Verbose("Exception ignored: $_.Exception.Message - moving forward...") + } + } + + $HttpClientHandler = New-Object System.Net.Http.HttpClientHandler + if($ProxyAddress) { + $HttpClientHandler.Proxy = New-Object System.Net.WebProxy -Property @{ + Address=$ProxyAddress; + UseDefaultCredentials=$ProxyUseDefaultCredentials; + BypassList = $ProxyBypassList; + } + } + if ($DisableRedirect) + { + $HttpClientHandler.AllowAutoRedirect = $false + } + $HttpClient = New-Object System.Net.Http.HttpClient -ArgumentList $HttpClientHandler + + # Default timeout for HttpClient is 100s. For a 50 MB download this assumes 500 KB/s average, any less will time out + # Defaulting to 20 minutes allows it to work over much slower connections. + $HttpClient.Timeout = New-TimeSpan -Seconds $DownloadTimeout + + if ($HeaderOnly){ + $completionOption = [System.Net.Http.HttpCompletionOption]::ResponseHeadersRead + } + else { + $completionOption = [System.Net.Http.HttpCompletionOption]::ResponseContentRead + } + + if ($DisableFeedCredential) { + $UriWithCredential = $Uri + } + else { + $UriWithCredential = "${Uri}${FeedCredential}" + } + + $Task = $HttpClient.GetAsync("$UriWithCredential", $completionOption).ConfigureAwait("false"); + $Response = $Task.GetAwaiter().GetResult(); + + if (($null -eq $Response) -or ((-not $HeaderOnly) -and (-not ($Response.IsSuccessStatusCode)))) { + # The feed credential is potentially sensitive info. Do not log FeedCredential to console output. + $DownloadException = [System.Exception] "Unable to download $Uri." + + if ($null -ne $Response) { + $DownloadException.Data["StatusCode"] = [int] $Response.StatusCode + $DownloadException.Data["ErrorMessage"] = "Unable to download $Uri. Returned HTTP status code: " + $DownloadException.Data["StatusCode"] + + if (404 -eq [int] $Response.StatusCode) + { + $cts.Cancel() + } + } + + throw $DownloadException + } + + return $Response + } + catch [System.Net.Http.HttpRequestException] { + $DownloadException = [System.Exception] "Unable to download $Uri." + + # Pick up the exception message and inner exceptions' messages if they exist + $CurrentException = $PSItem.Exception + $ErrorMsg = $CurrentException.Message + "`r`n" + while ($CurrentException.InnerException) { + $CurrentException = $CurrentException.InnerException + $ErrorMsg += $CurrentException.Message + "`r`n" + } + + # Check if there is an issue concerning TLS. + if ($ErrorMsg -like "*SSL/TLS*") { + $ErrorMsg += "Ensure that TLS 1.2 or higher is enabled to use this script.`r`n" + } + + $DownloadException.Data["ErrorMessage"] = $ErrorMsg + throw $DownloadException + } + finally { + if ($null -ne $HttpClient) { + $HttpClient.Dispose() + } + } + } + + try { + return Invoke-With-Retry $downloadScript $cts.Token + } + finally + { + if ($null -ne $cts) + { + $cts.Dispose() + } + } +} + +function Get-Version-From-LatestVersion-File([string]$AzureFeed, [string]$Channel) { + Say-Invocation $MyInvocation + + $VersionFileUrl = $null + if ($Runtime -eq "dotnet") { + $VersionFileUrl = "$AzureFeed/Runtime/$Channel/latest.version" + } + elseif ($Runtime -eq "aspnetcore") { + $VersionFileUrl = "$AzureFeed/aspnetcore/Runtime/$Channel/latest.version" + } + elseif ($Runtime -eq "windowsdesktop") { + $VersionFileUrl = "$AzureFeed/WindowsDesktop/$Channel/latest.version" + } + elseif (-not $Runtime) { + $VersionFileUrl = "$AzureFeed/Sdk/$Channel/latest.version" + } + else { + throw "Invalid value for `$Runtime" + } + + Say-Verbose "Constructed latest.version URL: $VersionFileUrl" + + try { + $Response = GetHTTPResponse -Uri $VersionFileUrl + } + catch { + Say-Verbose "Failed to download latest.version file." + throw + } + $StringContent = $Response.Content.ReadAsStringAsync().Result + + switch ($Response.Content.Headers.ContentType) { + { ($_ -eq "application/octet-stream") } { $VersionText = $StringContent } + { ($_ -eq "text/plain") } { $VersionText = $StringContent } + { ($_ -eq "text/plain; charset=UTF-8") } { $VersionText = $StringContent } + default { throw "``$Response.Content.Headers.ContentType`` is an unknown .version file content type." } + } + + $VersionInfo = Get-Version-From-LatestVersion-File-Content $VersionText + + return $VersionInfo +} + +function Parse-Jsonfile-For-Version([string]$JSonFile) { + Say-Invocation $MyInvocation + + If (-Not (Test-Path $JSonFile)) { + throw "Unable to find '$JSonFile'" + } + try { + $JSonContent = Get-Content($JSonFile) -Raw | ConvertFrom-Json | Select-Object -expand "sdk" -ErrorAction SilentlyContinue + } + catch { + Say-Error "Json file unreadable: '$JSonFile'" + throw + } + if ($JSonContent) { + try { + $JSonContent.PSObject.Properties | ForEach-Object { + $PropertyName = $_.Name + if ($PropertyName -eq "version") { + $Version = $_.Value + Say-Verbose "Version = $Version" + } + } + } + catch { + Say-Error "Unable to parse the SDK node in '$JSonFile'" + throw + } + } + else { + throw "Unable to find the SDK node in '$JSonFile'" + } + If ($Version -eq $null) { + throw "Unable to find the SDK:version node in '$JSonFile'" + } + return $Version +} + +function Get-Specific-Version-From-Version([string]$AzureFeed, [string]$Channel, [string]$Version, [string]$JSonFile) { + Say-Invocation $MyInvocation + + if (-not $JSonFile) { + if ($Version.ToLowerInvariant() -eq "latest") { + $LatestVersionInfo = Get-Version-From-LatestVersion-File -AzureFeed $AzureFeed -Channel $Channel + return $LatestVersionInfo.Version + } + else { + return $Version + } + } + else { + return Parse-Jsonfile-For-Version $JSonFile + } +} + +function Get-Download-Link([string]$AzureFeed, [string]$SpecificVersion, [string]$CLIArchitecture) { + Say-Invocation $MyInvocation + + # If anything fails in this lookup it will default to $SpecificVersion + $SpecificProductVersion = Get-Product-Version -AzureFeed $AzureFeed -SpecificVersion $SpecificVersion + + if ($Runtime -eq "dotnet") { + $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" + } + elseif ($Runtime -eq "aspnetcore") { + $PayloadURL = "$AzureFeed/aspnetcore/Runtime/$SpecificVersion/aspnetcore-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" + } + elseif ($Runtime -eq "windowsdesktop") { + # The windows desktop runtime is part of the core runtime layout prior to 5.0 + $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/windowsdesktop-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" + if ($SpecificVersion -match '^(\d+)\.(.*)$') + { + $majorVersion = [int]$Matches[1] + if ($majorVersion -ge 5) + { + $PayloadURL = "$AzureFeed/WindowsDesktop/$SpecificVersion/windowsdesktop-runtime-$SpecificProductVersion-win-$CLIArchitecture.zip" + } + } + } + elseif (-not $Runtime) { + $PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-sdk-$SpecificProductVersion-win-$CLIArchitecture.zip" + } + else { + throw "Invalid value for `$Runtime" + } + + Say-Verbose "Constructed primary named payload URL: $PayloadURL" + + return $PayloadURL, $SpecificProductVersion +} + +function Get-LegacyDownload-Link([string]$AzureFeed, [string]$SpecificVersion, [string]$CLIArchitecture) { + Say-Invocation $MyInvocation + + if (-not $Runtime) { + $PayloadURL = "$AzureFeed/Sdk/$SpecificVersion/dotnet-dev-win-$CLIArchitecture.$SpecificVersion.zip" + } + elseif ($Runtime -eq "dotnet") { + $PayloadURL = "$AzureFeed/Runtime/$SpecificVersion/dotnet-win-$CLIArchitecture.$SpecificVersion.zip" + } + else { + return $null + } + + Say-Verbose "Constructed legacy named payload URL: $PayloadURL" + + return $PayloadURL +} + +function Get-Product-Version([string]$AzureFeed, [string]$SpecificVersion, [string]$PackageDownloadLink) { + Say-Invocation $MyInvocation + + # Try to get the version number, using the productVersion.txt file located next to the installer file. + $ProductVersionTxtURLs = (Get-Product-Version-Url $AzureFeed $SpecificVersion $PackageDownloadLink -Flattened $true), + (Get-Product-Version-Url $AzureFeed $SpecificVersion $PackageDownloadLink -Flattened $false) + + Foreach ($ProductVersionTxtURL in $ProductVersionTxtURLs) { + Say-Verbose "Checking for the existence of $ProductVersionTxtURL" + + try { + $productVersionResponse = GetHTTPResponse($productVersionTxtUrl) + + if ($productVersionResponse.StatusCode -eq 200) { + $productVersion = $productVersionResponse.Content.ReadAsStringAsync().Result.Trim() + if ($productVersion -ne $SpecificVersion) + { + Say "Using alternate version $productVersion found in $ProductVersionTxtURL" + } + return $productVersion + } + else { + Say-Verbose "Got StatusCode $($productVersionResponse.StatusCode) when trying to get productVersion.txt at $productVersionTxtUrl." + } + } + catch { + Say-Verbose "Could not read productVersion.txt at $productVersionTxtUrl (Exception: '$($_.Exception.Message)'. )" + } + } + + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. + if ([string]::IsNullOrEmpty($PackageDownloadLink)) + { + Say-Verbose "Using the default value '$SpecificVersion' as the product version." + return $SpecificVersion + } + + $productVersion = Get-ProductVersionFromDownloadLink $PackageDownloadLink $SpecificVersion + return $productVersion +} + +function Get-Product-Version-Url([string]$AzureFeed, [string]$SpecificVersion, [string]$PackageDownloadLink, [bool]$Flattened) { + Say-Invocation $MyInvocation + + $majorVersion=$null + if ($SpecificVersion -match '^(\d+)\.(.*)') { + $majorVersion = $Matches[1] -as[int] + } + + $pvFileName='productVersion.txt' + if($Flattened) { + if(-not $Runtime) { + $pvFileName='sdk-productVersion.txt' + } + elseif($Runtime -eq "dotnet") { + $pvFileName='runtime-productVersion.txt' + } + else { + $pvFileName="$Runtime-productVersion.txt" + } + } + + if ([string]::IsNullOrEmpty($PackageDownloadLink)) { + if ($Runtime -eq "dotnet") { + $ProductVersionTxtURL = "$AzureFeed/Runtime/$SpecificVersion/$pvFileName" + } + elseif ($Runtime -eq "aspnetcore") { + $ProductVersionTxtURL = "$AzureFeed/aspnetcore/Runtime/$SpecificVersion/$pvFileName" + } + elseif ($Runtime -eq "windowsdesktop") { + # The windows desktop runtime is part of the core runtime layout prior to 5.0 + $ProductVersionTxtURL = "$AzureFeed/Runtime/$SpecificVersion/$pvFileName" + if ($majorVersion -ne $null -and $majorVersion -ge 5) { + $ProductVersionTxtURL = "$AzureFeed/WindowsDesktop/$SpecificVersion/$pvFileName" + } + } + elseif (-not $Runtime) { + $ProductVersionTxtURL = "$AzureFeed/Sdk/$SpecificVersion/$pvFileName" + } + else { + throw "Invalid value '$Runtime' specified for `$Runtime" + } + } + else { + $ProductVersionTxtURL = $PackageDownloadLink.Substring(0, $PackageDownloadLink.LastIndexOf("/")) + "/$pvFileName" + } + + Say-Verbose "Constructed productVersion link: $ProductVersionTxtURL" + + return $ProductVersionTxtURL +} + +function Get-ProductVersionFromDownloadLink([string]$PackageDownloadLink, [string]$SpecificVersion) +{ + Say-Invocation $MyInvocation + + #product specific version follows the product name + #for filename 'dotnet-sdk-3.1.404-win-x64.zip': the product version is 3.1.400 + $filename = $PackageDownloadLink.Substring($PackageDownloadLink.LastIndexOf("/") + 1) + $filenameParts = $filename.Split('-') + if ($filenameParts.Length -gt 2) + { + $productVersion = $filenameParts[2] + Say-Verbose "Extracted product version '$productVersion' from download link '$PackageDownloadLink'." + } + else { + Say-Verbose "Using the default value '$SpecificVersion' as the product version." + $productVersion = $SpecificVersion + } + return $productVersion +} + +function Get-User-Share-Path() { + Say-Invocation $MyInvocation + + $InstallRoot = $env:DOTNET_INSTALL_DIR + if (!$InstallRoot) { + $InstallRoot = "$env:LocalAppData\Microsoft\dotnet" + } + return $InstallRoot +} + +function Resolve-Installation-Path([string]$InstallDir) { + Say-Invocation $MyInvocation + + if ($InstallDir -eq "") { + return Get-User-Share-Path + } + return $InstallDir +} + +function Is-Dotnet-Package-Installed([string]$InstallRoot, [string]$RelativePathToPackage, [string]$SpecificVersion) { + Say-Invocation $MyInvocation + + $DotnetPackagePath = Join-Path -Path $InstallRoot -ChildPath $RelativePathToPackage | Join-Path -ChildPath $SpecificVersion + Say-Verbose "Is-Dotnet-Package-Installed: DotnetPackagePath=$DotnetPackagePath" + return Test-Path $DotnetPackagePath -PathType Container +} + +function Get-Absolute-Path([string]$RelativeOrAbsolutePath) { + # Too much spam + # Say-Invocation $MyInvocation + + return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RelativeOrAbsolutePath) +} + +function Get-Path-Prefix-With-Version($path) { + # example path with regex: shared/1.0.0-beta-12345/somepath + $match = [regex]::match($path, "/\d+\.\d+[^/]+/") + if ($match.Success) { + return $entry.FullName.Substring(0, $match.Index + $match.Length) + } + + return $null +} + +function Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package([System.IO.Compression.ZipArchive]$Zip, [string]$OutPath) { + Say-Invocation $MyInvocation + + $ret = @() + foreach ($entry in $Zip.Entries) { + $dir = Get-Path-Prefix-With-Version $entry.FullName + if ($null -ne $dir) { + $path = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $dir) + if (-Not (Test-Path $path -PathType Container)) { + $ret += $dir + } + } + } + + $ret = $ret | Sort-Object | Get-Unique + + $values = ($ret | foreach { "$_" }) -join ";" + Say-Verbose "Directories to unpack: $values" + + return $ret +} + +# Example zip content and extraction algorithm: +# Rule: files if extracted are always being extracted to the same relative path locally +# .\ +# a.exe # file does not exist locally, extract +# b.dll # file exists locally, override only if $OverrideFiles set +# aaa\ # same rules as for files +# ... +# abc\1.0.0\ # directory contains version and exists locally +# ... # do not extract content under versioned part +# abc\asd\ # same rules as for files +# ... +# def\ghi\1.0.1\ # directory contains version and does not exist locally +# ... # extract content +function Extract-Dotnet-Package([string]$ZipPath, [string]$OutPath) { + Say-Invocation $MyInvocation + + Load-Assembly -Assembly System.IO.Compression.FileSystem + Set-Variable -Name Zip + try { + $Zip = [System.IO.Compression.ZipFile]::OpenRead($ZipPath) + + $DirectoriesToUnpack = Get-List-Of-Directories-And-Versions-To-Unpack-From-Dotnet-Package -Zip $Zip -OutPath $OutPath + + foreach ($entry in $Zip.Entries) { + $PathWithVersion = Get-Path-Prefix-With-Version $entry.FullName + if (($null -eq $PathWithVersion) -Or ($DirectoriesToUnpack -contains $PathWithVersion)) { + $DestinationPath = Get-Absolute-Path $(Join-Path -Path $OutPath -ChildPath $entry.FullName) + $DestinationDir = Split-Path -Parent $DestinationPath + $OverrideFiles=$OverrideNonVersionedFiles -Or (-Not (Test-Path $DestinationPath)) + if ((-Not $DestinationPath.EndsWith("\")) -And $OverrideFiles) { + New-Item -ItemType Directory -Force -Path $DestinationDir | Out-Null + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $DestinationPath, $OverrideNonVersionedFiles) + } + } + } + } + catch + { + Say-Error "Failed to extract package. Exception: $_" + throw; + } + finally { + if ($null -ne $Zip) { + $Zip.Dispose() + } + } +} + +function DownloadFile($Source, [string]$OutPath) { + if ($Source -notlike "http*") { + # Using System.IO.Path.GetFullPath to get the current directory + # does not work in this context - $pwd gives the current directory + if (![System.IO.Path]::IsPathRooted($Source)) { + $Source = $(Join-Path -Path $pwd -ChildPath $Source) + } + $Source = Get-Absolute-Path $Source + Say "Copying file from $Source to $OutPath" + Copy-Item $Source $OutPath + return + } + + $Stream = $null + + try { + $Response = GetHTTPResponse -Uri $Source + $Stream = $Response.Content.ReadAsStreamAsync().Result + $File = [System.IO.File]::Create($OutPath) + $Stream.CopyTo($File) + $File.Close() + + ValidateRemoteLocalFileSizes -LocalFileOutPath $OutPath -SourceUri $Source + } + finally { + if ($null -ne $Stream) { + $Stream.Dispose() + } + } +} + +function ValidateRemoteLocalFileSizes([string]$LocalFileOutPath, $SourceUri) { + try { + $remoteFileSize = Get-Remote-File-Size -zipUri $SourceUri + $fileSize = [long](Get-Item $LocalFileOutPath).Length + Say "Downloaded file $SourceUri size is $fileSize bytes." + + if ((![string]::IsNullOrEmpty($remoteFileSize)) -and !([string]::IsNullOrEmpty($fileSize)) ) { + if ($remoteFileSize -ne $fileSize) { + Say "The remote and local file sizes are not equal. Remote file size is $remoteFileSize bytes and local size is $fileSize bytes. The local package may be corrupted." + } + else { + Say "The remote and local file sizes are equal." + } + } + else { + Say "Either downloaded or local package size can not be measured. One of them may be corrupted." + } + } + catch { + Say "Either downloaded or local package size can not be measured. One of them may be corrupted." + } +} + +function SafeRemoveFile($Path) { + try { + if (Test-Path $Path) { + Remove-Item $Path + Say-Verbose "The temporary file `"$Path`" was removed." + } + else { + Say-Verbose "The temporary file `"$Path`" does not exist, therefore is not removed." + } + } + catch { + Say-Warning "Failed to remove the temporary file: `"$Path`", remove it manually." + } +} + +function Prepend-Sdk-InstallRoot-To-Path([string]$InstallRoot) { + $BinPath = Get-Absolute-Path $(Join-Path -Path $InstallRoot -ChildPath "") + if (-Not $NoPath) { + $SuffixedBinPath = "$BinPath;" + if (-Not $env:path.Contains($SuffixedBinPath)) { + Say "Adding to current process PATH: `"$BinPath`". Note: This change will not be visible if PowerShell was run as a child process." + $env:path = $SuffixedBinPath + $env:path + } else { + Say-Verbose "Current process PATH already contains `"$BinPath`"" + } + } + else { + Say "Binaries of dotnet can be found in $BinPath" + } +} + +function PrintDryRunOutput($Invocation, $DownloadLinks) +{ + Say "Payload URLs:" + + for ($linkIndex=0; $linkIndex -lt $DownloadLinks.count; $linkIndex++) { + Say "URL #$linkIndex - $($DownloadLinks[$linkIndex].type): $($DownloadLinks[$linkIndex].downloadLink)" + } + $RepeatableCommand = ".\$ScriptName -Version `"$SpecificVersion`" -InstallDir `"$InstallRoot`" -Architecture `"$CLIArchitecture`"" + if ($Runtime -eq "dotnet") { + $RepeatableCommand+=" -Runtime `"dotnet`"" + } + elseif ($Runtime -eq "aspnetcore") { + $RepeatableCommand+=" -Runtime `"aspnetcore`"" + } + + foreach ($key in $Invocation.BoundParameters.Keys) { + if (-not (@("Architecture","Channel","DryRun","InstallDir","Runtime","SharedRuntime","Version","Quality","FeedCredential") -contains $key)) { + $RepeatableCommand+=" -$key `"$($Invocation.BoundParameters[$key])`"" + } + } + if ($Invocation.BoundParameters.Keys -contains "FeedCredential") { + $RepeatableCommand+=" -FeedCredential `"`"" + } + Say "Repeatable invocation: $RepeatableCommand" + if ($SpecificVersion -ne $EffectiveVersion) + { + Say "NOTE: Due to finding a version manifest with this runtime, it would actually install with version '$EffectiveVersion'" + } +} + +function Get-AkaMSDownloadLink([string]$Channel, [string]$Quality, [bool]$Internal, [string]$Product, [string]$Architecture) { + Say-Invocation $MyInvocation + + #quality is not supported for LTS or STS channel + if (![string]::IsNullOrEmpty($Quality) -and (@("LTS", "STS") -contains $Channel)) { + $Quality = "" + Say-Warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." + } + Say-Verbose "Retrieving primary payload URL from aka.ms link for channel: '$Channel', quality: '$Quality' product: '$Product', os: 'win', architecture: '$Architecture'." + + #construct aka.ms link + $akaMsLink = "https://aka.ms/dotnet" + if ($Internal) { + $akaMsLink += "/internal" + } + $akaMsLink += "/$Channel" + if (-not [string]::IsNullOrEmpty($Quality)) { + $akaMsLink +="/$Quality" + } + $akaMsLink +="/$Product-win-$Architecture.zip" + Say-Verbose "Constructed aka.ms link: '$akaMsLink'." + $akaMsDownloadLink=$null + + for ($maxRedirections = 9; $maxRedirections -ge 0; $maxRedirections--) + { + #get HTTP response + #do not pass credentials as a part of the $akaMsLink and do not apply credentials in the GetHTTPResponse function + #otherwise the redirect link would have credentials as well + #it would result in applying credentials twice to the resulting link and thus breaking it, and in echoing credentials to the output as a part of redirect link + $Response= GetHTTPResponse -Uri $akaMsLink -HeaderOnly $true -DisableRedirect $true -DisableFeedCredential $true + Say-Verbose "Received response:`n$Response" + + if ([string]::IsNullOrEmpty($Response)) { + Say-Verbose "The link '$akaMsLink' is not valid: failed to get redirect location. The resource is not available." + return $null + } + + #if HTTP code is 301 (Moved Permanently), the redirect link exists + if ($Response.StatusCode -eq 301) + { + try { + $akaMsDownloadLink = $Response.Headers.GetValues("Location")[0] + + if ([string]::IsNullOrEmpty($akaMsDownloadLink)) { + Say-Verbose "The link '$akaMsLink' is not valid: server returned 301 (Moved Permanently), but the headers do not contain the redirect location." + return $null + } + + Say-Verbose "The redirect location retrieved: '$akaMsDownloadLink'." + # This may yet be a link to another redirection. Attempt to retrieve the page again. + $akaMsLink = $akaMsDownloadLink + continue + } + catch { + Say-Verbose "The link '$akaMsLink' is not valid: failed to get redirect location." + return $null + } + } + elseif ((($Response.StatusCode -lt 300) -or ($Response.StatusCode -ge 400)) -and (-not [string]::IsNullOrEmpty($akaMsDownloadLink))) + { + # Redirections have ended. + return $akaMsDownloadLink + } + + Say-Verbose "The link '$akaMsLink' is not valid: failed to retrieve the redirection location." + return $null + } + + Say-Verbose "Aka.ms links have redirected more than the maximum allowed redirections. This may be caused by a cyclic redirection of aka.ms links." + return $null + +} + +function Get-AkaMsLink-And-Version([string] $NormalizedChannel, [string] $NormalizedQuality, [bool] $Internal, [string] $ProductName, [string] $Architecture) { + $AkaMsDownloadLink = Get-AkaMSDownloadLink -Channel $NormalizedChannel -Quality $NormalizedQuality -Internal $Internal -Product $ProductName -Architecture $Architecture + + if ([string]::IsNullOrEmpty($AkaMsDownloadLink)){ + if (-not [string]::IsNullOrEmpty($NormalizedQuality)) { + # if quality is specified - exit with error - there is no fallback approach + Say-Error "Failed to locate the latest version in the channel '$NormalizedChannel' with '$NormalizedQuality' quality for '$ProductName', os: 'win', architecture: '$Architecture'." + Say-Error "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support." + throw "aka.ms link resolution failure" + } + Say-Verbose "Falling back to latest.version file approach." + return ($null, $null, $null) + } + else { + Say-Verbose "Retrieved primary named payload URL from aka.ms link: '$AkaMsDownloadLink'." + Say-Verbose "Downloading using legacy url will not be attempted." + + #get version from the path + $pathParts = $AkaMsDownloadLink.Split('/') + if ($pathParts.Length -ge 2) { + $SpecificVersion = $pathParts[$pathParts.Length - 2] + Say-Verbose "Version: '$SpecificVersion'." + } + else { + Say-Error "Failed to extract the version from download link '$AkaMsDownloadLink'." + return ($null, $null, $null) + } + + #retrieve effective (product) version + $EffectiveVersion = Get-Product-Version -SpecificVersion $SpecificVersion -PackageDownloadLink $AkaMsDownloadLink + Say-Verbose "Product version: '$EffectiveVersion'." + + return ($AkaMsDownloadLink, $SpecificVersion, $EffectiveVersion); + } +} + +function Get-Feeds-To-Use() +{ + $feeds = @( + "https://dotnetcli.azureedge.net/dotnet", + "https://dotnetbuilds.azureedge.net/public" + ) + + if (-not [string]::IsNullOrEmpty($AzureFeed)) { + $feeds = @($AzureFeed) + } + + if ($NoCdn) { + $feeds = @( + "https://dotnetcli.blob.core.windows.net/dotnet", + "https://dotnetbuilds.blob.core.windows.net/public" + ) + + if (-not [string]::IsNullOrEmpty($UncachedFeed)) { + $feeds = @($UncachedFeed) + } + } + + return $feeds +} + +function Resolve-AssetName-And-RelativePath([string] $Runtime) { + + if ($Runtime -eq "dotnet") { + $assetName = ".NET Core Runtime" + $dotnetPackageRelativePath = "shared\Microsoft.NETCore.App" + } + elseif ($Runtime -eq "aspnetcore") { + $assetName = "ASP.NET Core Runtime" + $dotnetPackageRelativePath = "shared\Microsoft.AspNetCore.App" + } + elseif ($Runtime -eq "windowsdesktop") { + $assetName = ".NET Core Windows Desktop Runtime" + $dotnetPackageRelativePath = "shared\Microsoft.WindowsDesktop.App" + } + elseif (-not $Runtime) { + $assetName = ".NET Core SDK" + $dotnetPackageRelativePath = "sdk" + } + else { + throw "Invalid value for `$Runtime" + } + + return ($assetName, $dotnetPackageRelativePath) +} + +function Prepare-Install-Directory { + $diskSpaceWarning = "Failed to check the disk space. Installation will continue, but it may fail if you do not have enough disk space."; + + if ($PSVersionTable.PSVersion.Major -lt 7) { + Say-Verbose $diskSpaceWarning + return + } + + New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null + + $installDrive = $((Get-Item $InstallRoot -Force).PSDrive.Name); + $diskInfo = $null + try { + $diskInfo = Get-PSDrive -Name $installDrive + } + catch { + Say-Warning $diskSpaceWarning + } + + # The check is relevant for PS version >= 7, the result can be irrelevant for older versions. See https://github.com/PowerShell/PowerShell/issues/12442. + if ( ($null -ne $diskInfo) -and ($diskInfo.Free / 1MB -le 100)) { + throw "There is not enough disk space on drive ${installDrive}:" + } +} + +Say-Verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" +Say-Verbose "- The SDK needs to be installed without user interaction and without admin rights." +Say-Verbose "- The SDK installation doesn't need to persist across multiple CI runs." +Say-Verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.`r`n" + +if ($SharedRuntime -and (-not $Runtime)) { + $Runtime = "dotnet" +} + +$OverrideNonVersionedFiles = !$SkipNonVersionedFiles + +Measure-Action "Product discovery" { + $script:CLIArchitecture = Get-CLIArchitecture-From-Architecture $Architecture + $script:NormalizedQuality = Get-NormalizedQuality $Quality + Say-Verbose "Normalized quality: '$NormalizedQuality'" + $script:NormalizedChannel = Get-NormalizedChannel $Channel + Say-Verbose "Normalized channel: '$NormalizedChannel'" + $script:NormalizedProduct = Get-NormalizedProduct $Runtime + Say-Verbose "Normalized product: '$NormalizedProduct'" + $script:FeedCredential = ValidateFeedCredential $FeedCredential +} + +$InstallRoot = Resolve-Installation-Path $InstallDir +Say-Verbose "InstallRoot: $InstallRoot" +$ScriptName = $MyInvocation.MyCommand.Name +($assetName, $dotnetPackageRelativePath) = Resolve-AssetName-And-RelativePath -Runtime $Runtime + +$feeds = Get-Feeds-To-Use +$DownloadLinks = @() + +if ($Version.ToLowerInvariant() -ne "latest" -and -not [string]::IsNullOrEmpty($Quality)) { + throw "Quality and Version options are not allowed to be specified simultaneously. See https:// learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for details." +} + +# aka.ms links can only be used if the user did not request a specific version via the command line or a global.json file. +if ([string]::IsNullOrEmpty($JSonFile) -and ($Version -eq "latest")) { + ($DownloadLink, $SpecificVersion, $EffectiveVersion) = Get-AkaMsLink-And-Version $NormalizedChannel $NormalizedQuality $Internal $NormalizedProduct $CLIArchitecture + + if ($null -ne $DownloadLink) { + $DownloadLinks += New-Object PSObject -Property @{downloadLink="$DownloadLink";specificVersion="$SpecificVersion";effectiveVersion="$EffectiveVersion";type='aka.ms'} + Say-Verbose "Generated aka.ms link $DownloadLink with version $EffectiveVersion" + + if (-Not $DryRun) { + Say-Verbose "Checking if the version $EffectiveVersion is already installed" + if (Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $EffectiveVersion) + { + Say "$assetName with version '$EffectiveVersion' is already installed." + Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot + return + } + } + } +} + +# Primary and legacy links cannot be used if a quality was specified. +# If we already have an aka.ms link, no need to search the blob feeds. +if ([string]::IsNullOrEmpty($NormalizedQuality) -and 0 -eq $DownloadLinks.count) +{ + foreach ($feed in $feeds) { + try { + $SpecificVersion = Get-Specific-Version-From-Version -AzureFeed $feed -Channel $Channel -Version $Version -JSonFile $JSonFile + $DownloadLink, $EffectiveVersion = Get-Download-Link -AzureFeed $feed -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture + $LegacyDownloadLink = Get-LegacyDownload-Link -AzureFeed $feed -SpecificVersion $SpecificVersion -CLIArchitecture $CLIArchitecture + + $DownloadLinks += New-Object PSObject -Property @{downloadLink="$DownloadLink";specificVersion="$SpecificVersion";effectiveVersion="$EffectiveVersion";type='primary'} + Say-Verbose "Generated primary link $DownloadLink with version $EffectiveVersion" + + if (-not [string]::IsNullOrEmpty($LegacyDownloadLink)) { + $DownloadLinks += New-Object PSObject -Property @{downloadLink="$LegacyDownloadLink";specificVersion="$SpecificVersion";effectiveVersion="$EffectiveVersion";type='legacy'} + Say-Verbose "Generated legacy link $LegacyDownloadLink with version $EffectiveVersion" + } + + if (-Not $DryRun) { + Say-Verbose "Checking if the version $EffectiveVersion is already installed" + if (Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $EffectiveVersion) + { + Say "$assetName with version '$EffectiveVersion' is already installed." + Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot + return + } + } + } + catch + { + Say-Verbose "Failed to acquire download links from feed $feed. Exception: $_" + } + } +} + +if ($DownloadLinks.count -eq 0) { + throw "Failed to resolve the exact version number." +} + +if ($DryRun) { + PrintDryRunOutput $MyInvocation $DownloadLinks + return +} + +Measure-Action "Installation directory preparation" { Prepare-Install-Directory } + +Say-Verbose "Zip path: $ZipPath" + +$DownloadSucceeded = $false +$DownloadedLink = $null +$ErrorMessages = @() + +foreach ($link in $DownloadLinks) +{ + Say-Verbose "Downloading `"$($link.type)`" link $($link.downloadLink)" + + try { + Measure-Action "Package download" { DownloadFile -Source $link.downloadLink -OutPath $ZipPath } + Say-Verbose "Download succeeded." + $DownloadSucceeded = $true + $DownloadedLink = $link + break + } + catch { + $StatusCode = $null + $ErrorMessage = $null + + if ($PSItem.Exception.Data.Contains("StatusCode")) { + $StatusCode = $PSItem.Exception.Data["StatusCode"] + } + + if ($PSItem.Exception.Data.Contains("ErrorMessage")) { + $ErrorMessage = $PSItem.Exception.Data["ErrorMessage"] + } else { + $ErrorMessage = $PSItem.Exception.Message + } + + Say-Verbose "Download failed with status code $StatusCode. Error message: $ErrorMessage" + $ErrorMessages += "Downloading from `"$($link.type)`" link has failed with error:`nUri: $($link.downloadLink)`nStatusCode: $StatusCode`nError: $ErrorMessage" + } + + # This link failed. Clean up before trying the next one. + SafeRemoveFile -Path $ZipPath +} + +if (-not $DownloadSucceeded) { + foreach ($ErrorMessage in $ErrorMessages) { + Say-Error $ErrorMessages + } + + throw "Could not find `"$assetName`" with version = $($DownloadLinks[0].effectiveVersion)`nRefer to: https://aka.ms/dotnet-os-lifecycle for information on .NET support" +} + +Say "Extracting the archive." +Measure-Action "Package extraction" { Extract-Dotnet-Package -ZipPath $ZipPath -OutPath $InstallRoot } + +# Check if the SDK version is installed; if not, fail the installation. +$isAssetInstalled = $false + +# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. +if ($DownloadedLink.effectiveVersion -Match "rtm" -or $DownloadedLink.effectiveVersion -Match "servicing") { + $ReleaseVersion = $DownloadedLink.effectiveVersion.Split("-")[0] + Say-Verbose "Checking installation: version = $ReleaseVersion" + $isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $ReleaseVersion +} + +# Check if the SDK version is installed. +if (!$isAssetInstalled) { + Say-Verbose "Checking installation: version = $($DownloadedLink.effectiveVersion)" + $isAssetInstalled = Is-Dotnet-Package-Installed -InstallRoot $InstallRoot -RelativePathToPackage $dotnetPackageRelativePath -SpecificVersion $DownloadedLink.effectiveVersion +} + +# Version verification failed. More likely something is wrong either with the downloaded content or with the verification algorithm. +if (!$isAssetInstalled) { + Say-Error "Failed to verify the version of installed `"$assetName`".`nInstallation source: $($DownloadedLink.downloadLink).`nInstallation location: $InstallRoot.`nReport the bug at https://github.com/dotnet/install-scripts/issues." + throw "`"$assetName`" with version = $($DownloadedLink.effectiveVersion) failed to install with an unknown error." +} + +if (-not $KeepZip) { + SafeRemoveFile -Path $ZipPath +} + +Measure-Action "Setting up shell environment" { Prepend-Sdk-InstallRoot-To-Path -InstallRoot $InstallRoot } + +Say "Note that the script does not resolve dependencies during installation." +Say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install/windows#dependencies" +Say "Installed version is $($DownloadedLink.effectiveVersion)" +Say "Installation finished" +# SIG # Begin signature block +# MIInvwYJKoZIhvcNAQcCoIInsDCCJ6wCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCACRu+yvG+6rftW +# 7639o2K9YFU32HKgY4Dqe9C3db/p7qCCDXYwggX0MIID3KADAgECAhMzAAADTrU8 +# esGEb+srAAAAAANOMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25p +# bmcgUENBIDIwMTEwHhcNMjMwMzE2MTg0MzI5WhcNMjQwMzE0MTg0MzI5WjB0MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMR4wHAYDVQQDExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +# AQDdCKiNI6IBFWuvJUmf6WdOJqZmIwYs5G7AJD5UbcL6tsC+EBPDbr36pFGo1bsU +# p53nRyFYnncoMg8FK0d8jLlw0lgexDDr7gicf2zOBFWqfv/nSLwzJFNP5W03DF/1 +# 1oZ12rSFqGlm+O46cRjTDFBpMRCZZGddZlRBjivby0eI1VgTD1TvAdfBYQe82fhm +# WQkYR/lWmAK+vW/1+bO7jHaxXTNCxLIBW07F8PBjUcwFxxyfbe2mHB4h1L4U0Ofa +# +HX/aREQ7SqYZz59sXM2ySOfvYyIjnqSO80NGBaz5DvzIG88J0+BNhOu2jl6Dfcq +# jYQs1H/PMSQIK6E7lXDXSpXzAgMBAAGjggFzMIIBbzAfBgNVHSUEGDAWBgorBgEE +# AYI3TAgBBggrBgEFBQcDAzAdBgNVHQ4EFgQUnMc7Zn/ukKBsBiWkwdNfsN5pdwAw +# RQYDVR0RBD4wPKQ6MDgxHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEW +# MBQGA1UEBRMNMjMwMDEyKzUwMDUxNjAfBgNVHSMEGDAWgBRIbmTlUAXTgqoXNzci +# tW2oynUClTBUBgNVHR8ETTBLMEmgR6BFhkNodHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpb3BzL2NybC9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDctMDguY3JsMGEG +# CCsGAQUFBwEBBFUwUzBRBggrBgEFBQcwAoZFaHR0cDovL3d3dy5taWNyb3NvZnQu +# Y29tL3BraW9wcy9jZXJ0cy9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDctMDguY3J0 +# MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQELBQADggIBAD21v9pHoLdBSNlFAjmk +# mx4XxOZAPsVxxXbDyQv1+kGDe9XpgBnT1lXnx7JDpFMKBwAyIwdInmvhK9pGBa31 +# TyeL3p7R2s0L8SABPPRJHAEk4NHpBXxHjm4TKjezAbSqqbgsy10Y7KApy+9UrKa2 +# kGmsuASsk95PVm5vem7OmTs42vm0BJUU+JPQLg8Y/sdj3TtSfLYYZAaJwTAIgi7d +# hzn5hatLo7Dhz+4T+MrFd+6LUa2U3zr97QwzDthx+RP9/RZnur4inzSQsG5DCVIM +# pA1l2NWEA3KAca0tI2l6hQNYsaKL1kefdfHCrPxEry8onJjyGGv9YKoLv6AOO7Oh +# JEmbQlz/xksYG2N/JSOJ+QqYpGTEuYFYVWain7He6jgb41JbpOGKDdE/b+V2q/gX +# UgFe2gdwTpCDsvh8SMRoq1/BNXcr7iTAU38Vgr83iVtPYmFhZOVM0ULp/kKTVoir +# IpP2KCxT4OekOctt8grYnhJ16QMjmMv5o53hjNFXOxigkQWYzUO+6w50g0FAeFa8 +# 5ugCCB6lXEk21FFB1FdIHpjSQf+LP/W2OV/HfhC3uTPgKbRtXo83TZYEudooyZ/A +# Vu08sibZ3MkGOJORLERNwKm2G7oqdOv4Qj8Z0JrGgMzj46NFKAxkLSpE5oHQYP1H +# tPx1lPfD7iNSbJsP6LiUHXH1MIIHejCCBWKgAwIBAgIKYQ6Q0gAAAAAAAzANBgkq +# hkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x +# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv +# bjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 +# IDIwMTEwHhcNMTEwNzA4MjA1OTA5WhcNMjYwNzA4MjEwOTA5WjB+MQswCQYDVQQG +# EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG +# A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSgwJgYDVQQDEx9NaWNyb3NvZnQg +# Q29kZSBTaWduaW5nIFBDQSAyMDExMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +# CgKCAgEAq/D6chAcLq3YbqqCEE00uvK2WCGfQhsqa+laUKq4BjgaBEm6f8MMHt03 +# a8YS2AvwOMKZBrDIOdUBFDFC04kNeWSHfpRgJGyvnkmc6Whe0t+bU7IKLMOv2akr +# rnoJr9eWWcpgGgXpZnboMlImEi/nqwhQz7NEt13YxC4Ddato88tt8zpcoRb0Rrrg +# OGSsbmQ1eKagYw8t00CT+OPeBw3VXHmlSSnnDb6gE3e+lD3v++MrWhAfTVYoonpy +# 4BI6t0le2O3tQ5GD2Xuye4Yb2T6xjF3oiU+EGvKhL1nkkDstrjNYxbc+/jLTswM9 +# sbKvkjh+0p2ALPVOVpEhNSXDOW5kf1O6nA+tGSOEy/S6A4aN91/w0FK/jJSHvMAh +# dCVfGCi2zCcoOCWYOUo2z3yxkq4cI6epZuxhH2rhKEmdX4jiJV3TIUs+UsS1Vz8k +# A/DRelsv1SPjcF0PUUZ3s/gA4bysAoJf28AVs70b1FVL5zmhD+kjSbwYuER8ReTB +# w3J64HLnJN+/RpnF78IcV9uDjexNSTCnq47f7Fufr/zdsGbiwZeBe+3W7UvnSSmn +# Eyimp31ngOaKYnhfsi+E11ecXL93KCjx7W3DKI8sj0A3T8HhhUSJxAlMxdSlQy90 +# lfdu+HggWCwTXWCVmj5PM4TasIgX3p5O9JawvEagbJjS4NaIjAsCAwEAAaOCAe0w +# ggHpMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBRIbmTlUAXTgqoXNzcitW2o +# ynUClTAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYD +# VR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRyLToCMZBDuRQFTuHqp8cx0SOJNDBa +# BgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny +# bC9wcm9kdWN0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3JsMF4GCCsG +# AQUFBwEBBFIwUDBOBggrBgEFBQcwAoZCaHR0cDovL3d3dy5taWNyb3NvZnQuY29t +# L3BraS9jZXJ0cy9NaWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3J0MIGfBgNV +# HSAEgZcwgZQwgZEGCSsGAQQBgjcuAzCBgzA/BggrBgEFBQcCARYzaHR0cDovL3d3 +# dy5taWNyb3NvZnQuY29tL3BraW9wcy9kb2NzL3ByaW1hcnljcHMuaHRtMEAGCCsG +# AQUFBwICMDQeMiAdAEwAZQBnAGEAbABfAHAAbwBsAGkAYwB5AF8AcwB0AGEAdABl +# AG0AZQBuAHQALiAdMA0GCSqGSIb3DQEBCwUAA4ICAQBn8oalmOBUeRou09h0ZyKb +# C5YR4WOSmUKWfdJ5DJDBZV8uLD74w3LRbYP+vj/oCso7v0epo/Np22O/IjWll11l +# hJB9i0ZQVdgMknzSGksc8zxCi1LQsP1r4z4HLimb5j0bpdS1HXeUOeLpZMlEPXh6 +# I/MTfaaQdION9MsmAkYqwooQu6SpBQyb7Wj6aC6VoCo/KmtYSWMfCWluWpiW5IP0 +# wI/zRive/DvQvTXvbiWu5a8n7dDd8w6vmSiXmE0OPQvyCInWH8MyGOLwxS3OW560 +# STkKxgrCxq2u5bLZ2xWIUUVYODJxJxp/sfQn+N4sOiBpmLJZiWhub6e3dMNABQam +# ASooPoI/E01mC8CzTfXhj38cbxV9Rad25UAqZaPDXVJihsMdYzaXht/a8/jyFqGa +# J+HNpZfQ7l1jQeNbB5yHPgZ3BtEGsXUfFL5hYbXw3MYbBL7fQccOKO7eZS/sl/ah +# XJbYANahRr1Z85elCUtIEJmAH9AAKcWxm6U/RXceNcbSoqKfenoi+kiVH6v7RyOA +# 9Z74v2u3S5fi63V4GuzqN5l5GEv/1rMjaHXmr/r8i+sLgOppO6/8MO0ETI7f33Vt +# Y5E90Z1WTk+/gFcioXgRMiF670EKsT/7qMykXcGhiJtXcVZOSEXAQsmbdlsKgEhr +# /Xmfwb1tbWrJUnMTDXpQzTGCGZ8wghmbAgEBMIGVMH4xCzAJBgNVBAYTAlVTMRMw +# EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN +# aWNyb3NvZnQgQ29ycG9yYXRpb24xKDAmBgNVBAMTH01pY3Jvc29mdCBDb2RlIFNp +# Z25pbmcgUENBIDIwMTECEzMAAANOtTx6wYRv6ysAAAAAA04wDQYJYIZIAWUDBAIB +# BQCgga4wGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEO +# MAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIPHo6D4ixtuX2mtmXYtzP7Xh +# 5SbbHtBt9hwIKfR9nNCHMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8A +# cwBvAGYAdKEagBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEB +# BQAEggEAKaYy0/f2nIWjmd2w2g7hU/pz6ahK3cIahIejHpTW8JXUR3neUB9oFm8x +# GiAtgKY6zzxKsMGRJfULOEB+jV8y1TK5aAUtNWog8o7i9hl/W3JLsRtcduGhqvR8 +# oYFq4xkYPDwAjklDN96cWNqWmqsUULs/jxx4Ef0o9/2Cy9FWYwvyDK/o0bdfotsl +# +cr3Aj1fIOSkrMKjEoScITOvfGCDgNqVsu+62itzX0QvIq7yW8aqJ5xd2r94IOry +# u6iMdQFYSxR7xpIaDjKLHCH8tTmKAlrFFekhaxe1WuTvNBt154Zl1U7ukSO12s1N +# ezHYEW4AoLd4MO9zmXwDZmo3RLzFHKGCFykwghclBgorBgEEAYI3AwMBMYIXFTCC +# FxEGCSqGSIb3DQEHAqCCFwIwghb+AgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFZBgsq +# hkiG9w0BCRABBKCCAUgEggFEMIIBQAIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFl +# AwQCAQUABCCiX6fcUDSacytCBP6o92QnwRIQCE6w6Se15jgm1UebNAIGZN/N9Z2v +# GBMyMDIzMDkxODEwMDUxOS4zMjJaMASAAgH0oIHYpIHVMIHSMQswCQYDVQQGEwJV +# UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE +# ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJl +# bGFuZCBPcGVyYXRpb25zIExpbWl0ZWQxJjAkBgNVBAsTHVRoYWxlcyBUU1MgRVNO +# OkQwODItNEJGRC1FRUJBMSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBT +# ZXJ2aWNloIIReDCCBycwggUPoAMCAQICEzMAAAG6Hz8Z98F1vXwAAQAAAbowDQYJ +# KoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x +# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv +# bjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwHhcNMjIw +# OTIwMjAyMjE5WhcNMjMxMjE0MjAyMjE5WjCB0jELMAkGA1UEBhMCVVMxEzARBgNV +# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv +# c29mdCBDb3Jwb3JhdGlvbjEtMCsGA1UECxMkTWljcm9zb2Z0IElyZWxhbmQgT3Bl +# cmF0aW9ucyBMaW1pdGVkMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpEMDgyLTRC +# RkQtRUVCQTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZTCC +# AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIhOFYMzkjWAE9UVnXF9hRGv +# 0xBRxc+I5Hu3hxVFXyK3u38xusEb0pLkwjgGtDsaLLbrlMxqX3tFb/3BgEPEC3L0 +# wX76gD8zHt+wiBV5mq5BWop29qRrgMJKKCPcpQnSjs9B/4XMFFvrpdPicZDv43FL +# gz9fHqMq0LJDw5JAHGDS30TCY9OF43P4d44Z9lE7CaVS2pJMF3L453MXB5yYK/KD +# bilhERP1jxn2yl+tGCRguIAsMG0oeOhXaw8uSGOhS6ACSHb+ebi0038MFHyoTNhK +# f+SYo4OpSY3xP4+swBBTKDoYP1wH+CfxG6h9fymBJQPQZaqfl0riiDLjmDunQtH1 +# GD64Air5k9Jdwhq5wLmSWXjyFVL+IDfOpdixJ6f5o+MhE6H4t31w+prygHmd2UHQ +# 657UGx6FNuzwC+SpAHmV76MZYac4uAhTgaP47P2eeS1ockvyhl9ya+9JzPfMkug3 +# xevzFADWiLRMr066EMV7q3JSRAsnCS9GQ08C4FKPbSh8OPM33Lng0ffxANnHAAX/ +# DE7cHcx7l9jaV3Acmkj7oqir4Eh2u5YxwiaTE37XaMumX2ES3PJ5NBaXq7YdLJwy +# SD+U9pk/tl4dQ1t/Eeo7uDTliOyQkD8I74xpVB0T31/67KHfkBkFVvy6wye21V+9 +# IC8uSD++RgD3RwtN2kE/AgMBAAGjggFJMIIBRTAdBgNVHQ4EFgQUimLm8QMeJa25 +# j9MWeabI2HSvZOUwHwYDVR0jBBgwFoAUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXwYD +# VR0fBFgwVjBUoFKgUIZOaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9j +# cmwvTWljcm9zb2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAoMSkuY3JsMGwG +# CCsGAQUFBwEBBGAwXjBcBggrBgEFBQcwAoZQaHR0cDovL3d3dy5taWNyb3NvZnQu +# Y29tL3BraW9wcy9jZXJ0cy9NaWNyb3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIw +# MjAxMCgxKS5jcnQwDAYDVR0TAQH/BAIwADAWBgNVHSUBAf8EDDAKBggrBgEFBQcD +# CDAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggIBAF/I8U6hbZhvDcn9 +# 6nZ6tkbSEjXPvKZ6wroaXcgstEhpgaeEwleLuPXHLzEWtuJuYz4eshmhXqFr49lb +# AcX5SN5/cEsP0xdFayb7U5P94JZd3HjFvpWRNoNBhF3SDM0A38sI2H+hjhB/VfX1 +# XcZiei1ROPAyCHcBgHLyQrEu6mnb3HhbIdr8h0Ta7WFylGhLSFW6wmzKusP6aOlm +# nGSac5NMfla6lRvTYHd28rbbCgfSm1RhTgoZj+W8DTKtiEMwubHJ3mIPKmo8xtJI +# WXPnXq6XKgldrL5cynLMX/0WX65OuWbHV5GTELdfWvGV3DaZrHPUQ/UP31Keqb2x +# jVCb30LVwgbjIvYS77N1dARkN8F/9pJ1gO4IvZWMwyMlKKFGojO1f1wbjSWcA/57 +# tsc+t2blrMWgSNHgzDr01jbPSupRjy3Ht9ZZs4xN02eiX3eG297NrtC6l4c/gzn2 +# 0eqoqWx/uHWxmTgB0F5osBuTHOe77DyEA0uhArGlgKP91jghgt/OVHoH65g0QqCt +# gZ+36mnCEg6IOhFoFrCc0fJFGVmb1+17gEe+HRMM7jBk4O06J+IooFrI3e3PJjPr +# Qano/MyE3h+zAuBWGMDRcUlNKCDU7dGnWvH3XWwLrCCIcz+3GwRUMsLsDdPW2OVv +# 7v1eEJiMSIZ2P+M7L20Q8aznU4OAMIIHcTCCBVmgAwIBAgITMwAAABXF52ueAptJ +# mQAAAAAAFTANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT +# Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29m +# dCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNh +# dGUgQXV0aG9yaXR5IDIwMTAwHhcNMjEwOTMwMTgyMjI1WhcNMzAwOTMwMTgzMjI1 +# WjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH +# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQD +# Ex1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCAiIwDQYJKoZIhvcNAQEB +# BQADggIPADCCAgoCggIBAOThpkzntHIhC3miy9ckeb0O1YLT/e6cBwfSqWxOdcjK +# NVf2AX9sSuDivbk+F2Az/1xPx2b3lVNxWuJ+Slr+uDZnhUYjDLWNE893MsAQGOhg +# fWpSg0S3po5GawcU88V29YZQ3MFEyHFcUTE3oAo4bo3t1w/YJlN8OWECesSq/XJp +# rx2rrPY2vjUmZNqYO7oaezOtgFt+jBAcnVL+tuhiJdxqD89d9P6OU8/W7IVWTe/d +# vI2k45GPsjksUZzpcGkNyjYtcI4xyDUoveO0hyTD4MmPfrVUj9z6BVWYbWg7mka9 +# 7aSueik3rMvrg0XnRm7KMtXAhjBcTyziYrLNueKNiOSWrAFKu75xqRdbZ2De+JKR +# Hh09/SDPc31BmkZ1zcRfNN0Sidb9pSB9fvzZnkXftnIv231fgLrbqn427DZM9itu +# qBJR6L8FA6PRc6ZNN3SUHDSCD/AQ8rdHGO2n6Jl8P0zbr17C89XYcz1DTsEzOUyO +# ArxCaC4Q6oRRRuLRvWoYWmEBc8pnol7XKHYC4jMYctenIPDC+hIK12NvDMk2ZItb +# oKaDIV1fMHSRlJTYuVD5C4lh8zYGNRiER9vcG9H9stQcxWv2XFJRXRLbJbqvUAV6 +# bMURHXLvjflSxIUXk8A8FdsaN8cIFRg/eKtFtvUeh17aj54WcmnGrnu3tz5q4i6t +# AgMBAAGjggHdMIIB2TASBgkrBgEEAYI3FQEEBQIDAQABMCMGCSsGAQQBgjcVAgQW +# BBQqp1L+ZMSavoKRPEY1Kc8Q/y8E7jAdBgNVHQ4EFgQUn6cVXQBeYl2D9OXSZacb +# UzUZ6XIwXAYDVR0gBFUwUzBRBgwrBgEEAYI3TIN9AQEwQTA/BggrBgEFBQcCARYz +# aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9Eb2NzL1JlcG9zaXRvcnku +# aHRtMBMGA1UdJQQMMAoGCCsGAQUFBwMIMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIA +# QwBBMAsGA1UdDwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNX2 +# VsuP6KJcYmjRPZSQW9fOmhjEMFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwu +# bWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEw +# LTA2LTIzLmNybDBaBggrBgEFBQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93 +# d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYt +# MjMuY3J0MA0GCSqGSIb3DQEBCwUAA4ICAQCdVX38Kq3hLB9nATEkW+Geckv8qW/q +# XBS2Pk5HZHixBpOXPTEztTnXwnE2P9pkbHzQdTltuw8x5MKP+2zRoZQYIu7pZmc6 +# U03dmLq2HnjYNi6cqYJWAAOwBb6J6Gngugnue99qb74py27YP0h1AdkY3m2CDPVt +# I1TkeFN1JFe53Z/zjj3G82jfZfakVqr3lbYoVSfQJL1AoL8ZthISEV09J+BAljis +# 9/kpicO8F7BUhUKz/AyeixmJ5/ALaoHCgRlCGVJ1ijbCHcNhcy4sa3tuPywJeBTp +# kbKpW99Jo3QMvOyRgNI95ko+ZjtPu4b6MhrZlvSP9pEB9s7GdP32THJvEKt1MMU0 +# sHrYUP4KWN1APMdUbZ1jdEgssU5HLcEUBHG/ZPkkvnNtyo4JvbMBV0lUZNlz138e +# W0QBjloZkWsNn6Qo3GcZKCS6OEuabvshVGtqRRFHqfG3rsjoiV5PndLQTHa1V1QJ +# sWkBRH58oWFsc/4Ku+xBZj1p/cvBQUl+fpO+y/g75LcVv7TOPqUxUYS8vwLBgqJ7 +# Fx0ViY1w/ue10CgaiQuPNtq6TPmb/wrpNPgkNWcr4A245oyZ1uEi6vAnQj0llOZ0 +# dFtq0Z4+7X6gMTN9vMvpe784cETRkPHIqzqKOghif9lwY1NNje6CbaUFEMFxBmoQ +# tB1VM1izoXBm8qGCAtQwggI9AgEBMIIBAKGB2KSB1TCB0jELMAkGA1UEBhMCVVMx +# EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoT +# FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEtMCsGA1UECxMkTWljcm9zb2Z0IElyZWxh +# bmQgT3BlcmF0aW9ucyBMaW1pdGVkMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpE +# MDgyLTRCRkQtRUVCQTElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vy +# dmljZaIjCgEBMAcGBSsOAwIaAxUAdqNHe113gCJ87aZIGa5QBUqIwvKggYMwgYCk +# fjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH +# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQD +# Ex1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQUFAAIF +# AOiyf1swIhgPMjAyMzA5MTgxNTQ4NDNaGA8yMDIzMDkxOTE1NDg0M1owdDA6Bgor +# BgEEAYRZCgQBMSwwKjAKAgUA6LJ/WwIBADAHAgEAAgIJSjAHAgEAAgISJDAKAgUA +# 6LPQ2wIBADA2BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAID +# B6EgoQowCAIBAAIDAYagMA0GCSqGSIb3DQEBBQUAA4GBAGK+6UVMbVgt4qWdPk/1 +# tYxGjavQWgZ3LPfp9l3mh/tQK2RhpjsBgKJO+VVBXcUW3YQb5qP9g40+jrcIFlfy +# vrAK3UpbfuIZ6DJ6AayEF30fseVPvwaqjl/BJlKUL3ofsjEMcZPdpfHQv4Zdj3rr +# cWGEIG68RqDIePRRKRZEJtI0MYIEDTCCBAkCAQEwgZMwfDELMAkGA1UEBhMCVVMx +# EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoT +# FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUt +# U3RhbXAgUENBIDIwMTACEzMAAAG6Hz8Z98F1vXwAAQAAAbowDQYJYIZIAWUDBAIB +# BQCgggFKMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQx +# IgQgYadrVhYugkNn/ywjh6tJ37ntH5tUO1WvoJ2sa5Mz6LIwgfoGCyqGSIb3DQEJ +# EAIvMYHqMIHnMIHkMIG9BCApVb08M25w+tYGWsmlGtp1gy1nPcqWfqgMF3nlWYVz +# BTCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw +# DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x +# JjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABuh8/ +# GffBdb18AAEAAAG6MCIEIMHkOGC427PqmUI7Oe7xVuezks+e+hMM+17Nfgn9Gbmw +# MA0GCSqGSIb3DQEBCwUABIICAEKE7ZkmQ1xDsee8ZSZP8Kkt2YJLG3nLR32JBRu3 +# uX7TPTDw9phd40N2ryva3Xjzht/JOPa0F4mg++YIwylXVIR6EqKNVLsIA/X8AGFa +# ti+AJp6qNe9grV8DBK00whojtMK8JZhufOb7LEon5rBFEnJx3g8JhCvAqXFzxw+M +# ctqJFm6+1ynuI7mKayA89TOLBmI4RviICjMZlsW3kNXRS1GryKt7H+C8y9kiLEMX +# efauGyoMO8sToIxgrq2HZF88/b+y8c3cX+Q5iazWLzMYeWUUPrqWcIbjGjIFBMl9 +# weOXEAZVo6TSGDZOQkYi/FZxKWllnxVRN1S2Al5IUUvgXGl9ZpsW2DyM1S8Qxe+a +# VrxwkOWKzHlnFo1qGz0Iq9ImHVqr2dOC5bDVMu+jlOA1LiZC5aHxuxaHWBN73Wp7 +# Hjy8h73drsmmiXovOWly7lWLatIuPJh00iiyBXdDtjmeDjso3aadUII5FQ1QWZ4F +# 4VWo161Gx+TxGlUt//4Hns5bn4UEGE43g9OCQuQ/WFMqdb3dHCzkkHDhWHbdpBy7 +# oHHEsAdgjMdQHWfnxhCj0ZHEOupc9j1CXpQtN/B6uzsQQ/Mp34Rhsgn+/REVAwpS +# O7G69KWZrePZJiNrV/+eRn8ya6s8WNQAGB5zIQc8o+K9RGctLBOWcsRya9sqvL6r +# xUQ2 +# SIG # End signature block diff --git a/automataCI/services/hestiaNUPKG/dotnet-install.sh b/automataCI/services/hestiaNUPKG/dotnet-install.sh new file mode 100644 index 0000000..4547589 --- /dev/null +++ b/automataCI/services/hestiaNUPKG/dotnet-install.sh @@ -0,0 +1,1830 @@ +#!/usr/bin/env bash +# Copyright (c) .NET Foundation and contributors. All rights reserved. +# Licensed under the MIT license. See LICENSE file in the project root for full license information. +# + +# Stop script on NZEC +set -e +# Stop script if unbound variable found (use ${var:-} if intentional) +set -u +# By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success +# This is causing it to fail +set -o pipefail + +# Use in the the functions: eval $invocation +invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"' + +# standard output may be used as a return value in the functions +# we need a way to write text on the screen in the functions so that +# it won't interfere with the return value. +# Exposing stream 3 as a pipe to standard output of the script itself +exec 3>&1 + +# Setup some colors to use. These need to work in fairly limited shells, like the Ubuntu Docker container where there are only 8 colors. +# See if stdout is a terminal +if [ -t 1 ] && command -v tput > /dev/null; then + # see if it supports colors + ncolors=$(tput colors || echo 0) + if [ -n "$ncolors" ] && [ $ncolors -ge 8 ]; then + bold="$(tput bold || echo)" + normal="$(tput sgr0 || echo)" + black="$(tput setaf 0 || echo)" + red="$(tput setaf 1 || echo)" + green="$(tput setaf 2 || echo)" + yellow="$(tput setaf 3 || echo)" + blue="$(tput setaf 4 || echo)" + magenta="$(tput setaf 5 || echo)" + cyan="$(tput setaf 6 || echo)" + white="$(tput setaf 7 || echo)" + fi +fi + +say_warning() { + printf "%b\n" "${yellow:-}dotnet_install: Warning: $1${normal:-}" >&3 +} + +say_err() { + printf "%b\n" "${red:-}dotnet_install: Error: $1${normal:-}" >&2 +} + +say() { + # using stream 3 (defined in the beginning) to not interfere with stdout of functions + # which may be used as return value + printf "%b\n" "${cyan:-}dotnet-install:${normal:-} $1" >&3 +} + +say_verbose() { + if [ "$verbose" = true ]; then + say "$1" + fi +} + +# This platform list is finite - if the SDK/Runtime has supported Linux distribution-specific assets, +# then and only then should the Linux distribution appear in this list. +# Adding a Linux distribution to this list does not imply distribution-specific support. +get_legacy_os_name_from_platform() { + eval $invocation + + platform="$1" + case "$platform" in + "centos.7") + echo "centos" + return 0 + ;; + "debian.8") + echo "debian" + return 0 + ;; + "debian.9") + echo "debian.9" + return 0 + ;; + "fedora.23") + echo "fedora.23" + return 0 + ;; + "fedora.24") + echo "fedora.24" + return 0 + ;; + "fedora.27") + echo "fedora.27" + return 0 + ;; + "fedora.28") + echo "fedora.28" + return 0 + ;; + "opensuse.13.2") + echo "opensuse.13.2" + return 0 + ;; + "opensuse.42.1") + echo "opensuse.42.1" + return 0 + ;; + "opensuse.42.3") + echo "opensuse.42.3" + return 0 + ;; + "rhel.7"*) + echo "rhel" + return 0 + ;; + "ubuntu.14.04") + echo "ubuntu" + return 0 + ;; + "ubuntu.16.04") + echo "ubuntu.16.04" + return 0 + ;; + "ubuntu.16.10") + echo "ubuntu.16.10" + return 0 + ;; + "ubuntu.18.04") + echo "ubuntu.18.04" + return 0 + ;; + "alpine.3.4.3") + echo "alpine" + return 0 + ;; + esac + return 1 +} + +get_legacy_os_name() { + eval $invocation + + local uname=$(uname) + if [ "$uname" = "Darwin" ]; then + echo "osx" + return 0 + elif [ -n "$runtime_id" ]; then + echo $(get_legacy_os_name_from_platform "${runtime_id%-*}" || echo "${runtime_id%-*}") + return 0 + else + if [ -e /etc/os-release ]; then + . /etc/os-release + os=$(get_legacy_os_name_from_platform "$ID${VERSION_ID:+.${VERSION_ID}}" || echo "") + if [ -n "$os" ]; then + echo "$os" + return 0 + fi + fi + fi + + say_verbose "Distribution specific OS name and version could not be detected: UName = $uname" + return 1 +} + +get_linux_platform_name() { + eval $invocation + + if [ -n "$runtime_id" ]; then + echo "${runtime_id%-*}" + return 0 + else + if [ -e /etc/os-release ]; then + . /etc/os-release + echo "$ID${VERSION_ID:+.${VERSION_ID}}" + return 0 + elif [ -e /etc/redhat-release ]; then + local redhatRelease=$(&1 || true) | grep -q musl +} + +get_current_os_name() { + eval $invocation + + local uname=$(uname) + if [ "$uname" = "Darwin" ]; then + echo "osx" + return 0 + elif [ "$uname" = "FreeBSD" ]; then + echo "freebsd" + return 0 + elif [ "$uname" = "Linux" ]; then + local linux_platform_name="" + linux_platform_name="$(get_linux_platform_name)" || true + + if [ "$linux_platform_name" = "rhel.6" ]; then + echo $linux_platform_name + return 0 + elif is_musl_based_distro; then + echo "linux-musl" + return 0 + elif [ "$linux_platform_name" = "linux-musl" ]; then + echo "linux-musl" + return 0 + else + echo "linux" + return 0 + fi + fi + + say_err "OS name could not be detected: UName = $uname" + return 1 +} + +machine_has() { + eval $invocation + + command -v "$1" > /dev/null 2>&1 + return $? +} + +check_min_reqs() { + local hasMinimum=false + if machine_has "curl"; then + hasMinimum=true + elif machine_has "wget"; then + hasMinimum=true + fi + + if [ "$hasMinimum" = "false" ]; then + say_err "curl (recommended) or wget are required to download dotnet. Install missing prerequisite to proceed." + return 1 + fi + return 0 +} + +# args: +# input - $1 +to_lowercase() { + #eval $invocation + + echo "$1" | tr '[:upper:]' '[:lower:]' + return 0 +} + +# args: +# input - $1 +remove_trailing_slash() { + #eval $invocation + + local input="${1:-}" + echo "${input%/}" + return 0 +} + +# args: +# input - $1 +remove_beginning_slash() { + #eval $invocation + + local input="${1:-}" + echo "${input#/}" + return 0 +} + +# args: +# root_path - $1 +# child_path - $2 - this parameter can be empty +combine_paths() { + eval $invocation + + # TODO: Consider making it work with any number of paths. For now: + if [ ! -z "${3:-}" ]; then + say_err "combine_paths: Function takes two parameters." + return 1 + fi + + local root_path="$(remove_trailing_slash "$1")" + local child_path="$(remove_beginning_slash "${2:-}")" + say_verbose "combine_paths: root_path=$root_path" + say_verbose "combine_paths: child_path=$child_path" + echo "$root_path/$child_path" + return 0 +} + +get_machine_architecture() { + eval $invocation + + if command -v uname > /dev/null; then + CPUName=$(uname -m) + case $CPUName in + armv*l) + echo "arm" + return 0 + ;; + aarch64|arm64) + echo "arm64" + return 0 + ;; + s390x) + echo "s390x" + return 0 + ;; + ppc64le) + echo "ppc64le" + return 0 + ;; + loongarch64) + echo "loongarch64" + return 0 + ;; + esac + fi + + # Always default to 'x64' + echo "x64" + return 0 +} + +# args: +# architecture - $1 +get_normalized_architecture_from_architecture() { + eval $invocation + + local architecture="$(to_lowercase "$1")" + + if [[ $architecture == \ ]]; then + echo "$(get_machine_architecture)" + return 0 + fi + + case "$architecture" in + amd64|x64) + echo "x64" + return 0 + ;; + arm) + echo "arm" + return 0 + ;; + arm64) + echo "arm64" + return 0 + ;; + s390x) + echo "s390x" + return 0 + ;; + ppc64le) + echo "ppc64le" + return 0 + ;; + loongarch64) + echo "loongarch64" + return 0 + ;; + esac + + say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" + return 1 +} + +# args: +# version - $1 +# channel - $2 +# architecture - $3 +get_normalized_architecture_for_specific_sdk_version() { + eval $invocation + + local is_version_support_arm64="$(is_arm64_supported "$1")" + local is_channel_support_arm64="$(is_arm64_supported "$2")" + local architecture="$3"; + local osname="$(get_current_os_name)" + + if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then + #check if rosetta is installed + if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then + say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64." + echo "x64" + return 0; + else + say_err "Architecture \`$architecture\` is not supported for .NET SDK version \`$version\`. Please install Rosetta to allow emulation of the \`$architecture\` .NET SDK on this platform" + return 1 + fi + fi + + echo "$architecture" + return 0 +} + +# args: +# version or channel - $1 +is_arm64_supported() { + #any channel or version that starts with the specified versions + case "$1" in + ( "1"* | "2"* | "3"* | "4"* | "5"*) + echo false + return 0 + esac + + echo true + return 0 +} + +# args: +# user_defined_os - $1 +get_normalized_os() { + eval $invocation + + local osname="$(to_lowercase "$1")" + if [ ! -z "$osname" ]; then + case "$osname" in + osx | freebsd | rhel.6 | linux-musl | linux) + echo "$osname" + return 0 + ;; + *) + say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." + return 1 + ;; + esac + else + osname="$(get_current_os_name)" || return 1 + fi + echo "$osname" + return 0 +} + +# args: +# quality - $1 +get_normalized_quality() { + eval $invocation + + local quality="$(to_lowercase "$1")" + if [ ! -z "$quality" ]; then + case "$quality" in + daily | signed | validated | preview) + echo "$quality" + return 0 + ;; + ga) + #ga quality is available without specifying quality, so normalizing it to empty + return 0 + ;; + *) + say_err "'$quality' is not a supported value for --quality option. Supported values are: daily, signed, validated, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues." + return 1 + ;; + esac + fi + return 0 +} + +# args: +# channel - $1 +get_normalized_channel() { + eval $invocation + + local channel="$(to_lowercase "$1")" + + if [[ $channel == current ]]; then + say_warning 'Value "Current" is deprecated for -Channel option. Use "STS" instead.' + fi + + if [[ $channel == release/* ]]; then + say_warning 'Using branch name with -Channel option is no longer supported with newer releases. Use -Quality option with a channel in X.Y format instead.'; + fi + + if [ ! -z "$channel" ]; then + case "$channel" in + lts) + echo "LTS" + return 0 + ;; + sts) + echo "STS" + return 0 + ;; + current) + echo "STS" + return 0 + ;; + *) + echo "$channel" + return 0 + ;; + esac + fi + + return 0 +} + +# args: +# runtime - $1 +get_normalized_product() { + eval $invocation + + local product="" + local runtime="$(to_lowercase "$1")" + if [[ "$runtime" == "dotnet" ]]; then + product="dotnet-runtime" + elif [[ "$runtime" == "aspnetcore" ]]; then + product="aspnetcore-runtime" + elif [ -z "$runtime" ]; then + product="dotnet-sdk" + fi + echo "$product" + return 0 +} + +# The version text returned from the feeds is a 1-line or 2-line string: +# For the SDK and the dotnet runtime (2 lines): +# Line 1: # commit_hash +# Line 2: # 4-part version +# For the aspnetcore runtime (1 line): +# Line 1: # 4-part version + +# args: +# version_text - stdin +get_version_from_latestversion_file_content() { + eval $invocation + + cat | tail -n 1 | sed 's/\r$//' + return 0 +} + +# args: +# install_root - $1 +# relative_path_to_package - $2 +# specific_version - $3 +is_dotnet_package_installed() { + eval $invocation + + local install_root="$1" + local relative_path_to_package="$2" + local specific_version="${3//[$'\t\r\n']}" + + local dotnet_package_path="$(combine_paths "$(combine_paths "$install_root" "$relative_path_to_package")" "$specific_version")" + say_verbose "is_dotnet_package_installed: dotnet_package_path=$dotnet_package_path" + + if [ -d "$dotnet_package_path" ]; then + return 0 + else + return 1 + fi +} + +# args: +# downloaded file - $1 +# remote_file_size - $2 +validate_remote_local_file_sizes() +{ + eval $invocation + + local downloaded_file="$1" + local remote_file_size="$2" + local file_size='' + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + file_size="$(stat -c '%s' "$downloaded_file")" + elif [[ "$OSTYPE" == "darwin"* ]]; then + # hardcode in order to avoid conflicts with GNU stat + file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")" + fi + + if [ -n "$file_size" ]; then + say "Downloaded file size is $file_size bytes." + + if [ -n "$remote_file_size" ] && [ -n "$file_size" ]; then + if [ "$remote_file_size" -ne "$file_size" ]; then + say "The remote and local file sizes are not equal. The remote file size is $remote_file_size bytes and the local size is $file_size bytes. The local package may be corrupted." + else + say "The remote and local file sizes are equal." + fi + fi + + else + say "Either downloaded or local package size can not be measured. One of them may be corrupted." + fi +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +get_version_from_latestversion_file() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + + local version_file_url=null + if [[ "$runtime" == "dotnet" ]]; then + version_file_url="$azure_feed/Runtime/$channel/latest.version" + elif [[ "$runtime" == "aspnetcore" ]]; then + version_file_url="$azure_feed/aspnetcore/Runtime/$channel/latest.version" + elif [ -z "$runtime" ]; then + version_file_url="$azure_feed/Sdk/$channel/latest.version" + else + say_err "Invalid value for \$runtime" + return 1 + fi + say_verbose "get_version_from_latestversion_file: latest url: $version_file_url" + + download "$version_file_url" || return $? + return 0 +} + +# args: +# json_file - $1 +parse_globaljson_file_for_version() { + eval $invocation + + local json_file="$1" + if [ ! -f "$json_file" ]; then + say_err "Unable to find \`$json_file\`" + return 1 + fi + + sdk_section=$(cat $json_file | tr -d "\r" | awk '/"sdk"/,/}/') + if [ -z "$sdk_section" ]; then + say_err "Unable to parse the SDK node in \`$json_file\`" + return 1 + fi + + sdk_list=$(echo $sdk_section | awk -F"[{}]" '{print $2}') + sdk_list=${sdk_list//[\" ]/} + sdk_list=${sdk_list//,/$'\n'} + + local version_info="" + while read -r line; do + IFS=: + while read -r key value; do + if [[ "$key" == "version" ]]; then + version_info=$value + fi + done <<< "$line" + done <<< "$sdk_list" + if [ -z "$version_info" ]; then + say_err "Unable to find the SDK:version node in \`$json_file\`" + return 1 + fi + + unset IFS; + echo "$version_info" + return 0 +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# version - $4 +# json_file - $5 +get_specific_version_from_version() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local version="$(to_lowercase "$4")" + local json_file="$5" + + if [ -z "$json_file" ]; then + if [[ "$version" == "latest" ]]; then + local version_info + version_info="$(get_version_from_latestversion_file "$azure_feed" "$channel" "$normalized_architecture" false)" || return 1 + say_verbose "get_specific_version_from_version: version_info=$version_info" + echo "$version_info" | get_version_from_latestversion_file_content + return 0 + else + echo "$version" + return 0 + fi + else + local version_info + version_info="$(parse_globaljson_file_for_version "$json_file")" || return 1 + echo "$version_info" + return 0 + fi +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# specific_version - $4 +# normalized_os - $5 +construct_download_link() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" + local specific_product_version="$(get_specific_product_version "$1" "$4")" + local osname="$5" + + local download_link=null + if [[ "$runtime" == "dotnet" ]]; then + download_link="$azure_feed/Runtime/$specific_version/dotnet-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" + elif [[ "$runtime" == "aspnetcore" ]]; then + download_link="$azure_feed/aspnetcore/Runtime/$specific_version/aspnetcore-runtime-$specific_product_version-$osname-$normalized_architecture.tar.gz" + elif [ -z "$runtime" ]; then + download_link="$azure_feed/Sdk/$specific_version/dotnet-sdk-$specific_product_version-$osname-$normalized_architecture.tar.gz" + else + return 1 + fi + + echo "$download_link" + return 0 +} + +# args: +# azure_feed - $1 +# specific_version - $2 +# download link - $3 (optional) +get_specific_product_version() { + # If we find a 'productVersion.txt' at the root of any folder, we'll use its contents + # to resolve the version of what's in the folder, superseding the specified version. + # if 'productVersion.txt' is missing but download link is already available, product version will be taken from download link + eval $invocation + + local azure_feed="$1" + local specific_version="${2//[$'\t\r\n']}" + local package_download_link="" + if [ $# -gt 2 ]; then + local package_download_link="$3" + fi + local specific_product_version=null + + # Try to get the version number, using the productVersion.txt file located next to the installer file. + local download_links=($(get_specific_product_version_url "$azure_feed" "$specific_version" true "$package_download_link") + $(get_specific_product_version_url "$azure_feed" "$specific_version" false "$package_download_link")) + + for download_link in "${download_links[@]}" + do + say_verbose "Checking for the existence of $download_link" + + if machine_has "curl" + then + if ! specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1); then + continue + else + echo "${specific_product_version//[$'\t\r\n']}" + return 0 + fi + + elif machine_has "wget" + then + specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1) + if [ $? = 0 ]; then + echo "${specific_product_version//[$'\t\r\n']}" + return 0 + fi + fi + done + + # Getting the version number with productVersion.txt has failed. Try parsing the download link for a version number. + say_verbose "Failed to get the version using productVersion.txt file. Download link will be parsed instead." + specific_product_version="$(get_product_specific_version_from_download_link "$package_download_link" "$specific_version")" + echo "${specific_product_version//[$'\t\r\n']}" + return 0 +} + +# args: +# azure_feed - $1 +# specific_version - $2 +# is_flattened - $3 +# download link - $4 (optional) +get_specific_product_version_url() { + eval $invocation + + local azure_feed="$1" + local specific_version="$2" + local is_flattened="$3" + local package_download_link="" + if [ $# -gt 3 ]; then + local package_download_link="$4" + fi + + local pvFileName="productVersion.txt" + if [ "$is_flattened" = true ]; then + if [ -z "$runtime" ]; then + pvFileName="sdk-productVersion.txt" + elif [[ "$runtime" == "dotnet" ]]; then + pvFileName="runtime-productVersion.txt" + else + pvFileName="$runtime-productVersion.txt" + fi + fi + + local download_link=null + + if [ -z "$package_download_link" ]; then + if [[ "$runtime" == "dotnet" ]]; then + download_link="$azure_feed/Runtime/$specific_version/${pvFileName}" + elif [[ "$runtime" == "aspnetcore" ]]; then + download_link="$azure_feed/aspnetcore/Runtime/$specific_version/${pvFileName}" + elif [ -z "$runtime" ]; then + download_link="$azure_feed/Sdk/$specific_version/${pvFileName}" + else + return 1 + fi + else + download_link="${package_download_link%/*}/${pvFileName}" + fi + + say_verbose "Constructed productVersion link: $download_link" + echo "$download_link" + return 0 +} + +# args: +# download link - $1 +# specific version - $2 +get_product_specific_version_from_download_link() +{ + eval $invocation + + local download_link="$1" + local specific_version="$2" + local specific_product_version="" + + if [ -z "$download_link" ]; then + echo "$specific_version" + return 0 + fi + + #get filename + filename="${download_link##*/}" + + #product specific version follows the product name + #for filename 'dotnet-sdk-3.1.404-linux-x64.tar.gz': the product version is 3.1.404 + IFS='-' + read -ra filename_elems <<< "$filename" + count=${#filename_elems[@]} + if [[ "$count" -gt 2 ]]; then + specific_product_version="${filename_elems[2]}" + else + specific_product_version=$specific_version + fi + unset IFS; + echo "$specific_product_version" + return 0 +} + +# args: +# azure_feed - $1 +# channel - $2 +# normalized_architecture - $3 +# specific_version - $4 +construct_legacy_download_link() { + eval $invocation + + local azure_feed="$1" + local channel="$2" + local normalized_architecture="$3" + local specific_version="${4//[$'\t\r\n']}" + + local distro_specific_osname + distro_specific_osname="$(get_legacy_os_name)" || return 1 + + local legacy_download_link=null + if [[ "$runtime" == "dotnet" ]]; then + legacy_download_link="$azure_feed/Runtime/$specific_version/dotnet-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" + elif [ -z "$runtime" ]; then + legacy_download_link="$azure_feed/Sdk/$specific_version/dotnet-dev-$distro_specific_osname-$normalized_architecture.$specific_version.tar.gz" + else + return 1 + fi + + echo "$legacy_download_link" + return 0 +} + +get_user_install_path() { + eval $invocation + + if [ ! -z "${DOTNET_INSTALL_DIR:-}" ]; then + echo "$DOTNET_INSTALL_DIR" + else + echo "$HOME/.dotnet" + fi + return 0 +} + +# args: +# install_dir - $1 +resolve_installation_path() { + eval $invocation + + local install_dir=$1 + if [ "$install_dir" = "" ]; then + local user_install_path="$(get_user_install_path)" + say_verbose "resolve_installation_path: user_install_path=$user_install_path" + echo "$user_install_path" + return 0 + fi + + echo "$install_dir" + return 0 +} + +# args: +# relative_or_absolute_path - $1 +get_absolute_path() { + eval $invocation + + local relative_or_absolute_path=$1 + echo "$(cd "$(dirname "$1")" && pwd -P)/$(basename "$1")" + return 0 +} + +# args: +# input_files - stdin +# root_path - $1 +# out_path - $2 +# override - $3 +copy_files_or_dirs_from_list() { + eval $invocation + + local root_path="$(remove_trailing_slash "$1")" + local out_path="$(remove_trailing_slash "$2")" + local override="$3" + local osname="$(get_current_os_name)" + local override_switch=$( + if [ "$override" = false ]; then + if [ "$osname" = "linux-musl" ]; then + printf -- "-u"; + else + printf -- "-n"; + fi + fi) + + cat | uniq | while read -r file_path; do + local path="$(remove_beginning_slash "${file_path#$root_path}")" + local target="$out_path/$path" + if [ "$override" = true ] || (! ([ -d "$target" ] || [ -e "$target" ])); then + mkdir -p "$out_path/$(dirname "$path")" + if [ -d "$target" ]; then + rm -rf "$target" + fi + cp -R $override_switch "$root_path/$path" "$target" + fi + done +} + +# args: +# zip_uri - $1 +get_remote_file_size() { + local zip_uri="$1" + + if machine_has "curl"; then + file_size=$(curl -sI "$zip_uri" | grep -i content-length | awk '{ num = $2 + 0; print num }') + elif machine_has "wget"; then + file_size=$(wget --spider --server-response -O /dev/null "$zip_uri" 2>&1 | grep -i 'Content-Length:' | awk '{ num = $2 + 0; print num }') + else + say "Neither curl nor wget is available on this system." + return + fi + + if [ -n "$file_size" ]; then + say "Remote file $zip_uri size is $file_size bytes." + echo "$file_size" + else + say_verbose "Content-Length header was not extracted for $zip_uri." + echo "" + fi +} + +# args: +# zip_path - $1 +# out_path - $2 +# remote_file_size - $3 +extract_dotnet_package() { + eval $invocation + + local zip_path="$1" + local out_path="$2" + local remote_file_size="$3" + + local temp_out_path="$(mktemp -d "$temporary_file_template")" + + local failed=false + tar -xzf "$zip_path" -C "$temp_out_path" > /dev/null || failed=true + + local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/' + find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false + find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files" + + validate_remote_local_file_sizes "$zip_path" "$remote_file_size" + + rm -rf "$temp_out_path" + if [ -z ${keep_zip+x} ]; then + rm -f "$zip_path" && say_verbose "Temporary zip file $zip_path was removed" + fi + + if [ "$failed" = true ]; then + say_err "Extraction failed" + return 1 + fi + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header() +{ + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + + local failed=false + local response + if machine_has "curl"; then + get_http_header_curl $remote_path $disable_feed_credential || failed=true + elif machine_has "wget"; then + get_http_header_wget $remote_path $disable_feed_credential || failed=true + else + failed=true + fi + if [ "$failed" = true ]; then + say_verbose "Failed to get HTTP header: '$remote_path'." + return 1 + fi + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header_curl() { + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + + remote_path_with_credential="$remote_path" + if [ "$disable_feed_credential" = false ]; then + remote_path_with_credential+="$feed_credential" + fi + + curl_options="-I -sSL --retry 5 --retry-delay 2 --connect-timeout 15 " + curl $curl_options "$remote_path_with_credential" 2>&1 || return 1 + return 0 +} + +# args: +# remote_path - $1 +# disable_feed_credential - $2 +get_http_header_wget() { + eval $invocation + local remote_path="$1" + local disable_feed_credential="$2" + local wget_options="-q -S --spider --tries 5 " + + local wget_options_extra='' + + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi + + remote_path_with_credential="$remote_path" + if [ "$disable_feed_credential" = false ]; then + remote_path_with_credential+="$feed_credential" + fi + + wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1 + + return $? +} + +# args: +# remote_path - $1 +# [out_path] - $2 - stdout if not provided +download() { + eval $invocation + + local remote_path="$1" + local out_path="${2:-}" + + if [[ "$remote_path" != "http"* ]]; then + cp "$remote_path" "$out_path" + return $? + fi + + local failed=false + local attempts=0 + while [ $attempts -lt 3 ]; do + attempts=$((attempts+1)) + failed=false + if machine_has "curl"; then + downloadcurl "$remote_path" "$out_path" || failed=true + elif machine_has "wget"; then + downloadwget "$remote_path" "$out_path" || failed=true + else + say_err "Missing dependency: neither curl nor wget was found." + exit 1 + fi + + if [ "$failed" = false ] || [ $attempts -ge 3 ] || { [ ! -z $http_code ] && [ $http_code = "404" ]; }; then + break + fi + + say "Download attempt #$attempts has failed: $http_code $download_error_msg" + say "Attempt #$((attempts+1)) will start in $((attempts*10)) seconds." + sleep $((attempts*10)) + done + + if [ "$failed" = true ]; then + say_verbose "Download failed: $remote_path" + return 1 + fi + return 0 +} + +# Updates global variables $http_code and $download_error_msg +downloadcurl() { + eval $invocation + unset http_code + unset download_error_msg + local remote_path="$1" + local out_path="${2:-}" + # Append feed_credential as late as possible before calling curl to avoid logging feed_credential + # Avoid passing URI with credentials to functions: note, most of them echoing parameters of invocation in verbose output. + local remote_path_with_credential="${remote_path}${feed_credential}" + local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs " + local curl_exit_code=0; + if [ -z "$out_path" ]; then + curl $curl_options "$remote_path_with_credential" 2>&1 + curl_exit_code=$? + else + curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 + curl_exit_code=$? + fi + + if [ $curl_exit_code -gt 0 ]; then + download_error_msg="Unable to download $remote_path." + # Check for curl timeout codes + if [[ $curl_exit_code == 7 || $curl_exit_code == 28 ]]; then + download_error_msg+=" Failed to reach the server: connection timeout." + else + local disable_feed_credential=false + local response=$(get_http_header_curl $remote_path $disable_feed_credential) + http_code=$( echo "$response" | awk '/^HTTP/{print $2}' | tail -1 ) + if [[ ! -z $http_code && $http_code != 2* ]]; then + download_error_msg+=" Returned HTTP status code: $http_code." + fi + fi + say_verbose "$download_error_msg" + return 1 + fi + return 0 +} + + +# Updates global variables $http_code and $download_error_msg +downloadwget() { + eval $invocation + unset http_code + unset download_error_msg + local remote_path="$1" + local out_path="${2:-}" + # Append feed_credential as late as possible before calling wget to avoid logging feed_credential + local remote_path_with_credential="${remote_path}${feed_credential}" + local wget_options="--tries 20 " + + local wget_options_extra='' + local wget_result='' + + # Test for options that aren't supported on all wget implementations. + if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then + wget_options_extra="--waitretry 2 --connect-timeout 15 " + else + say "wget extra options are unavailable for this environment" + fi + + if [ -z "$out_path" ]; then + wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1 + wget_result=$? + else + wget $wget_options $wget_options_extra -O "$out_path" "$remote_path_with_credential" 2>&1 + wget_result=$? + fi + + if [[ $wget_result != 0 ]]; then + local disable_feed_credential=false + local response=$(get_http_header_wget $remote_path $disable_feed_credential) + http_code=$( echo "$response" | awk '/^ HTTP/{print $2}' | tail -1 ) + download_error_msg="Unable to download $remote_path." + if [[ ! -z $http_code && $http_code != 2* ]]; then + download_error_msg+=" Returned HTTP status code: $http_code." + # wget exit code 4 stands for network-issue + elif [[ $wget_result == 4 ]]; then + download_error_msg+=" Failed to reach the server: connection timeout." + fi + say_verbose "$download_error_msg" + return 1 + fi + + return 0 +} + +get_download_link_from_aka_ms() { + eval $invocation + + #quality is not supported for LTS or STS channel + #STS maps to current + if [[ ! -z "$normalized_quality" && ("$normalized_channel" == "LTS" || "$normalized_channel" == "STS") ]]; then + normalized_quality="" + say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored." + fi + + say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + + #construct aka.ms link + aka_ms_link="https://aka.ms/dotnet" + if [ "$internal" = true ]; then + aka_ms_link="$aka_ms_link/internal" + fi + aka_ms_link="$aka_ms_link/$normalized_channel" + if [[ ! -z "$normalized_quality" ]]; then + aka_ms_link="$aka_ms_link/$normalized_quality" + fi + aka_ms_link="$aka_ms_link/$normalized_product-$normalized_os-$normalized_architecture.tar.gz" + say_verbose "Constructed aka.ms link: '$aka_ms_link'." + + #get HTTP response + #do not pass credentials as a part of the $aka_ms_link and do not apply credentials in the get_http_header function + #otherwise the redirect link would have credentials as well + #it would result in applying credentials twice to the resulting link and thus breaking it, and in echoing credentials to the output as a part of redirect link + disable_feed_credential=true + response="$(get_http_header $aka_ms_link $disable_feed_credential)" + + say_verbose "Received response: $response" + # Get results of all the redirects. + http_codes=$( echo "$response" | awk '$1 ~ /^HTTP/ {print $2}' ) + # They all need to be 301, otherwise some links are broken (except for the last, which is not a redirect but 200 or 404). + broken_redirects=$( echo "$http_codes" | sed '$d' | grep -v '301' ) + + # All HTTP codes are 301 (Moved Permanently), the redirect link exists. + if [[ -z "$broken_redirects" ]]; then + aka_ms_download_link=$( echo "$response" | awk '$1 ~ /^Location/{print $2}' | tail -1 | tr -d '\r') + + if [[ -z "$aka_ms_download_link" ]]; then + say_verbose "The aka.ms link '$aka_ms_link' is not valid: failed to get redirect location." + return 1 + fi + + say_verbose "The redirect location retrieved: '$aka_ms_download_link'." + return 0 + else + say_verbose "The aka.ms link '$aka_ms_link' is not valid: received HTTP code: $(echo "$broken_redirects" | paste -sd "," -)." + return 1 + fi +} + +get_feeds_to_use() +{ + feeds=( + "https://dotnetcli.azureedge.net/dotnet" + "https://dotnetbuilds.azureedge.net/public" + ) + + if [[ -n "$azure_feed" ]]; then + feeds=("$azure_feed") + fi + + if [[ "$no_cdn" == "true" ]]; then + feeds=( + "https://dotnetcli.blob.core.windows.net/dotnet" + "https://dotnetbuilds.blob.core.windows.net/public" + ) + + if [[ -n "$uncached_feed" ]]; then + feeds=("$uncached_feed") + fi + fi +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed). +generate_download_links() { + + download_links=() + specific_versions=() + effective_versions=() + link_types=() + + # If generate_akams_links returns false, no fallback to old links. Just terminate. + # This function may also 'exit' (if the determined version is already installed). + generate_akams_links || return + + # Check other feeds only if we haven't been able to find an aka.ms link. + if [[ "${#download_links[@]}" -lt 1 ]]; then + for feed in ${feeds[@]} + do + # generate_regular_links may also 'exit' (if the determined version is already installed). + generate_regular_links $feed || return + done + fi + + if [[ "${#download_links[@]}" -eq 0 ]]; then + say_err "Failed to resolve the exact version number." + return 1 + fi + + say_verbose "Generated ${#download_links[@]} links." + for link_index in ${!download_links[@]} + do + say_verbose "Link $link_index: ${link_types[$link_index]}, ${effective_versions[$link_index]}, ${download_links[$link_index]}" + done +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed). +generate_akams_links() { + local valid_aka_ms_link=true; + + normalized_version="$(to_lowercase "$version")" + if [[ "$normalized_version" != "latest" ]] && [ -n "$normalized_quality" ]; then + say_err "Quality and Version options are not allowed to be specified simultaneously. See https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for details." + return 1 + fi + + if [[ -n "$json_file" || "$normalized_version" != "latest" ]]; then + # aka.ms links are not needed when exact version is specified via command or json file + return + fi + + get_download_link_from_aka_ms || valid_aka_ms_link=false + + if [[ "$valid_aka_ms_link" == true ]]; then + say_verbose "Retrieved primary payload URL from aka.ms link: '$aka_ms_download_link'." + say_verbose "Downloading using legacy url will not be attempted." + + download_link=$aka_ms_download_link + + #get version from the path + IFS='/' + read -ra pathElems <<< "$download_link" + count=${#pathElems[@]} + specific_version="${pathElems[count-2]}" + unset IFS; + say_verbose "Version: '$specific_version'." + + #Retrieve effective version + effective_version="$(get_specific_product_version "$azure_feed" "$specific_version" "$download_link")" + + # Add link info to arrays + download_links+=($download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("aka.ms") + + # Check if the SDK version is already installed. + if [[ "$dry_run" != true ]] && is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "$asset_name with version '$effective_version' is already installed." + exit 0 + fi + + return 0 + fi + + # if quality is specified - exit with error - there is no fallback approach + if [ ! -z "$normalized_quality" ]; then + say_err "Failed to locate the latest version in the channel '$normalized_channel' with '$normalized_quality' quality for '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'." + say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support." + return 1 + fi + say_verbose "Falling back to latest.version file approach." +} + +# THIS FUNCTION MAY EXIT (if the determined version is already installed) +# args: +# feed - $1 +generate_regular_links() { + local feed="$1" + local valid_legacy_download_link=true + + specific_version=$(get_specific_version_from_version "$feed" "$channel" "$normalized_architecture" "$version" "$json_file") || specific_version='0' + + if [[ "$specific_version" == '0' ]]; then + say_verbose "Failed to resolve the specific version number using feed '$feed'" + return + fi + + effective_version="$(get_specific_product_version "$feed" "$specific_version")" + say_verbose "specific_version=$specific_version" + + download_link="$(construct_download_link "$feed" "$channel" "$normalized_architecture" "$specific_version" "$normalized_os")" + say_verbose "Constructed primary named payload URL: $download_link" + + # Add link info to arrays + download_links+=($download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("primary") + + legacy_download_link="$(construct_legacy_download_link "$feed" "$channel" "$normalized_architecture" "$specific_version")" || valid_legacy_download_link=false + + if [ "$valid_legacy_download_link" = true ]; then + say_verbose "Constructed legacy named payload URL: $legacy_download_link" + + download_links+=($legacy_download_link) + specific_versions+=($specific_version) + effective_versions+=($effective_version) + link_types+=("legacy") + else + legacy_download_link="" + say_verbose "Cound not construct a legacy_download_link; omitting..." + fi + + # Check if the SDK version is already installed. + if [[ "$dry_run" != true ]] && is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "$asset_name with version '$effective_version' is already installed." + exit 0 + fi +} + +print_dry_run() { + + say "Payload URLs:" + + for link_index in "${!download_links[@]}" + do + say "URL #$link_index - ${link_types[$link_index]}: ${download_links[$link_index]}" + done + + resolved_version=${specific_versions[0]} + repeatable_command="./$script_name --version "\""$resolved_version"\"" --install-dir "\""$install_root"\"" --architecture "\""$normalized_architecture"\"" --os "\""$normalized_os"\""" + + if [ ! -z "$normalized_quality" ]; then + repeatable_command+=" --quality "\""$normalized_quality"\""" + fi + + if [[ "$runtime" == "dotnet" ]]; then + repeatable_command+=" --runtime "\""dotnet"\""" + elif [[ "$runtime" == "aspnetcore" ]]; then + repeatable_command+=" --runtime "\""aspnetcore"\""" + fi + + repeatable_command+="$non_dynamic_parameters" + + if [ -n "$feed_credential" ]; then + repeatable_command+=" --feed-credential "\"""\""" + fi + + say "Repeatable invocation: $repeatable_command" +} + +calculate_vars() { + eval $invocation + + script_name=$(basename "$0") + normalized_architecture="$(get_normalized_architecture_from_architecture "$architecture")" + say_verbose "Normalized architecture: '$normalized_architecture'." + normalized_os="$(get_normalized_os "$user_defined_os")" + say_verbose "Normalized OS: '$normalized_os'." + normalized_quality="$(get_normalized_quality "$quality")" + say_verbose "Normalized quality: '$normalized_quality'." + normalized_channel="$(get_normalized_channel "$channel")" + say_verbose "Normalized channel: '$normalized_channel'." + normalized_product="$(get_normalized_product "$runtime")" + say_verbose "Normalized product: '$normalized_product'." + install_root="$(resolve_installation_path "$install_dir")" + say_verbose "InstallRoot: '$install_root'." + + normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")" + + if [[ "$runtime" == "dotnet" ]]; then + asset_relative_path="shared/Microsoft.NETCore.App" + asset_name=".NET Core Runtime" + elif [[ "$runtime" == "aspnetcore" ]]; then + asset_relative_path="shared/Microsoft.AspNetCore.App" + asset_name="ASP.NET Core Runtime" + elif [ -z "$runtime" ]; then + asset_relative_path="sdk" + asset_name=".NET Core SDK" + fi + + get_feeds_to_use +} + +install_dotnet() { + eval $invocation + local download_failed=false + local download_completed=false + local remote_file_size=0 + + mkdir -p "$install_root" + zip_path="${zip_path:-$(mktemp "$temporary_file_template")}" + say_verbose "Zip path: $zip_path" + + for link_index in "${!download_links[@]}" + do + download_link="${download_links[$link_index]}" + specific_version="${specific_versions[$link_index]}" + effective_version="${effective_versions[$link_index]}" + link_type="${link_types[$link_index]}" + + say "Attempting to download using $link_type link $download_link" + + # The download function will set variables $http_code and $download_error_msg in case of failure. + download_failed=false + download "$download_link" "$zip_path" 2>&1 || download_failed=true + + if [ "$download_failed" = true ]; then + case $http_code in + 404) + say "The resource at $link_type link '$download_link' is not available." + ;; + *) + say "Failed to download $link_type link '$download_link': $download_error_msg" + ;; + esac + rm -f "$zip_path" 2>&1 && say_verbose "Temporary zip file $zip_path was removed" + else + download_completed=true + break + fi + done + + if [[ "$download_completed" == false ]]; then + say_err "Could not find \`$asset_name\` with version = $specific_version" + say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support" + return 1 + fi + + remote_file_size="$(get_remote_file_size "$download_link")" + + say "Extracting zip from $download_link" + extract_dotnet_package "$zip_path" "$install_root" "$remote_file_size" || return 1 + + # Check if the SDK version is installed; if not, fail the installation. + # if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed. + if [[ $specific_version == *"rtm"* || $specific_version == *"servicing"* ]]; then + IFS='-' + read -ra verArr <<< "$specific_version" + release_version="${verArr[0]}" + unset IFS; + say_verbose "Checking installation: version = $release_version" + if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then + say "Installed version is $effective_version" + return 0 + fi + fi + + # Check if the standard SDK version is installed. + say_verbose "Checking installation: version = $effective_version" + if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then + say "Installed version is $effective_version" + return 0 + fi + + # Version verification failed. More likely something is wrong either with the downloaded content or with the verification algorithm. + say_err "Failed to verify the version of installed \`$asset_name\`.\nInstallation source: $download_link.\nInstallation location: $install_root.\nReport the bug at https://github.com/dotnet/install-scripts/issues." + say_err "\`$asset_name\` with version = $effective_version failed to install with an error." + return 1 +} + +args=("$@") + +local_version_file_relative_path="/.version" +bin_folder_relative_path="" +temporary_file_template="${TMPDIR:-/tmp}/dotnet.XXXXXXXXX" + +channel="LTS" +version="Latest" +json_file="" +install_dir="" +architecture="" +dry_run=false +no_path=false +no_cdn=false +azure_feed="" +uncached_feed="" +feed_credential="" +verbose=false +runtime="" +runtime_id="" +quality="" +internal=false +override_non_versioned_files=true +non_dynamic_parameters="" +user_defined_os="" + +while [ $# -ne 0 ] +do + name="$1" + case "$name" in + -c|--channel|-[Cc]hannel) + shift + channel="$1" + ;; + -v|--version|-[Vv]ersion) + shift + version="$1" + ;; + -q|--quality|-[Qq]uality) + shift + quality="$1" + ;; + --internal|-[Ii]nternal) + internal=true + non_dynamic_parameters+=" $name" + ;; + -i|--install-dir|-[Ii]nstall[Dd]ir) + shift + install_dir="$1" + ;; + --arch|--architecture|-[Aa]rch|-[Aa]rchitecture) + shift + architecture="$1" + ;; + --os|-[Oo][SS]) + shift + user_defined_os="$1" + ;; + --shared-runtime|-[Ss]hared[Rr]untime) + say_warning "The --shared-runtime flag is obsolete and may be removed in a future version of this script. The recommended usage is to specify '--runtime dotnet'." + if [ -z "$runtime" ]; then + runtime="dotnet" + fi + ;; + --runtime|-[Rr]untime) + shift + runtime="$1" + if [[ "$runtime" != "dotnet" ]] && [[ "$runtime" != "aspnetcore" ]]; then + say_err "Unsupported value for --runtime: '$1'. Valid values are 'dotnet' and 'aspnetcore'." + if [[ "$runtime" == "windowsdesktop" ]]; then + say_err "WindowsDesktop archives are manufactured for Windows platforms only." + fi + exit 1 + fi + ;; + --dry-run|-[Dd]ry[Rr]un) + dry_run=true + ;; + --no-path|-[Nn]o[Pp]ath) + no_path=true + non_dynamic_parameters+=" $name" + ;; + --verbose|-[Vv]erbose) + verbose=true + non_dynamic_parameters+=" $name" + ;; + --no-cdn|-[Nn]o[Cc]dn) + no_cdn=true + non_dynamic_parameters+=" $name" + ;; + --azure-feed|-[Aa]zure[Ff]eed) + shift + azure_feed="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + ;; + --uncached-feed|-[Uu]ncached[Ff]eed) + shift + uncached_feed="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + ;; + --feed-credential|-[Ff]eed[Cc]redential) + shift + feed_credential="$1" + #feed_credential should start with "?", for it to be added to the end of the link. + #adding "?" at the beginning of the feed_credential if needed. + [[ -z "$(echo $feed_credential)" ]] || [[ $feed_credential == \?* ]] || feed_credential="?$feed_credential" + ;; + --runtime-id|-[Rr]untime[Ii]d) + shift + runtime_id="$1" + non_dynamic_parameters+=" $name "\""$1"\""" + say_warning "Use of --runtime-id is obsolete and should be limited to the versions below 2.1. To override architecture, use --architecture option instead. To override OS, use --os option instead." + ;; + --jsonfile|-[Jj][Ss]on[Ff]ile) + shift + json_file="$1" + ;; + --skip-non-versioned-files|-[Ss]kip[Nn]on[Vv]ersioned[Ff]iles) + override_non_versioned_files=false + non_dynamic_parameters+=" $name" + ;; + --keep-zip|-[Kk]eep[Zz]ip) + keep_zip=true + non_dynamic_parameters+=" $name" + ;; + --zip-path|-[Zz]ip[Pp]ath) + shift + zip_path="$1" + ;; + -?|--?|-h|--help|-[Hh]elp) + script_name="$(basename "$0")" + echo ".NET Tools Installer" + echo "Usage: $script_name [-c|--channel ] [-v|--version ] [-p|--prefix ]" + echo " $script_name -h|-?|--help" + echo "" + echo "$script_name is a simple command line interface for obtaining dotnet cli." + echo " Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" + echo " - The SDK needs to be installed without user interaction and without admin rights." + echo " - The SDK installation doesn't need to persist across multiple CI runs." + echo " To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer." + echo "" + echo "Options:" + echo " -c,--channel Download from the channel specified, Defaults to \`$channel\`." + echo " -Channel" + echo " Possible values:" + echo " - STS - the most recent Standard Term Support release" + echo " - LTS - the most recent Long Term Support release" + echo " - 2-part version in a format A.B - represents a specific release" + echo " examples: 2.0; 1.0" + echo " - 3-part version in a format A.B.Cxx - represents a specific SDK release" + echo " examples: 5.0.1xx, 5.0.2xx." + echo " Supported since 5.0 release" + echo " Warning: Value 'Current' is deprecated for the Channel parameter. Use 'STS' instead." + echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used." + echo " -v,--version Use specific VERSION, Defaults to \`$version\`." + echo " -Version" + echo " Possible values:" + echo " - latest - the latest build on specific channel" + echo " - 3-part version in a format A.B.C - represents specific version of build" + echo " examples: 2.0.0-preview2-006120; 1.1.0" + echo " -q,--quality Download the latest build of specified quality in the channel." + echo " -Quality" + echo " The possible values are: daily, signed, validated, preview, GA." + echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used." + echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported." + echo " Supported since 5.0 release." + echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality." + echo " --internal,-Internal Download internal builds. Requires providing credentials via --feed-credential parameter." + echo " --feed-credential Token to access Azure feed. Used as a query string to append to the Azure feed." + echo " -FeedCredential This parameter typically is not specified." + echo " -i,--install-dir Install under specified location (see Install Location below)" + echo " -InstallDir" + echo " --architecture Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." + echo " --arch,-Architecture,-Arch" + echo " Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64" + echo " --os Specifies operating system to be used when selecting the installer." + echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6." + echo " In case any other value is provided, the platform will be determined by the script based on machine configuration." + echo " Not supported for legacy links. Use --runtime-id to specify platform for legacy links." + echo " Refer to: https://aka.ms/dotnet-os-lifecycle for more information." + echo " --runtime Installs a shared runtime only, without the SDK." + echo " -Runtime" + echo " Possible values:" + echo " - dotnet - the Microsoft.NETCore.App shared runtime" + echo " - aspnetcore - the Microsoft.AspNetCore.App shared runtime" + echo " --dry-run,-DryRun Do not perform installation. Display download link." + echo " --no-path, -NoPath Do not set PATH for the current process." + echo " --verbose,-Verbose Display diagnostics information." + echo " --azure-feed,-AzureFeed For internal use only." + echo " Allows using a different storage to download SDK archives from." + echo " This parameter is only used if --no-cdn is false." + echo " --uncached-feed,-UncachedFeed For internal use only." + echo " Allows using a different storage to download SDK archives from." + echo " This parameter is only used if --no-cdn is true." + echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable." + echo " -SkipNonVersionedFiles" + echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly." + echo " --jsonfile Determines the SDK version from a user specified global.json file." + echo " Note: global.json must have a value for 'SDK:Version'" + echo " --keep-zip,-KeepZip If set, downloaded file is kept." + echo " --zip-path, -ZipPath If set, downloaded file is stored at the specified path." + echo " -?,--?,-h,--help,-Help Shows this help message" + echo "" + echo "Install Location:" + echo " Location is chosen in following order:" + echo " - --install-dir option" + echo " - Environmental variable DOTNET_INSTALL_DIR" + echo " - $HOME/.dotnet" + exit 0 + ;; + *) + say_err "Unknown argument \`$name\`" + exit 1 + ;; + esac + + shift +done + +say_verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:" +say_verbose "- The SDK needs to be installed without user interaction and without admin rights." +say_verbose "- The SDK installation doesn't need to persist across multiple CI runs." +say_verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n" + +if [ "$internal" = true ] && [ -z "$(echo $feed_credential)" ]; then + message="Provide credentials via --feed-credential parameter." + if [ "$dry_run" = true ]; then + say_warning "$message" + else + say_err "$message" + exit 1 + fi +fi + +check_min_reqs +calculate_vars +# generate_regular_links call below will 'exit' if the determined version is already installed. +generate_download_links + +if [[ "$dry_run" = true ]]; then + print_dry_run + exit 0 +fi + +install_dotnet + +bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")" +if [ "$no_path" = false ]; then + say "Adding to current process PATH: \`$bin_path\`. Note: This change will be visible only when sourcing script." + export PATH="$bin_path":"$PATH" +else + say "Binaries of dotnet can be found in $bin_path" +fi + +say "Note that the script does not resolve dependencies during installation." +say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." +say "Installation finished successfully." diff --git a/automataCI/services/hestiaOS/Exec.sh.ps1 b/automataCI/services/hestiaOS/Exec.sh.ps1 new file mode 100644 index 0000000..831f597 --- /dev/null +++ b/automataCI/services/hestiaOS/Exec.sh.ps1 @@ -0,0 +1,207 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Vanilla.sh.ps1" + + + + +function hestiaOS-Exec { + param ( + [string]$___command, + [string]$___arguments, + [string]$___log_stdout, + [string]$___log_stderr + ) + + + # validate input + if (Test-Path -Path "${___command}" -ErrorAction SilentlyContinue) { + $___program = "${___command}" + } else { + $___program = Get-Command $___command -ErrorAction SilentlyContinue + if (-not ($___program)) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + } + + + # execute command + if ($(hestiaSTRING-Is-Empty "${___arguments}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + if (($(hestiaSTRING-Is-Empty "${___log_stdout}") -ne ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty "${___log_stderr}") -ne ${env:hestiaKERNEL_ERROR_OK})) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -RedirectStandardOutput "${___log_stdout}" ` + -RedirectStandardError "${___log_stderr}" + } elseif ($(hestiaSTRING-Is-Empty "${___log_stdout}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -RedirectStandardOutput "${___log_stdout}" + } elseif ($(hestiaSTRING-Is-Empty "${___log_stderr}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -RedirectStandardError "${___log_stderr}" + } else { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru + } + } else { + if (($(hestiaSTRING-Is-Empty "${___log_stdout}") -ne ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty "${___log_stderr}") -ne ${env:hestiaKERNEL_ERROR_OK})) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "${___arguments}" ` + -RedirectStandardOutput "${___log_stdout}" ` + -RedirectStandardError "${___log_stderr}" + } elseif ($(hestiaSTRING-Is-Empty "${___log_stdout}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "${___arguments}" ` + -RedirectStandardOutput "${___log_stdout}" + } elseif ($(hestiaSTRING-Is-Empty "${___log_stderr}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "${___arguments}" ` + -RedirectStandardError "${___log_stderr}" + } else { + $___process = Start-Process -Wait ` + -FilePath "${___program}" ` + -NoNewWindow ` + -PassThru ` + -ArgumentList "${___arguments}" + } + } + if ($___process.ExitCode -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaOS_Exec() { + ___command="$1" + ___argument="$2" + ___log_stdout="$3" + ___log_stderr="$4" + + + # validate input + if [ $(hestiaOS_Is_Command_Available "$___command") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute command + if [ $(hestiaSTRING_Is_Empty "$___arguments") -eq $hestiaKERNEL_ERROR_OK ]; then + if [ $(hestiaSTRING_Is_Empty "$___log_stdout") -ne $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$___log_stderr") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" 1>"$___log_stdout" 2>"$___log_stderr" + ___process=$? + elif [ $(hestiaSTRING_Is_Empty "$___log_stdout") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" 1>"$___log_stdout" + ___process=$? + elif [ $(hestiaSTRING_Is_Empty "$___log_stderr") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" 2>"$___log_stderr" + ___process=$? + else + "$___command" + ___process=$? + fi + else + if [ $(hestiaSTRING_Is_Empty "$___log_stdout") -ne $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$___log_stderr") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" $___arguments 1>"$___log_stdout" 2>"$___log_stderr" + ___process=$? + elif [ $(hestiaSTRING_Is_Empty "$___log_stdout") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" $___arguments 1>"$___log_stdout" + ___process=$? + elif [ $(hestiaSTRING_Is_Empty "$___log_stderr") -ne $hestiaKERNEL_ERROR_OK ]; then + "$___command" $___arguments 2>"$___log_stderr" + ___process=$? + else + "$___command" $___arguments + ___process=$? + fi + fi + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/Get_Arch.sh.ps1 b/automataCI/services/hestiaOS/Get_Arch.sh.ps1 new file mode 100644 index 0000000..2d59e23 --- /dev/null +++ b/automataCI/services/hestiaOS/Get_Arch.sh.ps1 @@ -0,0 +1,79 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaOS\To_Arch.sh.ps1" + + + + +function hestiaOS-Get-Arch { + param ( + [string]$___value + ) + + + # execute + return hestiaOS-To-Arch "$((Get-ComputerInfo).CsProcessors.Architecture)" +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaOS/To_Arch.sh.ps1" + + + + +hestiaOS_Get_Arch() { + #___value="$1" + + + # execute + printf -- "%b" "$(hestiaOS_To_Arch "$(uname -m)")" + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/Is_Command_Available.sh.ps1 b/automataCI/services/hestiaOS/Is_Command_Available.sh.ps1 new file mode 100644 index 0000000..66dfcfd --- /dev/null +++ b/automataCI/services/hestiaOS/Is_Command_Available.sh.ps1 @@ -0,0 +1,108 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Vanilla.sh.ps1" + + + + +function hestiaOS-Is-Command-Available { + param ( + [string]$___command + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___command}") -eq ${env:hestiaERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___process = Get-Command $___command -ErrorAction SilentlyContinue + if ($___process) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Vanilla.sh.ps1" + + + + +hestiaOS_Is_Command_Available() { + #___command="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + if [ $(hestiaSTRING_Is_Empty "$(type -t "$1")") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/Is_Simulation_Mode.sh.ps1 b/automataCI/services/hestiaOS/Is_Simulation_Mode.sh.ps1 new file mode 100644 index 0000000..7c7325d --- /dev/null +++ b/automataCI/services/hestiaOS/Is_Simulation_Mode.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" + + + + +function hestiaOS-Is-Simulation-Mode { + # execute + if (-not ([string]::IsNullOrEmpty("${env:PROJECT_SIMULATE_RUN}"))) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" + + + + +hestiaOS_Is_Simulation_Mode() { + # execute + if [ ! "$PROJECT_SIMULATE_RUN" = "" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/To_Arch.sh.ps1 b/automataCI/services/hestiaOS/To_Arch.sh.ps1 new file mode 100644 index 0000000..0aca168 --- /dev/null +++ b/automataCI/services/hestiaOS/To_Arch.sh.ps1 @@ -0,0 +1,106 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaOS-To-Arch { + param ( + [string]$___value + ) + + + # execute + switch ($___value.ToLower()) { + { $_ -in "i686-64", "ia64" } { + return "ia64" + } { $_ -in "386", "i386", "486", "i486", "586", "i586", "686", "i686", "x86" } { + return "i386" + } { $_ -match "ip*" } { + return "mips" + } { $_ -in "x86_64", "x64" } { + return "amd64" + } "sun4u" { + return "sparc" + } { $_ -in "power macintosh" } { + return "powerpc" + } default { + return $___value.ToLower() + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaOS_To_Arch() { + #___value="$1" + + + # execute + case "$(printf -- "%b" "$1" | tr '[:upper:]' '[:lower:]')" in + i686-64|ia64) + printf -- "%s" "ia64" + ;; + 386|i386|486|i486|586|i586|686|i686|x86) + printf -- "%s" "i386" + ;; + x86_64|x64) + printf -- "%s" "amd64" + ;; + sun4u) + printf -- "%s" "sparc" + ;; + "power macintosh") + printf -- "%s" "powerpc" + ;; + ip*) + printf -- "%s" "mips" + ;; + *) + printf -- "%s" "$1" | tr '[:upper:]' '[:lower:]' + ;; + esac + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/To_Arch_MSFT.sh.ps1 b/automataCI/services/hestiaOS/To_Arch_MSFT.sh.ps1 new file mode 100644 index 0000000..cdedb00 --- /dev/null +++ b/automataCI/services/hestiaOS/To_Arch_MSFT.sh.ps1 @@ -0,0 +1,116 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaOS-To-Arch-MSFT { + param ( + [string]$___value + ) + + + # execute + switch ($___value) { + "alpha" { + return "Alpha" + } "arm" { + return "ARM" + } "arm64" { + return "ARM64" + } "ia64" { + return "ia64" + } "i386" { + return "x86" + } "mips" { + return "MIPs" + } "amd64" { + return "x64" + } "powerpc" { + return "PowerPC" + } default { + return "" + }} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaOS_To_Arch_MSFT() { + #___value="$1" + + + # execute + case "$(printf -- "%b" "$1" | tr '[:upper:]' '[:lower:]')" in + alpha) + printf -- "%s" "Alpha" + ;; + arm) + printf -- "%s" "ARM" + ;; + arm64) + printf -- "%s" "ARM64" + ;; + ia64) + printf -- "%s" "ia64" + ;; + i386) + printf -- "%s" "x86" + ;; + mips) + printf -- "%s" "MIPs" + ;; + amd64) + printf -- "%s" "x64" + ;; + powerpc) + printf -- "%s" "PowerPC" + ;; + *) + printf -- "" + ;; + esac + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/To_Arch_UNIX.sh.ps1 b/automataCI/services/hestiaOS/To_Arch_UNIX.sh.ps1 new file mode 100644 index 0000000..0ca7a93 --- /dev/null +++ b/automataCI/services/hestiaOS/To_Arch_UNIX.sh.ps1 @@ -0,0 +1,132 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaOS-To-Arch-UNIX { + param ( + [string]$___value + ) + + + # execute + switch ($___value.ToLower()) { + "any" { + return "all" + } { $_ -in "386", "i386", "486", "i486", "586", "i586", "686", "i686" } { + return "i386" + } "armle" { + return "armel" + } "mipsle" { + return "mipsel" + } "mipsr6le" { + return "mipsr6el" + } "mipsn32le" { + return "mipsn32el" + } "mipsn32r6le" { + return "mipsn32r6el" + } "mips64le" { + return "mips64el" + } "mips64r6le" { + return "mips64r6el" + } "powerpcle" { + return "powerpcel" + } "ppc64le" { + return "ppc64el" + } default { + return $___value.ToLower() + }} + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +hestiaOS_To_Arch_UNIX() { + #___value="$1" + + + # execute + case "$(printf -- "%b" "$1" | tr '[:upper:]' '[:lower:]')" in + any) + printf -- "%s" "all" + ;; + 386|i386|486|i486|586|i586|686|i686) + printf -- "%s" "i386" + ;; + armle) + printf -- "%s" "armel" + ;; + mipsle) + printf -- "%s" "mipsel" + ;; + mipsr6le) + printf -- "%s" "mipsr6el" + ;; + mipsn32le) + printf -- "%s" "mipsn32el" + ;; + mipsn32r6le) + printf -- "%s" "mipsn32r6el" + ;; + mips64le) + printf -- "%s" "mips64el" + ;; + mips64r6le) + printf -- "%s" "mips64r6el" + ;; + powerpcle) + printf -- "%s" "powerpcel" + ;; + ppc64le) + printf -- "%s" "ppc64el" + ;; + *) + printf -- "%b" "$1" | tr '[:upper:]' '[:lower:]' + ;; + esac + return 0 +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaOS/Vanilla.sh.ps1 b/automataCI/services/hestiaOS/Vanilla.sh.ps1 new file mode 100644 index 0000000..9e2b948 --- /dev/null +++ b/automataCI/services/hestiaOS/Vanilla.sh.ps1 @@ -0,0 +1,66 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaOS\Exec.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Get_Arch.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Simulation_Mode.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\To_Arch.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\To_Arch_MSFT.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\To_Arch_UNIX.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaOS/Exec.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Get_Arch.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Simulation_Mode.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/To_Arch.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/To_Arch_MSFT.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/To_Arch_UNIX.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaPDF/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaPDF/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..9b788d9 --- /dev/null +++ b/automataCI/services/hestiaPDF/Is_Target_Valid.sh.ps1 @@ -0,0 +1,111 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaPDF-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ($("${___target}" -replace '.*\.pdf$', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaPDF_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%.pdf*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaPDF/Vanilla.sh.ps1 b/automataCI/services/hestiaPDF/Vanilla.sh.ps1 new file mode 100644 index 0000000..95f0ff6 --- /dev/null +++ b/automataCI/services/hestiaPDF/Vanilla.sh.ps1 @@ -0,0 +1,54 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaPDF\Is_Target_Valid.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaPDF/Is_Target_Valid.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaRUST/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaRUST/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..af5e05f --- /dev/null +++ b/automataCI/services/hestiaRUST/Is_Target_Valid.sh.ps1 @@ -0,0 +1,111 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaRUST-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ($("${___target}" -replace '^.*-cargo', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaRUST_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target##*-cargo}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaRUST/Vanilla.sh.ps1 b/automataCI/services/hestiaRUST/Vanilla.sh.ps1 new file mode 100644 index 0000000..618ae13 --- /dev/null +++ b/automataCI/services/hestiaRUST/Vanilla.sh.ps1 @@ -0,0 +1,54 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaRUST\Is_Target_Valid.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaRUST/Is_Target_Valid.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSHASUM/Create_From_File.sh.ps1 b/automataCI/services/hestiaSHASUM/Create_From_File.sh.ps1 new file mode 100644 index 0000000..c0c294e --- /dev/null +++ b/automataCI/services/hestiaSHASUM/Create_From_File.sh.ps1 @@ -0,0 +1,150 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaSHASUM-Create-From-File { + param ( + [string]$___target, + [string]$___algo + ) + + + # validate input + if ( + ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) -or + ($(hestiaSTRING-Is-Empty "${___algo}") -eq ${env:hestiaKERNEL_ERROR_OK}) + ) { + return "" + } + + if ($(hestiaFS-Is-File "${___target}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + switch ($___algo) { + '1' { + $___hasher = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider + } '224' { + return "" + } '256' { + $___hasher = New-Object System.Security.Cryptography.SHA256CryptoServiceProvider + } '384' { + $___hasher = New-Object System.Security.Cryptography.SHA384CryptoServiceProvider + } '512' { + $___hasher = New-Object System.Security.Cryptography.SHA512CryptoServiceProvider + } '512224' { + return "" + } '512256' { + return "" + } Default { + return "" + }} + + $___fileStream = [System.IO.File]::OpenRead($___target) + $___hash = $___hasher.ComputeHash($___fileStream) + return [System.BitConverter]::ToString($___hash).Replace("-", "").ToLower() +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaSHASUM_Create_From_File() { + #___target="$1" + #___algo="$2" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ] || + [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + case "$2" in + 1|224|256|384|512|512224|512256) + ;; + *) + printf -- "" + return $hestiaKERNEL_ERROR_DATA_INVALID + ;; + esac + + + # execute + if [ ! $(hestiaOS_Is_Command_Available "shasum") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + ___output="$(shasum -a "$2" "$1")" + printf -- "%s" "${___output%% *}" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSHASUM/Is_Available.sh.ps1 b/automataCI/services/hestiaSHASUM/Is_Available.sh.ps1 new file mode 100644 index 0000000..01ec462 --- /dev/null +++ b/automataCI/services/hestiaSHASUM/Is_Available.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaSHASUM-Is-Available { + # execute + if (-not [System.Security.Cryptography.SHA1]::Create("SHA1")) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if (-not [System.Security.Cryptography.SHA256]::Create("SHA256")) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if (-not [System.Security.Cryptography.SHA384]::Create("SHA384")) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if (-not [System.Security.Cryptography.SHA512]::Create("SHA512")) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaSHASUM_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "shasum") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSHASUM/Vanilla.sh.ps1 b/automataCI/services/hestiaSHASUM/Vanilla.sh.ps1 new file mode 100644 index 0000000..5866e06 --- /dev/null +++ b/automataCI/services/hestiaSHASUM/Vanilla.sh.ps1 @@ -0,0 +1,56 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSHASUM\Create_From_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSHASUM\Is_Available.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaSHASUM/Create_From_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSHASUM/Is_Available.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/Has.sh.ps1 b/automataCI/services/hestiaSTRING/Has.sh.ps1 new file mode 100644 index 0000000..ee217a3 --- /dev/null +++ b/automataCI/services/hestiaSTRING/Has.sh.ps1 @@ -0,0 +1,116 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" + + + + +function hestiaSTRING-Has { + param ( + [string]$___subject, + [string]$___target + ) + + + # validate input + if ([string]::IsNullOrEmpty($___target)) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + if ([string]::IsNullOrEmpty($___subject)) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EMPTY} + } + + + # execute + if ($("${___subject}" -replace "^.*${___target}", '') -ne "${___subject}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" + + + + +hestiaSTRING_Has() { + #___subject="$1" + #___target="$2" + + + # validate input + if [ -z "$1" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_ENTITY_EMPTY + return $hestiaKERNEL_ERROR_ENTITY_EMPTY + fi + + if [ -z "$2" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ ! "${1##*${2}}" = "$1" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/Is_Empty.sh.ps1 b/automataCI/services/hestiaSTRING/Is_Empty.sh.ps1 new file mode 100644 index 0000000..09c1540 --- /dev/null +++ b/automataCI/services/hestiaSTRING/Is_Empty.sh.ps1 @@ -0,0 +1,92 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" + + + + +function hestiaSTRING-Is-Empty { + param ( + $___target + ) + + + # execute + if ([string]::IsNullOrEmpty($___target)) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" + + + + +hestiaSTRING_Is_Empty() { + #___target="$1" + + + # execute + if [ -z "$1" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_EMPTY + return $hestiaKERNEL_ERROR_DATA_EMPTY +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/To_Lowercase.sh.ps1 b/automataCI/services/hestiaSTRING/To_Lowercase.sh.ps1 new file mode 100644 index 0000000..d0fde56 --- /dev/null +++ b/automataCI/services/hestiaSTRING/To_Lowercase.sh.ps1 @@ -0,0 +1,77 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaSTRING-To-Lowercase { + param ( + [string]$___content + ) + + + # execute + return $___content.ToLower() +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" + + + + +hestiaSTRING_To_Lowercase() { + #___content="$1" + + + # execute + printf -- "%b" "$1" | tr '[:upper:]' '[:lower:]' + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/To_Titlecase.sh.ps1 b/automataCI/services/hestiaSTRING/To_Titlecase.sh.ps1 new file mode 100644 index 0000000..ad214d0 --- /dev/null +++ b/automataCI/services/hestiaSTRING/To_Titlecase.sh.ps1 @@ -0,0 +1,156 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\IS_Empty.sh.ps1" + + + + +function hestiaSTRING-To-Titlecase { + param ( + [string]$___content + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___content}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___buffer = "" + $___resevoir = "${___content}" + $___trigger = $true + while ($___resevoir -ne "") { + ## extract character + $___char = $___resevoir.Substring(0, 1) + if ($___char -eq "``") { + $___char = $___resevoir.Substring(0, 2) + } + $___resevoir = $___resevoir -replace "^${___char}", "" + + ## process character + if ($___trigger ) { + $___char = $___char.ToUpper() + } else { + $___char = $___char.ToLower() + } + $___buffer += $___char + + ## set next character action + switch ("${___char}") { + { $_ -in " ", "`r", "`n" } { + $___trigger = $true + } default { + $___trigger = $false + }} + } + + + # report status + return $___buffer +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaSTRING_To_Titlecase() { + #___content="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + ___buffer="" + ___resevoir="$1" + ___trigger=0 + while [ -n "$___resevoir" ]; do + ## extract character + ___char="$(printf -- "%.1s" "$___resevoir")" + if [ "$___char" = '\' ]; then + ___char="$(printf -- "%.2s" "$___resevoir")" + fi + ___resevoir="${___resevoir#*${___char}}" + + ## process character + if [ $___trigger -eq 0 ]; then + ___char="$(printf -- "%s" "$___char" | tr '[:lower:]' '[:upper:]')" + else + ___char="$(printf -- "%s" "$___char" | tr '[:upper:]' '[:lower:]')" + fi + ___buffer="${___buffer}${___char}" + + ## set next character action + case "$___char" in + " "|"\r"|"\n") + ___trigger=0 + ;; + *) + ___trigger=1 + ;; + esac + done + + + # report status + printf -- "%s" "$___buffer" + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/To_Uppercase.sh.ps1 b/automataCI/services/hestiaSTRING/To_Uppercase.sh.ps1 new file mode 100644 index 0000000..b9f9a5e --- /dev/null +++ b/automataCI/services/hestiaSTRING/To_Uppercase.sh.ps1 @@ -0,0 +1,77 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaSTRING-To-Uppercase { + param ( + [string]$___content + ) + + + # execute + return $___content.ToUpper() +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" + + + + +hestiaSTRING_To_Uppercase() { + #___content="$1" + + + # execute + printf -- "%b" "$1" | tr '[:lower:]' '[:upper:]' + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaSTRING/Vanilla.sh.ps1 b/automataCI/services/hestiaSTRING/Vanilla.sh.ps1 new file mode 100644 index 0000000..f1b68f6 --- /dev/null +++ b/automataCI/services/hestiaSTRING/Vanilla.sh.ps1 @@ -0,0 +1,62 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\Has.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\To_Lowercase.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\To_Titlecase.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\To_Uppercase.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaSTRING/Has.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/To_Lowercase.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/To_Titlecase.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/To_Uppercase.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTAR/Is_Available.sh.ps1 b/automataCI/services/hestiaTAR/Is_Available.sh.ps1 new file mode 100644 index 0000000..4fcbbd3 --- /dev/null +++ b/automataCI/services/hestiaTAR/Is_Available.sh.ps1 @@ -0,0 +1,85 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaTAR-Is-Available { + if ($(hestiaOS-Is-Command-Available "tar") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaTAR_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "tar") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTAR/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaTAR/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..4a38ab6 --- /dev/null +++ b/automataCI/services/hestiaTAR/Is_Target_Valid.sh.ps1 @@ -0,0 +1,121 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaTAR-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___subject = hestiaFS-Get-File $___target + if ( + ($($___subject -replace ".*\.tar$", '') -ne $___subject) -or + ($($___subject -replace ".*\.tar\.gz$", '') -ne $___subject) -or + ($($___subject -replace ".*\.tgz$", '') -ne $___subject) -or + ($($___subject -replace ".*\.tar\.xz$", '') -ne $___subject) -or + ($($___subject -replace ".*\.txz$", '') -ne $___subject) + ) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaTAR_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___subject="$(hestiaFS_Get_File "$1")" + if [ ! "${___subject%%.tar*}" = "$___subject" ] || + [ ! "${___subject%%.tar.gz*}" = "$___subject" ] || + [ ! "${___subject%%.tgz*}" = "$___subject" ] || + [ ! "${___subject%%.tar.xz*}" = "$___subject" ] || + [ ! "${___subject%%.txz*}" = "$___subject" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTAR/Pack.sh.ps1 b/automataCI/services/hestiaTAR/Pack.sh.ps1 new file mode 100644 index 0000000..8f43758 --- /dev/null +++ b/automataCI/services/hestiaTAR/Pack.sh.ps1 @@ -0,0 +1,306 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaGZ\Compress.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Exec.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaXZ\Compress.sh.ps1" + + + + +function hestiaTAR-Pack { + param ( + [string]$___destination, + [string]$___source, + [string]$___compression, + [string]$___owner, + [string]$___group + ) + + + # validate input + if ($(hestiaTAR-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_IS_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + if ($(hestiaFS-Is-Directory $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} + } + + if ($(hestiaFS-Is-Directory $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaFS-Is-Directory-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if ($($___destination -replace '\.txz$') -ne $___destination) { + $___dest = $___destination -replace '\.txz$', '' + } elseif ($($___destination -replace '\.tgz$') -ne $___destination) { + $___dest = $___destination -replace '\.tgz$', '' + } else { + $___dest = $___destination -replace '\.tar.*$', '' + } + $___dest = "${___dest}.tar" + + if ($(hestiaFS-Get-Directory $___destination) -ne $___destination) { + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___destination)" + } + + + # archive to tar + # IMPORTANT: to prevent CVE-2022-21675 from happening, hestiaTAR shall + # change directory explictly into the archive root directory + # and form the relative pathings. + $___current_path = Get-Location + $null = Set-Location $___source + + ## IMPORTANT NOTICE: + ## Currently, windows' TAR does not support UNIX UGID system and there + ## isn't a way to determine yet. Hence, we will use a flag switch to + ## place the control codes but disabling it for now. + $___supported = $false + if ( + ($___supported) -and + ($(hestiaSTRING-Is-Empty $___owner) -ne ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaSTRING-Is-Empty $___group) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + $___process = hestiaOS-Exec "tar" @" +--numeric-owner --group=`"${___group}`" --owner=`"${___owner}`" " -cvf `"${___dest}`" `".`" +"@ + } else { + $___process = hestiaOS-Exec "tar" "-cvf `"${___dest}`" `".`"" + } + + $null = Set-Location $___current_path + $null = Remove-Variable -name ___current_path + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___dest + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # handles compression + switch ($___compression) { + { $_ -in "xz", "XZ" } { + $___process = hestiaXZ-Compress $___dest + $___dest = "${___dest}.xz" + } { $_ -in "gz", "GZ" } { + $___process = hestiaGZ-Compress $___dest + $___dest = "${___dest}.gz" + } default { + $___process = ${env:hestiaKERNEL_ERROR_OK} + }} + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___dest + return ${env:hestiaKERNEL_ERROR_BAD_PIPE} + } + + + # export to non-standard naming convention's destination + if ($___dest -ne $___destination) { + $___process = hestiaFS-Move $___destination $___dest + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___dest + return ${env:hestiaKERNEL_ERROR_BAD_STREAM_PIPE} + } + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaGZ/Compress.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaXZ/Compress.sh.ps1" + + + + +hestiaTAR_Pack() { + #___destination="$1" + #___source="$2" + #___compression="$3" + #___owner="$4" + #___group="$5" + + + # validate input + if [ $(hestiaTAR_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_IS_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + if [ $(hestiaFS_Is_Directory "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $(hestiaFS_Is_Directory_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ ! "${1%%.txz*}" = "$1" ]; then + ___dest="${1%%.txz*}" + elif [ ! "${1%%.tgz*}" = "$1" ]; then + ___dest="${1%%.tgz*}" + else + ___dest="${1%%.tar*}" + fi + ___dest="${___dest}.tar" + + if [ ! "$(hestiaFS_Get_Directory "$1")" = "$1" ]; then + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + fi + + + # archive to tar + # IMPORTANT: to prevent CVE-2022-21675 from happening, hestiaTAR shall + # change directory explictly into the archive root directory + # and form the relative pathings. + ___current_path="$PWD" + cd "$2" + + if [ $(hestiaSTRING_Is_Empty "$5") -ne $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaSTRING_Is_Empty "$5") -ne $hestiaKERNEL_ERROR_OK ]; then + tar --numeric-owner --group "$5" --owner "$4" -cvf "$___dest" "." + ___process=$? + else + tar -cvf "$___dest" "." + ___process=$? + fi + + cd "$___current_path" + unset ___current_path + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___dest" + return $hestiaKERNEL_ERROR_OK + fi + + + # handles compression + case "$3" in + xz|XZ) + hestiaXZ_Compress "$___dest" + ___process=$? + ___dest="${___dest}.xz" + ;; + gz|GZ) + hestiaGZ_Compress "$___dest" + ___process=$? + ___dest="${___dest}.gz" + ;; + *) + ___process=$hestiaKERNEL_ERROR_OK + ;; + esac + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___dest" + return $hestiaKERNEL_ERROR_BAD_PIPE + fi + + + # export to non-standard naming convention's destination + if [ ! "$___dest" = "$1" ]; then + hestiaFS_Move "$1" "$___dest" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$___dest" + return $hestiaKERNEL_ERROR_BAD_STREAM_PIPE + fi + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTAR/Unpack.sh.ps1 b/automataCI/services/hestiaTAR/Unpack.sh.ps1 new file mode 100644 index 0000000..01b7d06 --- /dev/null +++ b/automataCI/services/hestiaTAR/Unpack.sh.ps1 @@ -0,0 +1,173 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Is_Available.sh.ps1" + + + + +function hestiaTAR-Unpack { + param ( + [string]$___destination, + [string]$___source, + [string]$___compression + ) + + + # validate input + if ($(hestiaTAR-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_IS_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + if ($(hestiaFS-Is-Directory $___destination) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + } + + if ($(hestiaFS-Is-File $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + $null = hestiaFS-Create-Directory $___destination + switch ($___compression) { + { $_ -in "xz", "XZ" } { + $___process = hestiaOS-Exec "tar" "-C `"${___destination}`" -xf `"${___source}`"" + } { $_ -in "gz", "GZ" } { + $___process = hestiaOS-Exec "tar" "-C `"${___destination}`" -xzf `"${___source}`"" + } default { + $___process = hestiaOS-Exec "tar" "-C `"${___destination}`" -xf `"${___source}`"" + }} + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Is_Available.sh.ps1" + + + + +hestiaTAR_Unpack() { + ___destination="$1" + ___source="$2" + ___compression="$3" + + + # validate input + if [ $(hestiaTAR_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_IS_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_File "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + hestiaFS_Create_Directory "$1" + case "$3" in + xz|XZ) + tar -C "$1" -xf "$2" + ___process=$? + ;; + gz|GZ) + tar -C "$1" -xzf "$2" + ___process=$? + ;; + *) + tar -C "$1" -xf "$2" + ___process=$? + ;; + esac + + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTAR/Vanilla.sh.ps1 b/automataCI/services/hestiaTAR/Vanilla.sh.ps1 new file mode 100644 index 0000000..98b7ed3 --- /dev/null +++ b/automataCI/services/hestiaTAR/Vanilla.sh.ps1 @@ -0,0 +1,60 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaTAR\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Pack.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTAR\Unpack.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaTAR/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Pack.sh.ps1" +. "${LIBS_HESTIA}/hestiaTAR/Unpack.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Format_Date_ISO8601.sh.ps1 b/automataCI/services/hestiaTIME/Format_Date_ISO8601.sh.ps1 new file mode 100644 index 0000000..9ef118c --- /dev/null +++ b/automataCI/services/hestiaTIME/Format_Date_ISO8601.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaTIME-Format-Date-ISO8601 { + param( + [string]$___unix_epoch + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___unix_epoch}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___unix_epoch)) + return $___t.ToString("yyyy-MM-dd") +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" + + + + +hestiaTIME_Format_Date_ISO8601() { + #___unix_epoch="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaTIME_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -j -f "%s" "${1}" +"%Y-%m-%d")" + else + printf -- "%b" "$(date --date="@${1}" +"%Y-%m-%d")" + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Format_Date_RPM.sh.ps1 b/automataCI/services/hestiaTIME/Format_Date_RPM.sh.ps1 new file mode 100644 index 0000000..d2eed5d --- /dev/null +++ b/automataCI/services/hestiaTIME/Format_Date_RPM.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaTIME-Format-Date-RPM { + param ( + [string]$___unix_epoch + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___unix_epoch}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___unix_epoch)) + return $___t.ToString("ddd MMM dd yyyy") +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" + + + + +hestiaTIME_Format_Date_RPM() { + #___unix_epoch="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaTIME_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -j -f "%s" "${1}" +"%a %b %d %Y")" + else + printf -- "%b" "$(date --date="@${1}" +"%a %b %d %Y")" + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Format_Datetime_RFC5322.sh.ps1 b/automataCI/services/hestiaTIME/Format_Datetime_RFC5322.sh.ps1 new file mode 100644 index 0000000..8f9730e --- /dev/null +++ b/automataCI/services/hestiaTIME/Format_Datetime_RFC5322.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaTIME-Format-Datetime-RFC5322 { + param ( + [string]$___unix_epoch + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___unix_epoch}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___unix_epoch)) + return $___t.ToString("ddd, dd MMM YYYY HH:mm:ss zzz") +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" + + + + +hestiaTIME_Format_Datetime_RFC5322() { + #___unix_epoch="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaTIME_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -j -f "%s" "${1}" +"%a, %d %b %Y %H:%M:%S %z")" + else + printf -- "%b" "$(date --date="@${1}" +"%a, %d %b %Y %H:%M:%S %z")" + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Format_Datetime_RFC5322_UTC.sh.ps1 b/automataCI/services/hestiaTIME/Format_Datetime_RFC5322_UTC.sh.ps1 new file mode 100644 index 0000000..32b0039 --- /dev/null +++ b/automataCI/services/hestiaTIME/Format_Datetime_RFC5322_UTC.sh.ps1 @@ -0,0 +1,107 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaTIME-Format-Datetime-RFC5322-UTC { + param ( + [string]$___unix_epoch + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___unix_epoch}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return "" + } + + + # execute + $___t = (Get-Date "1970-01-01 00:00:00.000Z") + ([TimeSpan]::FromSeconds($___unix_epoch)) + return $___t.ToUniversalTime().ToString("ddd, dd MMM YYYY HH:mm:ss zzz") +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" + + + + +hestiaTIME_Format_Datetime_RFC5322_UTC() { + #___unix_epoch="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + if [ $(hestiaTIME_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + if [ "$(echo "$(uname)" | tr '[:upper:]' '[:lower:]')" = "darwin" ]; then + printf -- "%b" "$(date -u -j -f "%s" "${1}" +"%a, %d %b %Y %H:%M:%S %z")" + else + printf -- "%b" "$(date -u --date="@${1}" +"%a, %d %b %Y %H:%M:%S %z")" + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Is_Available.sh.ps1 b/automataCI/services/hestiaTIME/Is_Available.sh.ps1 new file mode 100644 index 0000000..a0e992c --- /dev/null +++ b/automataCI/services/hestiaTIME/Is_Available.sh.ps1 @@ -0,0 +1,73 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaTIME-Is-Available { + return 0 +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaTIME_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "date") -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" "$hestiaKERNEL_ERROR_NOT_POSSIBLE" + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # report status + printf -- "%d" "$hestiaKERNEL_ERROR_OK" + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Now.sh.ps1 b/automataCI/services/hestiaTIME/Now.sh.ps1 new file mode 100644 index 0000000..9457fc6 --- /dev/null +++ b/automataCI/services/hestiaTIME/Now.sh.ps1 @@ -0,0 +1,76 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaTIME-Now { + return Get-Date (Get-Date).ToUniversalTime() -UFormat %s +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" + + + + +hestiaTIME_Now() { + # validate input + hestiaTIME_Is_Available + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + + # execute + printf -- "%b" "$(date -u '+%s')" + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaTIME/Vanilla.sh.ps1 b/automataCI/services/hestiaTIME/Vanilla.sh.ps1 new file mode 100644 index 0000000..def94a2 --- /dev/null +++ b/automataCI/services/hestiaTIME/Vanilla.sh.ps1 @@ -0,0 +1,64 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaTIME\Format_Date_ISO8601.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Format_Date_RPM.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Format_Datetime_RFC5322.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Format_Datetime_RFC5322_UTC.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaTIME\Now.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaTIME/Format_Date_ISO8601.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Format_Date_RPM.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Format_Datetime_RFC5322.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Format_Datetime_RFC5322_UTC.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaTIME/Now.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaWASM/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaWASM/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..1e62580 --- /dev/null +++ b/automataCI/services/hestiaWASM/Is_Target_Valid.sh.ps1 @@ -0,0 +1,115 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaWASM-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ( + ($("${___target}" -replace '.*-wasm.*', '') -ne "${___target}") -or + ($("${___target}" -replace '.*\.wasm$', '') -ne "${___target}") + ) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaWASM_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target##*-wasm}" = "$___target" ] || + [ ! "${___target%%.wasm*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaWASM/Is_Target_Valid_JS.sh.ps1 b/automataCI/services/hestiaWASM/Is_Target_Valid_JS.sh.ps1 new file mode 100644 index 0000000..96523a2 --- /dev/null +++ b/automataCI/services/hestiaWASM/Is_Target_Valid_JS.sh.ps1 @@ -0,0 +1,122 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaWASM\Is_Target_Valid.sh.ps1" + + + + +function hestiaWASM-Is-Target-Valid-JS { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaWASM-Is-Target-Valid "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ($("${___target}" -replace '.*\.js$', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaWASM/Is_Target_Valid.sh.ps1" + + + + +hestiaWASM_Is_Target_Valid_JS() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaWASM_Is_Target_Valid "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_INVALID + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%.js*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaWASM/Vanilla.sh.ps1 b/automataCI/services/hestiaWASM/Vanilla.sh.ps1 new file mode 100644 index 0000000..f1e596d --- /dev/null +++ b/automataCI/services/hestiaWASM/Vanilla.sh.ps1 @@ -0,0 +1,56 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaWASM\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaWASM\Is_Target_Valid_JS.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaWASM/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaWASM/Is_Target_Valid_JS.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaXZ/Compress.sh.ps1 b/automataCI/services/hestiaXZ/Compress.sh.ps1 new file mode 100644 index 0000000..2df8a55 --- /dev/null +++ b/automataCI/services/hestiaXZ/Compress.sh.ps1 @@ -0,0 +1,128 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Is_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaXZ-Compress { + param ( + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___source}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaFS-Is-File "${___source}") -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_IS_NOT_FILE} + } + + + # execute + $___source = $___source -replace "\.xz$" + if ($(hestiaOS-Is-Command-Available "xz") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "xz" "-9 --compress `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Is_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaXZ_Compress() { + #___source="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaFS_Is_File "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_IS_NOT_FILE + fi + + + # execute + ___source="${1%.xz*}" + if [ $(hestiaOS_Is_Command_Available "xz") -eq $hestiaKERNEL_ERROR_OK ]; then + xz -9 --compress "$___source" + if [ $? -ne 0 ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaXZ/Deflate.sh.ps1 b/automataCI/services/hestiaXZ/Deflate.sh.ps1 new file mode 100644 index 0000000..7b23159 --- /dev/null +++ b/automataCI/services/hestiaXZ/Deflate.sh.ps1 @@ -0,0 +1,126 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaXZ\Is_Target_Valid.sh.ps1" + + + + +function hestiaXZ-Deflate { + param ( + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___source}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + if ($(hestiaXZ-Is-Target-Valid "${___source}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + if ($(hestiaOS-Is-Command-Available "xz") -eq ${env:hestiaKERNEL_ERROR_OK}) { + $___process = hestiaOS-Exec "xz" "--decompress `"${___source}`"" + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaXZ/Is_Target_Valid.sh.ps1" + + + + +hestiaXZ_Deflate() { + #___source="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + if [ $(hestiaXZ_Is_Target_Valid "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + if [ $(hestiaOS_Is_Command_Available "xz") -eq $hestiaKERNEL_ERROR_OK ]; then + xz --decompress "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_BAD_EXEC +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaXZ/Is_Available.sh.ps1 b/automataCI/services/hestiaXZ/Is_Available.sh.ps1 new file mode 100644 index 0000000..9912abf --- /dev/null +++ b/automataCI/services/hestiaXZ/Is_Available.sh.ps1 @@ -0,0 +1,84 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaOS\Is_Command_Available.sh.ps1" + + + + +function hestiaXZ-Is-Available { + # execute + if ($(hestiaOS-Is-Command-Available "xz") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaXZ_Is_Available() { + # execute + if [ $(hestiaOS_Is_Command_Available "xz") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + return $hestiaKERNEL_ERROR_NOT_POSSIBLE +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaXZ/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaXZ/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..8581b0f --- /dev/null +++ b/automataCI/services/hestiaXZ/Is_Target_Valid.sh.ps1 @@ -0,0 +1,120 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaXZ-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty "${___target}") -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___target = hestiaFS-Get-File "${___target}" + if ($("${___target}" -replace '.*\.txz$', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + if ($("${___target}" -replace '.*\.xz$', '') -ne "${___target}") { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaXZ_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + ___target="$(hestiaFS_Get_File "$1")" + if [ ! "${___target%%.txz*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + if [ ! "${___target%%.xz*}" = "$___target" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaXZ/Vanilla.sh.ps1 b/automataCI/services/hestiaXZ/Vanilla.sh.ps1 new file mode 100644 index 0000000..56245d9 --- /dev/null +++ b/automataCI/services/hestiaXZ/Vanilla.sh.ps1 @@ -0,0 +1,60 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaXZ\Compress.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaXZ\Deflate.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaXZ\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaXZ\Is_Target_Valid.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaXZ/Compress.sh.ps1" +. "${LIBS_HESTIA}/hestiaXZ/Deflate.sh.ps1" +. "${LIBS_HESTIA}/hestiaXZ/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaXZ/Is_Target_Valid.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaZIP/Is_Available.sh.ps1 b/automataCI/services/hestiaZIP/Is_Available.sh.ps1 new file mode 100644 index 0000000..a215f1a --- /dev/null +++ b/automataCI/services/hestiaZIP/Is_Available.sh.ps1 @@ -0,0 +1,81 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +function hestiaZIP-Is-Available { + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaZIP_Is_Available() { + # execute + hestiaOS_Is_Command_Available "zip" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + hestiaOS_Is_Command_Available "unzip" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaZIP/Is_Target_Valid.sh.ps1 b/automataCI/services/hestiaZIP/Is_Target_Valid.sh.ps1 new file mode 100644 index 0000000..43d01f9 --- /dev/null +++ b/automataCI/services/hestiaZIP/Is_Target_Valid.sh.ps1 @@ -0,0 +1,128 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Get_File.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaZIP-Is-Target-Valid { + param ( + [string]$___target + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___target) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_MISSING} + } + + + # execute + $___subject = hestiaFS-Get-File $___target + if ( + ($($___subject -replace '^.*\.nupkg$', '') -ne $___subject) -or + ($($___subject -replace '^.*\.zip$', '') -ne $___subject) + ) { + return ${env:hestiaKERNEL_ERROR_OK} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_DATA_MISMATCHED} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Get_File.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" + + + + +hestiaZIP_Is_Target_Valid() { + #___target="$1" + + + # validate input + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISSING + return $hestiaKERNEL_ERROR_DATA_MISSING + fi + + + # execute + if [ $(hestiaOS_Is_Command_Available "file") -eq $hestiaKERNEL_ERROR_OK ]; then + ___mime="$(file --brief --mime --mime-type "$1")" + ___mime="${___mime%%;*}" + + if [ "$___mime" = "application/zip" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + fi + + + # no choice - guess by extension as last resort + ___subject="$(hestiaFS_Get_File "$1")" + if [ ! "${___subject%%.zip*}" = "$___subject" ] || + [ ! "${___subject%%.nupkg*}" = "$___subject" ]; then + printf -- "%d" $hestiaKERNEL_ERROR_OK + return $hestiaKERNEL_ERROR_OK + fi + + + # report status + printf -- "%d" $hestiaKERNEL_ERROR_DATA_MISMATCHED + return $hestiaKERNEL_ERROR_DATA_MISMATCHED +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaZIP/Pack.sh.ps1 b/automataCI/services/hestiaZIP/Pack.sh.ps1 new file mode 100644 index 0000000..2e0cb99 --- /dev/null +++ b/automataCI/services/hestiaZIP/Pack.sh.ps1 @@ -0,0 +1,231 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Is_Available.sh.ps1" + + + + +function hestiaZIP-Pack { + param ( + [string]$___destination, + [string]$___source, + [string]$___compression + ) + + + # validate input + if ($(hestiaZIP-Is-Available) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_NOT_POSSIBLE} + } + + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_IS_EMPTY} + } + + if ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_EXISTS} + } + + if ($(hestiaFS-Is-Directory $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE} + } + + if ($(hestiaFS-Is-Directory $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + if ($(hestiaFS-Is-Directory-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_EMPTY} + } + + + # execute + if ($(hestiaFS-Get-Directory $___destination) -ne $___destination) { + $null = hestiaFS-Create-Directory "$(hestiaFS-Get-Directory $___destination)" + } + + + # archive to zip + # IMPORTANT: to prevent CVE-2022-21675 from happening, hestiaZIP shall + # change directory explictly into the archive root directory + # and form the relative pathings. + $___current_path = Get-Location + $null = Set-Location $___source + + try { + switch ($___compression) { + { $_ -in "none", "None", "NONE" } { + $null = Compress-Archive -Update ` + -CompressionLevel NoCompression ` + -DestinationPath $___destination ` + -Path "." + } { $_ -in "speed", "Speed", "SPEED" } { + $null = Compress-Archive -Update ` + -CompressionLevel Fastest ` + -DestinationPath $___destination ` + -Path "." + } default { + $null = Compress-Archive -Update ` + -CompressionLevel Optimal ` + -DestinationPath $___destination ` + -Path "." + }} + + $___process = hestiaFS-Is-File $___destination + } catch { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + $null = Set-Location $___current_path + $null = Remove-Variable -name ___current_path + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + $null = hestiaFS-Remove $___destination + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Is_Available.sh.ps1" + + + + +hestiaZIP_Pack() { + #___destination="$1" + #___source="$2" + #___compression="$3" + + + # validate input + if [ $(hestiaZIP_Is_Available) -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_IS_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_EXISTS + fi + + if [ $(hestiaFS_Is_Directory "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_FILE + fi + + if [ $(hestiaFS_Is_Directory "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + if [ $(hestiaFS_Is_Directory_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_EMPTY + fi + + + # execute + if [ ! "$(hestiaFS_Get_Directory "$1")" = "$1" ]; then + hestiaFS_Create_Directory "$(hestiaFS_Get_Directory "$1")" + fi + + + # archive to zip + # IMPORTANT: to prevent CVE-2022-21675 from creation, hestiaZIP shall + # change directory into the archive root directory and form + # the relative pathings. + ___current_path="$PWD" + cd "$2" + + case "$3" in + none|None|NONE) + zip -0 -r "$1" "." + ___process=$? + ;; + speed|Speed|SPEED) + zip -1 -r "$1" "." + ___process=$? + ;; + *) + zip -9 -r "$1" "." + ___process=$? + ;; + esac + + cd "$___current_path" + unset ___current_path + + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + hestiaFS_Remove "$1" + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaZIP/Unpack.sh.ps1 b/automataCI/services/hestiaZIP/Unpack.sh.ps1 new file mode 100644 index 0000000..817fe7e --- /dev/null +++ b/automataCI/services/hestiaZIP/Unpack.sh.ps1 @@ -0,0 +1,151 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaKERNEL\Error_Codes.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaFS\Vanilla.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaSTRING\Is_Empty.sh.ps1" + + + + +function hestiaZIP-Unpack { + param ( + [string]$___destination, + [string]$___source + ) + + + # validate input + if ($(hestiaSTRING-Is-Empty $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_ENTITY_MISSING} + } + + if ($(hestiaSTRING-Is-Empty $___source) -eq ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_IS_EMPTY} + } + + if ( + ($(hestiaFS-Is-Exist $___destination) -eq ${env:hestiaKERNEL_ERROR_OK}) -and + ($(hestiaFS-Is-Directory $___destination) -ne ${env:hestiaKERNEL_ERROR_OK}) + ) { + return ${env:hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY} + } + + if ($(hestiaFS-Is-File $___source) -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_DATA_INVALID} + } + + + # execute + try { + $null = hestiaFS-Create-Directory $___destination + $null = Expand-Archive -DestinationPath $___destination -Path $___source + $___process = ${env:hestiaKERNEL_ERROR_OK} + } catch { + $___process = ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaKERNEL/Error_Codes.sh.ps1" +. "${LIBS_HESTIA}/hestiaFS/Vanilla.sh.ps1" +. "${LIBS_HESTIA}/hestiaOS/Is_Command_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaSTRING/Is_Empty.sh.ps1" + + + + +hestiaZIP_Unpack() { + #___destination="$1" + #___source="$2" + + + # validate input + if [ $(hestiaOS_Is_Command_Available "unzip") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_NOT_POSSIBLE + fi + + if [ $(hestiaSTRING_Is_Empty "$1") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_MISSING + fi + + if [ $(hestiaSTRING_Is_Empty "$2") -eq $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_IS_EMPTY + fi + + if [ $(hestiaFS_Is_Exist "$1") -eq $hestiaKERNEL_ERROR_OK ] && + [ $(hestiaFS_Is_Directory "$1") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_ENTITY_IS_NOT_DIRECTORY + fi + + if [ $(hestiaFS_Is_File "$2") -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_DATA_INVALID + fi + + + # execute + hestiaFS_Create_Directory "$1" + unzip "$2" -d "$1" + if [ $? -ne $hestiaKERNEL_ERROR_OK ]; then + return $hestiaKERNEL_ERROR_BAD_EXEC + fi + + + # report status + return $hestiaKERNEL_ERROR_OK +} +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/hestiaZIP/Vanilla.sh.ps1 b/automataCI/services/hestiaZIP/Vanilla.sh.ps1 new file mode 100644 index 0000000..fb75c61 --- /dev/null +++ b/automataCI/services/hestiaZIP/Vanilla.sh.ps1 @@ -0,0 +1,60 @@ +echo \" <<'RUN_AS_BATCH' >/dev/null ">NUL "\" \`" <#" +@ECHO OFF +REM LICENSE CLAUSES HERE +REM ---------------------------------------------------------------------------- + + + + +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +where /q powershell +if errorlevel 1 ( + echo "ERROR: missing powershell facility." + exit /b 1 +) + +copy /Y "%~nx0" "%~n0.ps1" >nul +timeout /t 1 /nobreak >nul +powershell -executionpolicy remotesigned -Command "& '.\%~n0.ps1' %*" +start /b "" cmd /c del "%~f0" & exit /b %errorcode% +REM ############################################################################ +REM # Windows BATCH Codes # +REM ############################################################################ +RUN_AS_BATCH +#> | Out-Null + + + + +echo \" <<'RUN_AS_POWERSHELL' >/dev/null # " | Out-Null +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +. "${env:LIBS_HESTIA}\hestiaZIP\Is_Available.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Is_Target_Valid.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Pack.sh.ps1" +. "${env:LIBS_HESTIA}\hestiaZIP\Unpack.sh.ps1" +################################################################################ +# Windows POWERSHELL Codes # +################################################################################ +return +<# +RUN_AS_POWERSHELL + + + + +################################################################################ +# Unix Main Codes # +################################################################################ +. "${LIBS_HESTIA}/hestiaZIP/Is_Available.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Is_Target_Valid.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Pack.sh.ps1" +. "${LIBS_HESTIA}/hestiaZIP/Unpack.sh.ps1" +################################################################################ +# Unix Main Codes # +################################################################################ +return 0 +#> diff --git a/automataCI/services/io/fs.sh b/automataCI/services/io/fs.sh index aaaf22f..13777f9 100644 --- a/automataCI/services/io/fs.sh +++ b/automataCI/services/io/fs.sh @@ -357,10 +357,12 @@ FS_Is_Target_A_C() { fi if [ $(FS_Is_Target_A_Cargo "$1") -eq 0 ]; then + printf -- "1" return 1 fi if [ $(FS_Is_Target_A_Chocolatey "$1") -eq 0 ]; then + printf -- "1" return 1 fi diff --git a/automataCI/services/publishers/chocolatey.ps1 b/automataCI/services/publishers/chocolatey.ps1 index 313bdfd..c2a17aa 100644 --- a/automataCI/services/publishers/chocolatey.ps1 +++ b/automataCI/services/publishers/chocolatey.ps1 @@ -202,7 +202,7 @@ function CHOCOLATEY-Test { # execute $___name = Split-Path -Leaf -Path "${___target}" - $___name = $___name -replace '\-chocolatey.*$', '' + $___name = $___name -replace "_.*$", '' ## test install @@ -211,8 +211,9 @@ function CHOCOLATEY-Test { $___arguments = "install ${___name} " ` + "--debug " ` + "--verbose " ` + + "--pre " ` + "--force " ` - + "--source `".`" " + + "--source `".`"" $___process = OS-Exec "choco" "${___arguments}" $null = Set-Location "${___current_path}" $null = Remove-Variable "___current_path" @@ -227,8 +228,9 @@ function CHOCOLATEY-Test { $___arguments = "uninstall ${___name} " ` + "--debug " ` + "--verbose " ` + + "--pre " ` + "--force " ` - + "--source `".`" " + + "--source `".`"" $___process = OS-Exec "choco" "${___arguments}" $null = Set-Location "${___current_path}" $null = Remove-Variable "___current_path" diff --git a/automataCI/x-package_unix-any.sh b/automataCI/x-package_unix-any.sh new file mode 100644 index 0000000..ce05770 --- /dev/null +++ b/automataCI/x-package_unix-any.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# Copyright 2023 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run me from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + + + + +# begin registering packagers +for i in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_BUILD}"/*; do + # NOTE: deb does not work in windows or mac + if [ $(STRINGS_Is_Empty "$PROJECT_DEB_URL") -ne 0 ]; then + case "$TARGET_OS" in + windows|darwin) + ;; + *) + __log="deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ +${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE_Run_DEB +" + if [ $? -ne 0 ]; then + return 1 + fi + ;; + esac + fi + + + # NOTE: container only serve windows and linux + if [ $(STRINGS_Is_Empty "$PROJECT_CONTAINER_REGISTRY") -ne 0 ]; then + case "$TARGET_OS" in + any|linux|windows) + __log="docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__serial_control" "\ +${__common}|${__log}|PACKAGE_Run_DOCKER +" + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac + fi + + + # NOTE: flatpak only serve linux + FLATPAK_Is_Available + if [ $? -eq 0 ] && [ $(STRINGS_Is_Empty "$PROJECT_FLATPAK_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|linux) + __log="flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__serial_control" "\ +${__common}|${FLATPAK_REPO}|${__log}|PACKAGE_Run_FLATPAK +" + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac + fi + + if [ $(STRINGS_Is_Empty "$PROJECT_RELEASE_IPK") -ne 0 ]; then + __log="ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ +${__common}|${__log}|PACKAGE_Run_IPK +" + if [ $? -ne 0 ]; then + return 1 + fi + fi + + # NOTE: RPM only serve linux + if [ $(STRINGS_Is_Empty "$PROJECT_RPM_URL") -ne 0 ]; then + case "$TARGET_OS" in + any|linux) + __log="rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + __log="${__log_directory}/${__log}" + FS_Append_File "$__parallel_control" "\ +${__common}|${__log}|PACKAGE_Run_RPM +" + if [ $? -ne 0 ]; then + return 1 + fi + ;; + *) + ;; + esac + fi +done diff --git a/automataCI/x-package_windows-any.ps1 b/automataCI/x-package_windows-any.ps1 new file mode 100644 index 0000000..e14eddd --- /dev/null +++ b/automataCI/x-package_windows-any.ps1 @@ -0,0 +1,107 @@ +# Copyright 2023 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run me from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +# prepare for parallel package +foreach ($i in (Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_BUILD}")) { + # NOTE: deb does not work in windows or mac + if ($(STRINGS-Is-Empty "${env:PROJECT_DEB_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "windows", "darwin" } { + $__log = "deb_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" +${__common}|${FILE_CHANGELOG_DEB}|${__log}|PACKAGE-Run-DEB + +"@ + if ($___process -ne 0) { + return 1 + } + } default { + }} + } + + + # NOTE: container only server windows and linux + if ($(STRINGS-Is-Empty "${env:PROJECT_CONTAINER_REGISTRY}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux", "windows" } { + $__log = "docker_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__serial_control}" @" +${__common}|${__log}|PACKAGE-Run-DOCKER + +"@ + if ($___process -ne 0) { + return 1 + } + } default { + }} + } + + + # NOTE: flatpak only serve linux + $___process = FLATPAK-Is-Available + if (($___process -eq 0) -and + ($(STRINGS-Is-Empty "${env:PROJECT_FLATPAK_URL}") -ne 0)) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux" } { + $__log = "flatpak_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__serial_control}" @" +${__common}|${FLATPAK_REPO}|${__log}|PACKAGE-Run-FLATPAK + +"@ + if ($___process -ne 0) { + return 1 + } + } default { + }} + } + + if ($(STRINGS-Is-Empty "${env:PROJECT_RELEASE_IPK}") -ne 0) { + $__log = "ipk_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" +${__common}|${__log}|PACKAGE-Run-IPK + +"@ + if ($___process -ne 0) { + return 1 + } + } + + # NOTE: RPM only serve linux + if ($(STRINGS-Is-Empty "${env:PROJECT_RPM_URL}") -ne 0) { + switch ("${TARGET_OS}") { + { $_ -in "any", "linux" } { + $__log = "rpm_${TARGET_FILENAME}_${TARGET_OS}-${TARGET_ARCH}.log" + $__log = "${__log_directory}\${__log}" + $___process = FS-Append-File "${__parallel_control}" @" +${__common}|${__log}|PACKAGE-Run-RPM + +"@ + if ($___process -ne 0) { + return 1 + } + } default { + }} + } +} diff --git a/src/.ci/_package-archive_unix-any.sh b/src/.ci/_package-archive_unix-any.sh deleted file mode 100644 index 066772c..0000000 --- a/src/.ci/_package-archive_unix-any.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_ARCHIVE_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # package based on target's nature - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_DOCS}" - __dest="${_directory}/docs" - - FS_Is_Directory "$__source" - if [ $? -ne 0 ]; then - return 10 # not applicable - fi - - I18N_Assemble "$__source" "$__dest" - FS_Make_Directory "$__dest" - FS_Copy_All "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - return 10 # handled by lib packager - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # handled by wasm instead - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - __dest="${_directory}/assets/$(FS_Get_File "$_target")" - - I18N_Assemble "$_target" "$__dest" - FS_Make_Housing_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - __source="$(FS_Extension_Remove "$_target" ".wasm").js" - FS_Is_File "$__source" - if [ $? -eq 0 ]; then - __dest="${__dest}/$(FS_Get_File "$__source")" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - else - __dest="${_directory}/bin/${PROJECT_SKU}" - if [ "$_target_os" = "windows" ]; then - __dest="${__dest}.exe" - fi - - I18N_Assemble "$_target" "$__dest" - FS_Make_Housing_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - - # copy user guide - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_directory}/$(FS_Get_File "$__source")" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - done - - - # copy license file - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_directory}/$(FS_Get_File "$__source")" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - done - - - # report status - return 0 -} diff --git a/src/.ci/_package-archive_windows-any.ps1 b/src/.ci/_package-archive_windows-any.ps1 deleted file mode 100644 index 0d28260..0000000 --- a/src/.ci/_package-archive_windows-any.ps1 +++ /dev/null @@ -1,139 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-ARCHIVE-Content { - param( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # copy main program - if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_DOCS}" - $__dest = "${_directory}\docs" - - $___process = FS-Is-Directory "${__source}" - if ($___process -ne 0) { - return 10 # not applicable - } - - $null = I18N-Assemble "${__source}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-All "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - return 10 # handled by lib packager - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # handled by wasm instead - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - $__dest = "${_directory}\assets\$(FS-Get-File "${_target}")" - - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $__source = "$(FS-Extension-Remove "${_target}" ".wasm").js" - $___process = FS-Is-File "${__source}" - if ($___process -eq 0) { - $__dest = "${__dest}\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } else { - $__dest = "${_directory}\bin\${env:PROJECT_SKU}" - if ($_target_os -eq "windows") { - $__dest = "${__dest}.exe" - } - - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Housing-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy user guide - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` - | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_directory}\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy license file - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` - | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_directory}\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # report status - return 0 -} diff --git a/src/.ci/_package-cargo_unix-any.sh b/src/.ci/_package-cargo_unix-any.sh deleted file mode 100644 index 3072899..0000000 --- a/src/.ci/_package-cargo_unix-any.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Assemble_CARGO_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # execute - return 10 # IMPORTANT: please do it inside rust source instead. -} diff --git a/src/.ci/_package-cargo_windows-any.ps1 b/src/.ci/_package-cargo_windows-any.ps1 deleted file mode 100644 index 76ad385..0000000 --- a/src/.ci/_package-cargo_windows-any.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - - - - -function PACKAGE-Assemble-CARGO-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # execute - return 10 # IMPORTANT: please do it inside rust source instead. -} diff --git a/src/.ci/_package-chocolatey_unix-any.sh b/src/.ci/_package-chocolatey_unix-any.sh deleted file mode 100644 index c8523df..0000000 --- a/src/.ci/_package-chocolatey_unix-any.sh +++ /dev/null @@ -1,256 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" == "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_CHOCOLATEY_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate input - case "$_target_os" in - any|windows) - ;; - *) - return 10 # not supported - ;; - esac - - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - __dest="${_directory}/lib" - - if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_GZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_XZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - ZIP_Extract "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - else - # copy library file - __dest="${__dest}/$(FS_Get_File "$_target")" - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - _package="lib${PROJECT_SKU}" - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - else - # copy main program - __dest="${_directory}/bin/${PROJECT_SKU}.exe" - - I18N_Assemble "$_target" "$__dest" - FS_Make_Housing_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - _package="${PROJECT_SKU}" - fi - - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" - __dest="${_directory}/icon.png" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" - __dest="${_directory}/${PROJECT_README}" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # REQUIRED: chocolatey required tools\ directory - __dest="${_directory}/tools" - I18N_Create "$__dest" - FS_Make_Directory "$__dest" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 - __dest="${_directory}/tools/chocolateyBeforeModify.ps1" - I18N_Create "$__dest" - FS_Write_File "$__dest" "\ -# REQUIRED - BEGIN EXECUTION -Write-Host \"Performing pre-configurations...\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey tools\chocolateyinstall.ps1 - __dest="${_directory}/tools/chocolateyinstall.ps1" - I18N_Create "$__dest" - FS_Write_File "$__dest" "\ -# REQUIRED - PREPARING INSTALLATION -Write-Host \"Installing ${PROJECT_SKU} (${PROJECT_VERSION})...\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 - __dest="${_directory}/tools/chocolateyuninstall.ps1" - I18N_Create "$__dest" - FS_Write_File "$__dest" "\ -# REQUIRED - PREPARING UNINSTALLATION -Write-Host \"Uninstalling ${PROJECT_SKU} (${PROJECT_VERSION})...\" -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # REQUIRED: chocolatey xml.nuspec file - __dest="${_directory}/${_package}.nuspec" - I18N_Create "$__dest" - FS_Write_File "$__dest" "\ - - - - ${PROJECT_SKU} - ${PROJECT_NAME} - ${PROJECT_VERSION} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_WEBSITE} - ${PROJECT_LICENSE} - ${PROJECT_PITCH} - ${PROJECT_README} - icon.png - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - FS_Is_Directory_Empty "${_directory}/bin" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - FS_Is_Directory_Empty "${_directory}/lib" - if [ $? -ne 0 ]; then - FS_Append_File "$__dest" "\ - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - fi - - FS_Append_File "$__dest" "\ - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - return 1 - fi - - - # execute - return 0 -} diff --git a/src/.ci/_package-chocolatey_windows-any.ps1 b/src/.ci/_package-chocolatey_windows-any.ps1 deleted file mode 100644 index 0bd8bd8..0000000 --- a/src/.ci/_package-chocolatey_windows-any.ps1 +++ /dev/null @@ -1,263 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-CHOCOLATEY-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - switch ("${_target_os}") { - { $_ -in "any", "windows" } { - # accepted - } default { - return 10 # not supported - }} - - if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - $__dest = "${_directory}\lib" - - if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-GZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-XZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = ZIP-Extract "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } else { - # copy library file - $__dest = "${__dest}\$(FS-Get-File "${_target}")" - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - $_package = "lib${env:PROJECT_SKU}" - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } else { - # copy main program - $__dest = "${_directory}\bin\${env:PROJECT_SKU}.exe" - - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Housing-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $_package = "${env:PROJECT_SKU}" - } - - - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" - $__dest = "${_directory}\icon.png" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" - $__dest = "${_directory}\${env:PROJECT_README}" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # REQUIRED: chocolatey required tools\ directory - $__dest = "${_directory}\tools" - $null = I18N-Create "${__dest}" - $___process = FS-Make-Directory "${__dest}" - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # OPTIONAL: chocolatey tools\chocolateyBeforeModify.ps1 - $__dest = "${_directory}\tools\chocolateyBeforeModify.ps1" - $null = I18N-Create "${__dest}" - $___process = FS-Write-File "${__dest}" @" -# REQUIRED - BEGIN EXECUTION -Write-Host "Performing pre-configurations..." -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey tools\chocolateyinstall.ps1 - $__dest = "${_directory}\tools\chocolateyinstall.ps1" - $null = I18N-Create "${__dest}" - $___process = FS-Write-File "${__dest}" @" -# REQUIRED - PREPARING INSTALLATION -Write-Host "Installing ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey tools\chocolateyuninstall.ps1 - $__dest = "${_directory}\tools\chocolateyuninstall.ps1" - $null = I18N-Create "${__dest}" - $___process = FS-Write-File "${__dest}" @" -# REQUIRED - PREPARING UNINSTALLATION -Write-Host "Uninstalling ${env:PROJECT_SKU} (${env:PROJECT_VERSION})..." - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # REQUIRED: chocolatey xml.nuspec file - $__dest = "${_directory}\${env:PROJECT_SKU}.nuspec" - $null = I18N-Create "${__dest}" - $___process = FS-Write-File "${__dest}" @" - - - - ${env:PROJECT_SKU} - ${env:PROJECT_NAME} - ${env:PROJECT_VERSION} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_CONTACT_WEBSITE} - ${env:PROJECT_LICENSE} - ${env:PROJECT_PITCH} - ${env:PROJECT_README} - icon.png - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - $___process = FS-Is-Directory-Empty "${_directory}\bin" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - $___process = FS-Is-Directory-Empty "${_directory}\lib" - if ($___process -ne 0) { - $___process = FS-Append-File "${__dest}" @" - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - } - - $___process = FS-Append-File "${__dest}" @" - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/src/.ci/_package-homebrew_unix-any.sh b/src/.ci/_package-homebrew_unix-any.sh deleted file mode 100644 index 8e39131..0000000 --- a/src/.ci/_package-homebrew_unix-any.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_HOMEBREW_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate input - if [ "$(STRINGS_Is_Empty "$PROJECT_HOMEBREW_URL")" -eq 0 ]; then - return 10 # disabled explictly - fi - - case "$_target_os" in - any|darwin|linux) - ;; - *) - return 10 # not supported - ;; - esac - - - # execute - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - __dest="${_directory}/lib" - - if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_GZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_XZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - ZIP_Extract "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - else - # copy library file - __dest="${__dest}/$(FS_Get_File "$_target")" - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - else - # copy main program - __dest="${_directory}/bin/$(FS_Get_File "$_target")" - - I18N_Assemble "$_target" "$__dest" - FS_Make_Housing_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - - # report status - return 0 -} diff --git a/src/.ci/_package-homebrew_windows-any.ps1 b/src/.ci/_package-homebrew_windows-any.ps1 deleted file mode 100644 index de198b0..0000000 --- a/src/.ci/_package-homebrew_windows-any.ps1 +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-HOMEBREW-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(STRINGS-Is-Empty "${env:PROJECT_HOMEBREW_URL}") -eq 0) { - return 10 # disabled explictly - } - - switch ("${_target_os}") { - { $_ -in "any", "darwin", "linux" } { - # accepted - } default { - return 10 # not supported - }} - - if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - $__dest = "${_directory}\lib" - - if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-GZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-XZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = ZIP-Extract "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } else { - # copy library file - $__dest = "${__dest}\$(FS-Get-File "${_target}")" - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } else { - # copy main program - $__dest = "${_directory}\bin\$(FS-Get-File "${_target}")" - - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Housing-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # report status - return 0 -} diff --git a/src/.ci/_package-lib_unix-any.sh b/src/.ci/_package-lib_unix-any.sh deleted file mode 100644 index 3e2324b..0000000 --- a/src/.ci/_package-lib_unix-any.sh +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/sh -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/io/strings.sh" -. "${LIBS_AUTOMATACI}/services/archive/tar.sh" -. "${LIBS_AUTOMATACI}/services/archive/zip.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Assemble_LIB_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate project - if [ $(FS_Is_Target_A_Library "$_target") -ne 0 ]; then - return 10 # not applicable - fi - - - # execute - _workspace="packagers-lib-$(FS_Get_File "$_target")" - _workspace="${PROJECT_PATH_ROOT}/${PROJECT_PATH_TEMP}/${_workspace}" - FS_Remove_Silently "$_workspace" - - __dest="${_workspace}/lib" - if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then - # copy over - do not further modify its content anymore - __dest="lib${PROJECT_SKU}-NPM_${PROJECT_VERSION}_js-js.tgz" - __dest="${_directory}/${__dest}" - I18N_Copy "$_target" "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - - return 0 - elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_GZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_XZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - ZIP_Extract "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - else - # assumed it is a standalone library file - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - - # sanity check before proceeding - FS_Is_Directory_Empty "$__dest" - if [ $? -eq 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # copy README.md - __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" - __dest="${_workspace}/${PROJECT_README}" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # copy user guide files - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_workspace}/$(FS_Get_File "$__source")" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - done - - - # copy license files - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_workspace}/$(FS_Get_File "$__source")" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - done - - - # assemble icon.png - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon-128x128.png" - __dest="${_workspace}/icon.png" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # begin packaging - __current_path="$PWD" && cd "$_workspace" - - ## package tar.xz - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.xz" - I18N_Create_Package "$__dest" - __dest="${_directory}/${__dest}" - TAR_Create_XZ "$__dest" "." - if [ $? -ne 0 ]; then - I18N_Create_Failed - cd "$__current_path" && unset __current_path - return 1 - fi - - ## package zip - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${_target_arch}.zip" - I18N_Create_Package "$__dest" - __dest="${_directory}/${__dest}" - ZIP_Create "$__dest" "." - if [ $? -ne 0 ]; then - I18N_Create_Failed - cd "$__current_path" && unset __current_path - return 1 - fi - - ## package nupkg - __acceptance="false" - if [ $(STRINGS_To_Lowercase "$PROJECT_LICENSE_ACCEPTANCE_REQUIRED") = "true" ]; then - __acceptance="true" - fi - - __dest="lib${PROJECT_SKU}.nuspec" - I18N_Create "$__dest" - FS_Write_File "./${__dest}" "\ - - - - ${PROJECT_SKU} - ${PROJECT_VERSION} - ${PROJECT_CONTACT_NAME} - ${PROJECT_CONTACT_NAME} - ${PROJECT_SOURCE_URL} - ${PROJECT_NAME} - ${PROJECT_PITCH} - ${PROJECT_LICENSE} - ${__acceptance} - ${PROJECT_README} - icon.png - - - - - - - -" - if [ $? -ne 0 ]; then - I18N_Create_Failed - cd "$__current_path" && unset __current_path - return 1 - fi - - __dest="lib${PROJECT_SKU}_${PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" - I18N_Create_Package "$__dest" - __dest="${_directory}/${__dest}" - ZIP_Create "$__dest" "." - if [ $? -ne 0 ]; then - I18N_Create_Failed - cd "$__current_path" && unset __current_path - return 1 - fi - - ## done - clean up - cd "$__current_path" && unset __current_path - - - # report status - return 0 -} diff --git a/src/.ci/_package-lib_windows-any.ps1 b/src/.ci/_package-lib_windows-any.ps1 deleted file mode 100644 index 9cdd117..0000000 --- a/src/.ci/_package-lib_windows-any.ps1 +++ /dev/null @@ -1,246 +0,0 @@ -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\io\strings.ps1" -. "${env:LIBS_AUTOMATACI}\services\archive\tar.ps1" -. "${env:LIBS_AUTOMATACI}\services\archive\zip.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - - - - -function PACKAGE-Assemble-LIB-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(FS-Is-Target-A-Library "${_target}") -ne 0) { - return 10 # not applicable - } - - - # execute - $_workspace = "packagers-lib-lib${env:PROJECT_SKU}_${_target_os}-${_target_arch}" - $_workspace = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_TEMP}\${_workspace}" - $null = FS-Remove-Silently "${_workspace}" - - $__dest = "${_workspace}\lib" - if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { - # copy over - do not modify anymore - $__dest = "lib${env:PROJECT_SKU}-NPM_${env:PROJECT_VERSION}_js-js.tgz" - $__dest = "${_directory}\${__dest}" - $null = I18N-Copy "${_target}" "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Copy-Failed - return 1 - } - - return 0 - } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-GZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-XZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = ZIP-Extract "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } else { - # assumed it is a standalone library file - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # sanity check before proceeding - $___process = FS-Is-Directory-Empty "${__dest}" - if ($___process -eq 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy README.md - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" - $__dest = "${_workspace}\${env:PROJECT_README}" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy user guide - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` - | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_workspace}\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy license file - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` - | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_workspace}\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # assemble icon.png - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon-128x128.png" - $__dest = "${_workspace}\icon.png" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # begin packaging - $__current_path = Get-Location - $null = Set-Location -Path "${_workspace}" - - ## package tar.xz - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.tar.xz" - $null = I18N-Create-Package "${__dest}" - $__dest = "${_directory}\${__dest}" - $___process = TAR-Create-XZ "${__dest}" "." - if ($___process -ne 0) { - $null = I18N-Create-Failed - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - return 1 - } - - ## package zip - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.zip" - $null = I18N-Create-Package "${__dest}" - $__dest = "${_directory}\${__dest}" - $___process = ZIP-Create "${__dest}" "." - if ($___process -ne 0) { - $null = I18N-Create-Failed - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - return 1 - } - - ## package nupkg - $__acceptance = "false" - if ($(STRINGS-To-Lowercase "${env:PROJECT_LICENSE_ACCEPTANCE_REQUIRED}") -eq "true") { - $__acceptance = "true" - } - - $__dest = "lib${env:PROJECT_SKU}.nuspec" - $null = I18N-Create "${__dest}" - $__dest = ".\${__dest}" - $___process = FS-Write-File "${__dest}" @" - - - - ${env:PROJECT_SKU} - ${env:PROJECT_VERSION} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_CONTACT_NAME} - ${env:PROJECT_SOURCE_URL} - ${env:PROJECT_NAME} - ${env:PROJECT_PITCH} - ${env:PROJECT_LICENSE} - ${__acceptance} - ${env:PROJECT_README} - - - - - - - - -"@ - if ($___process -ne 0) { - $null = I18N-Create-Failed - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - return 1 - } - - $__dest = "lib${env:PROJECT_SKU}_${env:PROJECT_VERSION}_${_target_os}-${_target_arch}.nupkg" - $null = I18N-Create-Package "${__dest}" - $__dest = "${_directory}\${__dest}" - $___process = ZIP-Create "${__dest}" "." - if ($___process -ne 0) { - $null = I18N-Create-Failed - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - return 1 - } - - ## done - clean up - $null = Set-Location -Path "${__current_path}" - $null = Remove-Variable -Name __current_path - - - # report status - return 0 -} diff --git a/src/.ci/_package-msi_unix-any.sh b/src/.ci/_package-msi_unix-any.sh deleted file mode 100644 index c4979a5..0000000 --- a/src/.ci/_package-msi_unix-any.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -PACKAGE_Assemble_MSI_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate input - case "$_target_os" in - any|windows) - ;; - *) - return 10 # not supported - ;; - esac - - case "$_target_arch" in - any|amd64) - ;; - arm64|i386|arm) - return 10 # wixl can only support amd64 - ;; - *) - return 10 # not supported - ;; - esac - - - # execute - if [ $(FS_Is_Target_A_Source "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Docs "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Library "$_target") -eq 0 ]; then - # unpack to the designated lib/ directory - __dest="${_directory}/lib" - - if [ $(FS_Is_Target_A_NPM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_TARGZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_GZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_TARXZ "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - TAR_Extract_XZ "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - elif [ $(FS_Is_Target_A_ZIP "$_target") -eq 0 ]; then - # unpack library - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - ZIP_Extract "$__dest" "$_target" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - else - # copy library file - __dest="${__dest}/$(FS_Get_File "${_target}")" - I18N_Assemble "$_target" "$__dest" - FS_Make_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - elif [ $(FS_Is_Target_A_WASM_JS "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_WASM "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Chocolatey "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Homebrew "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_Cargo "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_MSI "$_target") -eq 0 ]; then - return 10 # not applicable - elif [ $(FS_Is_Target_A_PDF "$_target") -eq 0 ]; then - return 10 # not applicable - else - # copy main program to the designated bin/ directory - __dest="${_directory}/bin/${PROJECT_SKU}.exe" - - I18N_Assemble "$_target" "$__dest" - FS_Make_Housing_Directory "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - fi - - - # copy README.md into the designated docs/ directory - __source="${PROJECT_PATH_ROOT}/${PROJECT_README}" - __dest="${_directory}/docs/${PROJECT_README}" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # copy user guide files to the designated docs/ directory - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/docs/USER-GUIDES"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_directory}/docs/$(FS_Get_File "$__source")" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - done - - - # copy PDF license files to the designated docs/ directory - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.pdf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_directory}/docs/$(FS_Get_File "$__source")" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - done - - - # copy RTF license files to the designated docs/ directory - for __source in "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/licenses/LICENSE"*.rtf; do - FS_Is_Target_Exist "$__source" - if [ $? -ne 0 ]; then - continue - fi - - __dest="${_directory}/docs/$(FS_Get_File "$__source")" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - done - - - # copy icon ico file to the designated base directory - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/icon.ico" - __dest="${_directory}/icon.ico" - I18N_Assemble "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Assemble_Failed - return 1 - fi - - - # copy MSI banner jpg file to the designated base directory - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-banner.jpg" - __dest="${_directory}/msi-banner.jpg" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - - - # copy MSI dialog jpg file to the designated base directory - __source="${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/icons/msi-dialog.jpg" - __dest="${_directory}/msi-dialog.jpg" - I18N_Copy "$__source" "$__dest" - FS_Copy_File "$__source" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - - - ## OPTIONAL - create a '[LANG].wxs' recipe if you wish to override one - ## and place it inside the designated base directory. - ## Otherwise, AutomataCI shall create one for you using its - ## packaging structure. - - - # report status - return 0 -} diff --git a/src/.ci/_package-msi_windows-any.ps1 b/src/.ci/_package-msi_windows-any.ps1 deleted file mode 100644 index 1f54d69..0000000 --- a/src/.ci/_package-msi_windows-any.ps1 +++ /dev/null @@ -1,235 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -function PACKAGE-Assemble-MSI-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - switch ("${_target_os}") { - { $_ -in "any", "windows" } { - # accepted - } default { - return 10 # not supported - }} - - switch (${_target_arch}) { - { $_ -in "any", "amd64", "arm64", "i386", "arm" } { - # accepted - } default { - return 10 # not supported - }} - - - # download required UI extensions into designated ext/ directory - $__toolkit_ui = 'WixToolset.UI.wixext' - $__dest = "wixext4\${__toolkit_ui}.dll" - $null = I18N-Assemble "${__toolkit_ui}" "${_directory}\ext\${__dest}" - $___process = DOTNET-Add "${__toolkit_ui}" "4.0.3" "${_directory}\ext" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # processing target - if ($(FS-Is-Target-A-Source "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Docs "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Library "${_target}") -eq 0) { - # unpack to the designated lib/ directory - $__dest = "${_directory}\lib" - - if ($(FS-Is-Target-A-NPM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-TARGZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-GZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-TARXZ "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = TAR-Extract-XZ "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } elseif ($(FS-Is-Target-A-ZIP "${_target}") -eq 0) { - # unpack library - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = ZIP-Extract "${__dest}" "${_target}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } else { - # copy library file - $__dest = "${__dest}\$(FS-Get-File "${_target}")" - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - } elseif ($(FS-Is-Target-A-WASM-JS "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-WASM "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Chocolatey "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Homebrew "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-Cargo "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-MSI "${_target}") -eq 0) { - return 10 # not applicable - } elseif ($(FS-Is-Target-A-PDF "${_target}") -eq 0) { - return 10 # not applicable - } else { - # copy main program to the designated bin/ directory - $__dest = "${_directory}\bin\${env:PROJECT_SKU}.exe" - - $null = I18N-Assemble "${_target}" "${__dest}" - $null = FS-Make-Housing-Directory "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy README.md into the designated docs/ directory - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_README}" - $__dest = "${_directory}\docs\${env:PROJECT_README}" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy user guide files to the designated docs/ directory - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\docs" ` - | Where-Object { ($_.Name -like "USER-GUIDES*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_directory}\docs\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy PDF license files to the designated docs/ directory - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` - | Where-Object { ($_.Name -like "LICENSE*.pdf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_directory}\docs\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy RTF license files to the designated docs/ directory - Get-ChildItem -Path "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\licenses" ` - | Where-Object { ($_.Name -like "LICENSE*.rtf") } ` - | ForEach-Object { $__source = $_.FullName - $__dest = "${_directory}\docs\$(FS-Get-File "${__source}")" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - } - - - # copy icon.ico file to the designated base directory - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\icon.ico" - $__dest = "${_directory}\icon.ico" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy MSI banner jpg file to the designated base directory - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-banner.jpg" - $__dest = "${_directory}\msi-banner.jpg" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - - # copy MSI dialog jpg file to the designated base directory - $__source = "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\icons\msi-dialog.jpg" - $__dest = "${_directory}\msi-dialog.jpg" - $null = I18N-Assemble "${__source}" "${__dest}" - $___process = FS-Copy-File "${__source}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Assemble-Failed - return 1 - } - - ## OPTIONAL - create a '[LANG].wxs' recipe if you wish to override one - ## and place it inside the designated base directory. - ## Otherwise, AutomataCI shall create one for you using its - ## packaging structure. - - - # report status - return 0 -} diff --git a/src/.ci/_package-pdf_unix-any.sh b/src/.ci/_package-pdf_unix-any.sh deleted file mode 100644 index a9d8735..0000000 --- a/src/.ci/_package-pdf_unix-any.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -. "${LIBS_AUTOMATACI}/services/io/fs.sh" -. "${LIBS_AUTOMATACI}/services/i18n/translations.sh" - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Assemble_PDF_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # validate project - if [ $(FS_Is_Target_A_PDF "$_target") -ne 0 ]; then - return 10 # not applicable - fi - - - # execute - __dest="${_directory}/$(FS_Get_File "$_target")" - I18N_Copy "$_target" "$__dest" - FS_Copy_File "$_target" "$__dest" - if [ $? -ne 0 ]; then - I18N_Copy_Failed - return 1 - fi - - - # report status - return 0 -} diff --git a/src/.ci/_package-pdf_windows-any.ps1 b/src/.ci/_package-pdf_windows-any.ps1 deleted file mode 100644 index e769fe5..0000000 --- a/src/.ci/_package-pdf_windows-any.ps1 +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2024 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1" -. "${env:LIBS_AUTOMATACI}\services\i18n\translations.ps1" - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - exit 1 -} - - - - -function PACKAGE-Assemble-PDF-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # validate project - if ($(FS-Is-Target-A-PDF "${_target}") -ne 0) { - return 10 # not applicable - } - - - # execute - $__dest = "${_directory}\$(FS-Get-File "${_target}")" - $null = I18N-Copy "${_target}" "${__dest}" - $___process = FS-Copy-File "${_target}" "${__dest}" - if ($___process -ne 0) { - $null = I18N-Copy-Failed - return 1 - } - - - # report status - return 0 -} diff --git a/src/.ci/_package-pypi_unix-any.sh b/src/.ci/_package-pypi_unix-any.sh deleted file mode 100644 index bd8308d..0000000 --- a/src/.ci/_package-pypi_unix-any.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" = "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - - - - -PACKAGE_Assemble_PYPI_Content() { - _target="$1" - _directory="$2" - _target_name="$3" - _target_os="$4" - _target_arch="$5" - - - # execute - return 10 # IMPORTANT: please do it inside python source instead. -} diff --git a/src/.ci/_package-pypi_windows-any.ps1 b/src/.ci/_package-pypi_windows-any.ps1 deleted file mode 100644 index af4f437..0000000 --- a/src/.ci/_package-pypi_windows-any.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - - - - -function PACKAGE-Assemble-PYPI-Content { - param ( - [string]$_target, - [string]$_directory, - [string]$_target_name, - [string]$_target_os, - [string]$_target_arch - ) - - - # execute - return 10 # IMPORTANT: please do it inside python source instead. -} diff --git a/src/.ci/package-archive_unix-any.sh b/src/.ci/package-archive_unix-any.sh new file mode 100644 index 0000000..8eb8e5a --- /dev/null +++ b/src/.ci/package-archive_unix-any.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# Copyright 2023 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/__package-assemble-default-content_unix-any.sh" + + + + +PACKAGE_Assemble_ARCHIVE_Content() { + #_target="$1" + #_directory="$2" + #_target_name="$3" + #_target_os="$4" + #_target_arch="$5" + + + + + # IMPORTANT NOTICE: + # (1) AutomataCI supplies default function called + # 'PACKAGE_Assemble_Default_Content' to keep things maintainable. + # You may remove it and customize the assembly behavior on your + # own. + # + # (2) Duly noted that this is a multi-pipelines task where it produces + # the following artifacts in sequences: + # (2.1) NPM.tgz (when enabled & detected) + # (2.2) RUST.crate (when enabled & detected) + # (2.3) .tar.xz (when enabled) + # (2.4) .zip (when enabled) + # (2.5) chocolatey.nupkg (when enabled) + # (2.6) dotnet.nupkg (when enabled) + # + # (3) If you wish to customize chocolatey tool scripts, please apply + # the changes into the provided template scripts inside: + # ${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/chocolatey/tools + # directory. They will be placed within during packaging process. + # + # (4) Dated to this note, there is no need to customize .nuspec file + # since they are heavily governed by specifications. AutomataCI + # will generate them autonomously with files detections and + # processing. Hence, you only need to focus on placing the content + # at the right place. + PACKAGE_Assemble_Default_Content "$1" "$2" "$3" "$4" "$5" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $___process + fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/src/.ci/package-archive_windows-any.ps1 b/src/.ci/package-archive_windows-any.ps1 new file mode 100644 index 0000000..2466390 --- /dev/null +++ b/src/.ci/package-archive_windows-any.ps1 @@ -0,0 +1,80 @@ +#!/bin/sh +# Copyright 2023 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if (-not (Test-Path -Path ${env:PROJECT_PATH_ROOT})) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\__package-assemble-default-content_windows-any.ps1" + + + + +function PACKAGE-Assemble-ARCHIVE-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch + ) + + + + + # IMPORTANT NOTES: + # (1) AutomataCI supplies default function called + # 'PACKAGE_Assemble_Default_Content' to keep things maintainable. + # You may remove it and customize the assembly behavior on your + # own. + # + # (2) Duly noted that this is a multi-pipelines task where it produces + # the following artifacts in sequences: + # (2.1) NPM.tgz (when enabled & detected) + # (2.2) RUST.crate (when enabled & detected) + # (2.1) .tar.xz (when enabled) + # (2.2) .zip (when enabled) + # (2.3) chocolatey.nupkg (when enabled) + # (2.4) dotnet.nupkg (when enabled) + # + # (3) If you wish to customize chocolatey tool scripts, please apply + # the changes into the provided template scripts inside: + # ${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/data/chocolatey/tools + # directory. They will be placed within during packaging process. + # + # (4) Dated to this notice, there is no need to customize .nuspec file + # since they are heavily governed by specifications. AutomataCI + # will generate them autonomously with files detections and + # processing. Hence, you only need to focus on placing the content + # at the right place. + $___process = PACKAGE-Assemble-Default-Content ` + $_target ` + $_directory ` + $_target_name ` + $_target_os ` + $_target_arch + if ($___process -ne ${env:hestiaKERNEL_ERROR_OK}) { + return ${env:hestiaKERNEL_ERROR_BAD_EXEC} + } + + + + + # report status + return ${env:hestiaKERNEL_ERROR_OK} +} diff --git a/src/.ci/package-consolidate_unix-any.sh b/src/.ci/package-consolidate_unix-any.sh new file mode 100644 index 0000000..20ed433 --- /dev/null +++ b/src/.ci/package-consolidate_unix-any.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/__package-assemble-default-content_unix-any.sh" + + + + +PACKAGE_Assemble_CONSOLIDATE_Content() { + #_target="$1" + #_directory="$2" + #_target_name="$3" + #_target_os="$4" + #_target_arch="$5" + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + PACKAGE_Assemble_Default_Content "$1" "$2" "$3" "$4" "$5" "exclude_docs" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $___process + fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/src/.ci/package-consolidate_windows-any.ps1 b/src/.ci/package-consolidate_windows-any.ps1 new file mode 100644 index 0000000..e6de35e --- /dev/null +++ b/src/.ci/package-consolidate_windows-any.ps1 @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if (-not (Test-Path -Path ${env:PROJECT_PATH_ROOT})) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\__package-assemble-default-content_windows-any.ps1" + + + + +function PACKAGE-Assemble-CONSOLIDATE-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch + ) + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + return PACKAGE-Assemble-Default-Content ` + $_target ` + $_directory ` + $_target_name ` + $_target_os ` + $_target_arch ` + "exclude_docs" +} diff --git a/src/.ci/package-single_unix-any.sh b/src/.ci/package-single_unix-any.sh new file mode 100644 index 0000000..8adc3fc --- /dev/null +++ b/src/.ci/package-single_unix-any.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/__package-assemble-default-content_unix-any.sh" + + + + +PACKAGE_Assemble_SINGLE_Content() { + #_target="$1" + #_directory="$2" + #_target_name="$3" + #_target_os="$4" + #_target_arch="$5" + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + PACKAGE_Assemble_Default_Content "$1" "$2" "$3" "$4" "$5" "exclude_docs" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $___process + fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/src/.ci/package-single_windows-any.ps1 b/src/.ci/package-single_windows-any.ps1 new file mode 100644 index 0000000..e7ef869 --- /dev/null +++ b/src/.ci/package-single_windows-any.ps1 @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\__package-assemble-default-content_windows-any.ps1" + + + + +function PACKAGE-Assemble-SINGLE-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch + ) + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + return PACKAGE-Assemble-Default-Content ` + $_target ` + $_directory ` + $_target_name ` + $_target_os ` + $_target_arch ` + "exclude_docs" +} diff --git a/src/.ci/package-windows_unix-any.sh b/src/.ci/package-windows_unix-any.sh new file mode 100644 index 0000000..c5f2ce6 --- /dev/null +++ b/src/.ci/package-windows_unix-any.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if [ "$PROJECT_PATH_ROOT" = "" ]; then + >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" + return 1 +fi + +. "${LIBS_AUTOMATACI}/__package-assemble-default-content_unix-any.sh" + + + + +PACKAGE_Assemble_WINDOWS_Content() { + #_target="$1" + #_directory="$2" + #_target_name="$3" + #_target_os="$4" + #_target_arch="$5" + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + PACKAGE_Assemble_Default_Content "$1" "$2" "$3" "$4" "$5" "exclude_docs" + ___process=$? + if [ $___process -ne $hestiaKERNEL_ERROR_OK ]; then + return $___process + fi + + + + + # report status + return $hestiaKERNEL_ERROR_OK +} diff --git a/src/.ci/package-windows_windows-any.ps1 b/src/.ci/package-windows_windows-any.ps1 new file mode 100644 index 0000000..e3d83b6 --- /dev/null +++ b/src/.ci/package-windows_windows-any.ps1 @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright 2024 (Holloway) Chew, Kean Ho +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at: +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + + + + +# initialize +if (-not (Test-Path -Path ${env:PROJECT_PATH_ROOT})) { + Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" + return 1 +} + +. "${env:LIBS_AUTOMATACI}\__package-assemble-default-content_windows-any.ps1" + + + + +function PACKAGE-Assemble-WINDOWS-Content { + param ( + [string]$_target, + [string]$_directory, + [string]$_target_name, + [string]$_target_os, + [string]$_target_arch + ) + + + + + # IMPORTANT NOTICE: + # (1) It's your choice to assemble the content of the package as per + # your use cases. By default, AutomataCI offers FHS content + # assembly function ('PACKAGE_Assemble_Default_Content') + # that you can use. + return PACKAGE-Assemble-Default-Content ` + $_target ` + $_directory ` + $_target_name ` + $_target_os ` + $_target_arch ` + "exclude_docs" +} diff --git a/src/.ci/package_unix-any.sh b/src/.ci/package_unix-any.sh deleted file mode 100644 index e81727d..0000000 --- a/src/.ci/package_unix-any.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - - - - -# initialize -if [ "$PROJECT_PATH_ROOT" == "" ]; then - >&2 printf "[ ERROR ] - Please run from automataCI/ci.sh.ps1 instead!\n" - return 1 -fi - -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-archive_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-cargo_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-chocolatey_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-deb_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-docker_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-flatpak_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-homebrew_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-ipk_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-lib_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-msi_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-pdf_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-pypi_unix-any.sh" -. "${PROJECT_PATH_ROOT}/${PROJECT_PATH_SOURCE}/${PROJECT_PATH_CI}/_package-rpm_unix-any.sh" - - - - -# report status -return 0 diff --git a/src/.ci/package_windows-any.ps1 b/src/.ci/package_windows-any.ps1 deleted file mode 100644 index 6423336..0000000 --- a/src/.ci/package_windows-any.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2023 (Holloway) Chew, Kean Ho -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy -# of the License at: -# http://www.apache.org/licenses/LICENSE-2.0 -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - - - -# initialize -if (-not (Test-Path -Path $env:PROJECT_PATH_ROOT)) { - Write-Error "[ ERROR ] - Please run from automataCI\ci.sh.ps1 instead!`n" - return 1 -} - -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-archive_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-cargo_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-chocolatey_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-deb_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-docker_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-flatpak_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-homebrew_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-ipk_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-lib_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-msi_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-pdf_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-pypi_windows-any.ps1" -. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_SOURCE}\${env:PROJECT_PATH_CI}\_package-rpm_windows-any.ps1" - - - - -# report status -return 0 diff --git a/src/data/chocolatey/tools/ChocolateyBeforeModify.ps1 b/src/data/chocolatey/tools/ChocolateyBeforeModify.ps1 new file mode 100644 index 0000000..36333cf --- /dev/null +++ b/src/data/chocolatey/tools/ChocolateyBeforeModify.ps1 @@ -0,0 +1 @@ +# Write-Host "Performing pre-configurations..." - Done by AutomataCI diff --git a/src/data/chocolatey/tools/ChocolateyInstall.ps1 b/src/data/chocolatey/tools/ChocolateyInstall.ps1 new file mode 100644 index 0000000..8abe928 --- /dev/null +++ b/src/data/chocolatey/tools/ChocolateyInstall.ps1 @@ -0,0 +1 @@ +# Write-Host "Installing ${__package_sku} (${PROJECT_VERSION})..." - Done by AutomataCI diff --git a/src/data/chocolatey/tools/ChocolateyUninstall.ps1 b/src/data/chocolatey/tools/ChocolateyUninstall.ps1 new file mode 100644 index 0000000..ca9588b --- /dev/null +++ b/src/data/chocolatey/tools/ChocolateyUninstall.ps1 @@ -0,0 +1 @@ +# Write-Host "Uninstalling ${__package_sku} (${PROJECT_VERSION})..." - Done by AutomataCI diff --git a/src/data/unix/control/post-install.sh b/src/data/unix/control/post-install.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/src/data/unix/control/post-install.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/src/data/unix/control/post-remove.sh b/src/data/unix/control/post-remove.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/src/data/unix/control/post-remove.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/src/data/unix/control/pre-install.sh b/src/data/unix/control/pre-install.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/src/data/unix/control/pre-install.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/src/data/unix/control/pre-remove.sh b/src/data/unix/control/pre-remove.sh new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/src/data/unix/control/pre-remove.sh @@ -0,0 +1 @@ +#!/bin/sh diff --git a/srcRESEARCH/.ci/build_unix-any.sh b/srcRESEARCH/.ci/build_unix-any.sh index bd64d63..081aed0 100644 --- a/srcRESEARCH/.ci/build_unix-any.sh +++ b/srcRESEARCH/.ci/build_unix-any.sh @@ -39,7 +39,7 @@ fi # setup inportant variables -___name="${PROJECT_SKU}-${PROJECT_RESEARCH_IDENTIFIER}_${PROJECT_VERSION}_any-any" +___name="${PROJECT_SKU}-${PROJECT_RESEARCH_ID}_${PROJECT_VERSION}_any-any" ___source="research-paper.odt" diff --git a/srcRESEARCH/.ci/build_windows-any.ps1 b/srcRESEARCH/.ci/build_windows-any.ps1 index cabcceb..a16142a 100644 --- a/srcRESEARCH/.ci/build_windows-any.ps1 +++ b/srcRESEARCH/.ci/build_windows-any.ps1 @@ -38,7 +38,7 @@ if ($___process -ne 0) { # setup important variables -$___name = "${env:PROJECT_SKU}-${env:PROJECT_RESEARCH_IDENTIFIER}_${env:PROJECT_VERSION}_any-any" +$___name = "${env:PROJECT_SKU}-${env:PROJECT_RESEARCH_ID}_${env:PROJECT_VERSION}_any-any" $___source = "research-paper.odt"