diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..96a3961 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [2024] [chengsiyuan@acoinfo.com] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README b/README new file mode 100644 index 0000000..919a25b --- /dev/null +++ b/README @@ -0,0 +1,137 @@ +# SylixOS Uploader + +SylixOS Uploader is a command-line tool designed for uploading SylixOS projects via CORBA. It simplifies the process of transferring files to remote devices, setting appropriate permissions, and generating configuration YAML files for project uploads. + +## Features + +1. File Uploads: + + - Upload project files to remote devices using FTP. + - Automatically set permissions (chmod 0755) for: + - ELF executables or shared object files. + - Known executable scripts (e.g., .sh, .py, .lua, etc.). + +2. YAML Generation: + + - Generate structured YAML configuration files for SylixOS projects, ensuring easier management and deployment. + +3. Versioning: + + - Injects Git version information into the build, including the latest tag, commit hash, and dirty state (if there are uncommitted changes). + +4. Flexible Build Options: + + - Default: Build only for the local platform. + - Optionally: Cross-compile for multiple platforms (Linux, Windows, macOS, SylixOS). + - Supports installation to a specified directory. + +## Usage + +### Upload Example + +```bash +sylixos-uploader upload --path ~/sylixos-workspace/base-project --device 10.13.16.250 --method ftp +``` + +### Generate YAML Example + +```bash +sylixos-uploader gen-yaml --path ~/sylixos-workspace/base-project +``` + +### YAML File Example + +```yaml +base-settings: + project-name: app_test + project-type: SylixOSAppProject + $(ProjectPath): /home/user/sylixos-workspace/app_test + $(Output): Release +remote-settings: + ipaddr: 10.7.130.102 + work-path: /apps/app_test + protocol: ftp +upload-pair: + - local-path: $(ProjectPath)/$(Output)/strip + remote-path: /usr/bin +``` + +## Building SylixOS Uploader + +### Requirements + +- Golang installed and configured with GOOS=sylixos support. +- Git available in the environment. + +### Build Script + +Use the build.sh script to compile the tool. The script determines the version based on Git tags and the latest commit, providing flexible options. + +### Script Options + +- --all: Build for all supported platforms (Linux, Windows, macOS, SylixOS). +- --install-dir \: Install the binary to the specified directory. + +### Examples + +#### Build for the local platform + +```bash +./build.sh +``` + +#### Build for all platforms + +```bash +./build.sh --all +``` + +#### Build local platform and Install to a directory + +```bash +./build.sh --install-dir /usr/local/bin +``` + +## Supported Platforms + +- Linux: + + - amd64 + - arm64 + +- Windows: + + - amd64 + - arm64 + +- macOS: + + - amd64 + - arm64 + +- SylixOS: + - arm64 + +## Known Issues + +1. Currently, only FTP is supported for uploads. + +## Known Behaviors + +1. Uploads projects to the specified remote device. +2. On the remote device: + - ELF executables or shared objects are set to chmod 0755. + - Known executable scripts are set to chmod 0755. +3. Generates a YAML file from the actual SylixOS project. + +## Contributing + +Feel free to submit pull requests or report issues on the project’s repository. Ensure that your code adheres to the project guidelines and includes relevant tests. + +## License + +This project is licensed under the MIT License. See the LICENSE file for details. + +## Contact + +For any issues, questions, or feature requests, reach out to the maintainers via Gitea. diff --git a/cmd/root.go b/cmd/root.go index f2f2e7b..6a7fcb7 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -26,7 +26,7 @@ Konwn-Issue: Konwn-Behavior: 1. Upload project to device. 2. On Remote device, ELF executable or shared object file will be chmod to 0755. - 3. On Remote device, konwn executable script will be chmod to 0755. + 3. On Remote device, konwn executable script (e.g. .sh, .py, .lua, etc) will be chmod to 0755. 4. Generate upload yaml file from real evo project. Upload-Example: