Skip to content

enhancement: Make install.sh more reliable #10

Description

@nabil1440

Blocker: no. This can wait. Do fix step 6 in the same release as the monitoring agent (#26 to #30).

Defect

  • The script does not use set -euo pipefail.
  • curl -s does not use -f. On a 404 error, the script saves the error page as the tarball. Then, the script shows "Failed to extract". This message does not tell the real cause.
  • The script runs apt-get install grep without apt-get update. GNU grep on Ubuntu always supports -P. Thus, this step is not necessary.
  • When the script stops because of a rate limit, it does not remove its temporary file.
  • The script uses grep to parse JSON.
  • The script does not compare the download with a checksum.
  • On a server with the monitoring agent, /usr/local/bin/fly is a link to ~fly/.fly/bin/fly. The script moves the new binary to /usr/local/bin/fly. mv replaces the link with a separate file.

Cost

  • Some errors show an incorrect cause. Thus, installation problems are hard to find.
  • A command that fails does not always stop the script.
  • On a server with the agent, the server then has two binaries. fly update updates the separate file, and the agent continues with the old binary.

Benefit of the fix

  • Each error stops the script with a correct message.
  • The script does not leave temporary files.
  • The script examines the download before it installs the binary (with enhancement: Examine release downloads with checksums #9).
  • On a server with the agent, the CLI and the agent use the same binary.

Fix

  1. Add set -euo pipefail.
  2. Use curl -fsSL for each download.
  3. Remove the grep -P installation step.
  4. Add a trap that removes the temporary files.
  5. Compare the download with checksums.txt (refer to enhancement: Examine release downloads with checksums #9). ci: run make check on every change and publish releases with gh #25 publishes it.
  6. If /usr/local/bin/fly is a link, install to the target of the link, and keep the owner of the target.

Why this can wait

  • The script operates correctly on Ubuntu at this time.
  • The FlyWP installer, not this script, installs the agent. Fix step 6 is necessary only when a person runs this script on a server with the agent.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions