- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1
 
feat: update install script #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
08c113b    to
    d77dbde      
    Compare
  
    Signed-off-by: Patrick Stephens <pat@fluent.do>
d77dbde    to
    d41d76d      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 3 comments
        
          
                install.sh
              
                Outdated
          
        
      | "package-${target_os}-${DISTRO_VERSION}.${target_arch}" # e.g., package-debian-bookworm.arm64v8 | ||
| "package-${target_os}-${DISTRO_VERSION}" # e.g., package-debian-bookworm (amd64 default) | ||
| ) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: DISTRO_VERSION may be undefined if detect_distro() returns early or fails. This causes empty path components like package-debian-.arm64v8
| "package-${target_os}-${DISTRO_VERSION}.${target_arch}" # e.g., package-debian-bookworm.arm64v8 | |
| "package-${target_os}-${DISTRO_VERSION}" # e.g., package-debian-bookworm (amd64 default) | |
| ) | |
| local package_dirs=( | |
| "package-${target_os}-${DISTRO_VERSION:-unknown}.${target_arch}" # e.g., package-debian-bookworm.arm64v8 | |
| "package-${target_os}-${DISTRO_VERSION:-unknown}" # e.g., package-debian-bookworm (amd64 default) | |
| ) | 
Prompt To Fix With AI
This is a comment left during a code review.
Path: install.sh
Line: 288:290
Comment:
**logic:** `DISTRO_VERSION` may be undefined if `detect_distro()` returns early or fails. This causes empty path components like `package-debian-.arm64v8`
```suggestion
    local package_dirs=(
        "package-${target_os}-${DISTRO_VERSION:-unknown}.${target_arch}"   # e.g., package-debian-bookworm.arm64v8
        "package-${target_os}-${DISTRO_VERSION:-unknown}"                  # e.g., package-debian-bookworm (amd64 default)
    )
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greptile-ai probably better to fail with an explanation, e.g. ${DISTRO_VERSION:?Unknown distribution}
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Pat <patrick.j.k.stephens@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Pat <patrick.j.k.stephens@gmail.com>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
Signed-off-by: Patrick Stephens <pat@fluent.do>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 1 comment
| # Construct candidate directory names for the package | ||
| # e.g., package-almalinux-8.arm64 | ||
| # e.g., package-almalinux-8 (for amd64) | ||
| local package_dir="package-${target_os}-${DISTRO_VERSION}${target_arch_dir_suffix}" | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: DISTRO_VERSION can still be empty if detect_distro() returns early at line 263 when neither /etc/os-release nor /etc/lsb-release exist, creating malformed paths like package-debian-.arm64v8
| local package_dir="package-${target_os}-${DISTRO_VERSION}${target_arch_dir_suffix}" | |
| local package_dir="package-${target_os}-${DISTRO_VERSION:-unknown}${target_arch_dir_suffix}" | 
Prompt To Fix With AI
This is a comment left during a code review.
Path: install.sh
Line: 557:557
Comment:
**logic:** `DISTRO_VERSION` can still be empty if `detect_distro()` returns early at line 263 when neither `/etc/os-release` nor `/etc/lsb-release` exist, creating malformed paths like `package-debian-.arm64v8`
```suggestion
    local package_dir="package-${target_os}-${DISTRO_VERSION:-unknown}${target_arch_dir_suffix}"
```
How can I resolve this? If you propose a fix, please make it concise.
Tweaks to install script to properly cope with packages.fluent.do URL and support various additional options.
Greptile Overview
Updated On: 2025-10-31 18:25:20 UTC
Greptile Summary
The install script has been significantly rewritten to support the new
packages.fluent.doinfrastructure. The changes successfully implement:-iflag)-dflag) and force installation option (-fflag)Progress on Previous Issues:
DOWNLOAD_ONLYlogic bug (changed!= falseto!= true)FORCEvariable now uses safe parameter expansion${FORCE:-}DISTRO_VERSIONcan still be undefined if distribution detection fails, creating malformed package paths likepackage-debian-.arm64v8The script is functional for common cases but the remaining
DISTRO_VERSIONissue could cause failures on systems where/etc/os-releaseand/etc/lsb-releaseare both missing.Confidence Score: 4/5
Important Files Changed
File Analysis
Sequence Diagram
sequenceDiagram participant User participant Script as install.sh participant PackageServer as packages.fluent.do participant PkgMgr as Package Manager User->>Script: Execute install.sh [options] Script->>Script: Parse CLI arguments (-v, -i, -u, -d, -f, etc.) Script->>Script: Initialize FORCE, INTERACTIVE, DOWNLOAD_ONLY flags Script->>Script: detect_platform() - Detect OS & arch Note over Script: Sets OS_TYPE (linux/darwin) and ARCH_TYPE (amd64/arm64) Script->>Script: detect_distro() - Detect distro & pkg format Note over Script: Sets DISTRO_ID, DISTRO_VERSION, PKG_FORMAT, PKG_MANAGER alt Force flag not set and generic format Script->>User: Error: Unsupported distribution end Script->>PackageServer: fetch_available_versions() - GET / PackageServer-->>Script: Return HTML with data-version attributes Script->>Script: Parse HTML, extract & sort versions alt Interactive mode (-i) Script->>User: list_versions() - Display numbered list User-->>Script: Select version number or input version Script->>Script: Validate selection else Version specified (-v) Script->>Script: Use VERSION from CLI argument else Default Script->>Script: get_latest_version() - Pick first from sorted list end Script->>Script: find_package() - Build package search paths Note over Script: Maps DISTRO_ID to target_os (ubuntu/debian/almalinux/alpine)<br/>Maps ARCH_TYPE to target_arch (amd64/arm64v8) loop For each package directory pattern Script->>PackageServer: HTTP HEAD ${PACKAGES_URL}/${version}/output/${dir}/ PackageServer-->>Script: Return HTTP status alt Directory exists (200/301/302) Script->>Script: Set matching_dir and break end end alt No matching directory Script->>User: Error: No package directory found end Script->>PackageServer: GET ${PACKAGES_URL}/${version}/output/${matching_dir}/ PackageServer-->>Script: Return HTML directory listing Script->>Script: Extract package filename by format (.deb/.rpm/.apk) Script->>Script: Construct full package path Script->>Script: Create temp directory with trap for cleanup Script->>PackageServer: download_package() - curl -L -f PackageServer-->>Script: Download package to temp file Script->>Script: Verify file exists and non-empty alt Download only mode (-d flag) Script->>User: Package downloaded, skip install else Normal install Script->>PkgMgr: install_package() - Call apt-get/yum/apk Note over Script,PkgMgr: For deb: apt-get update && apt-get install<br/>For rpm: yum install<br/>For apk: apk add --allow-untrusted PkgMgr-->>Script: Installation result Script->>Script: verify_installation() - Test FLUENTDO_AGENT_BINARY alt Binary works Script->>User: Success with version info else Binary not found Script->>User: Warning: verification issues end Script->>User: Installation complete with next steps end Script->>Script: Cleanup temp directory (trap EXIT)