{"id":14991394,"url":"https://github.com/opsbr/any-install","last_synced_at":"2025-06-20T09:06:34.307Z","repository":{"id":255810316,"uuid":"853587345","full_name":"opsbr/any-install","owner":"opsbr","description":"Any Install makes easier to maintain installer shell scripts by its own manifest DSL.","archived":false,"fork":false,"pushed_at":"2025-06-14T00:03:27.000Z","size":1284,"stargazers_count":4,"open_issues_count":13,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T01:18:57.760Z","etag":null,"topics":["bun","installer","shell"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opsbr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-07T01:19:48.000Z","updated_at":"2025-05-17T00:06:34.000Z","dependencies_parsed_at":"2024-09-07T08:23:51.188Z","dependency_job_id":"bed40194-2019-48cb-a232-d1888729f2f2","html_url":"https://github.com/opsbr/any-install","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":0.4117647058823529,"last_synced_commit":"e8a405282df48b050b7d7eb6dd8382c3110c65bd"},"previous_names":["opsbr/any-install"],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/opsbr/any-install","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsbr%2Fany-install","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsbr%2Fany-install/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsbr%2Fany-install/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsbr%2Fany-install/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opsbr","download_url":"https://codeload.github.com/opsbr/any-install/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opsbr%2Fany-install/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260915890,"owners_count":23082039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","installer","shell"],"created_at":"2024-09-24T14:27:41.501Z","updated_at":"2025-06-20T09:06:29.291Z","avatar_url":"https://github.com/opsbr.png","language":"TypeScript","readme":"# Any Install\n\n**Any Install** makes easier to maintain `curl ... | sh` and `irm ... | iex` installer scripts by its own manifest DSL. There are two main use cases:\n\n- Tool authors can provide such installer scripts without writing tedious shell scripts by themselves.\n- Tool consumers can write their own installer even if any official installer isn't provided.\n\nIn either case, only thing they need to do is crafting Any Install manifest like below. Since most of the tasks to install binaries are similar, Any Install provides several utilities for the manifest builders, such as `download`, `installDirectory`. The required shell script libraries to achieve the functionality of such utilities are inlined into the final output so that the generated installer script is almost self-contained (only relying on `curl`, `tar`, etc.)\n\n## Any Install manifest\n\nThis is an example manifest for installing Node.js prebuilt binary:\n\n```yaml\nsh:\n  file: install.sh\n  install:\n    - statement: setInstallDir\n      with:\n        env: NODE_INSTALL\n        defaultValue: ${HOME}/.node\n    - statement: setOs\n    - statement: setArch\n    - statement: switchCases\n      with:\n        target: \"${os}-${arch}\"\n        cases:\n          linux-x64:\n            - statement: download\n              with:\n                url: https://nodejs.org/dist/v{{ version }}/node-v{{ version }}-linux-x64.tar.xz\n          # Add more os-arch as you want\n          default:\n            - statement: panic\n              with:\n                message: Not supported yet\n    - statement: installDirectory\n      with:\n        options:\n          stripComponents: 1\n```\n\n\u003e [!WARNING]\n\u003e TODO: We'll describe the manifest schema in our documentation soon.\n\nThis will be translated to a shell script like below by `any-install build -p version=22.7.0`:\n\n```sh\nmain() {\n\n  install_dir=\"${NODE_INSTALL:-\"${HOME}/.node\"}\"\n  anyi_info \"install_dir=${install_dir}\"\n\n  anyi_verify_install_dir \"${install_dir}\"\n\n  os=\"$(anyi_get_os)\"\n  anyi_info \"os=${os}\"\n\n  arch=\"$(anyi_get_arch)\"\n  anyi_info \"arch=${arch}\"\n\n  anyi_info \"Switching by ${os}-${arch}\"\n  case \"${os}-${arch}\" in\n    \"linux-x64\")\n      url=\"https://nodejs.org/dist/v22.7.0/node-v22.7.0-linux-x64.tar.xz\"\n      anyi_info \"url=${url}\"\n\n      asset=\"${temp_dir}/node-v22.7.0-linux-x64.tar.xz\"\n      anyi_info \"asset=${asset}\"\n\n      anyi_download \"${url}\" \"${asset}\"\n\n      extract_dir=\"${temp_dir}/extract\"\n      anyi_info \"extract_dir=${extract_dir}\"\n\n      anyi_mkdir_p \"${extract_dir}\"\n\n      anyi_extract_tar_xz \"${asset}\" \"${extract_dir}\"\n\n      unset \"asset\"\n      ;;\n    *)\n      anyi_panic \"Not supported yet\"\n      ;;\n  esac\n\n  source_dir=\"$(anyi_find_stripped_path \"${extract_dir}\" \"1\")\"\n  anyi_info \"source_dir=${source_dir}\"\n\n  anyi_install_directory \"${source_dir}\" \"${install_dir}\"\n\n}\n\n# `anyi_*` libraries are inlined here.\nanyi_info() {\n  ...\n}\n...\n\nmain\n```\n\nThen, this output is the installer script for Node.js v22.0.7. Once you upload this somewhere, people can install it by `curl ... | sh`.\n\n## Install\n\n\u003e [!NOTE]\n\u003e Only installer builders need `any-install` CLI. Users who install the tool by the installer scripts don't have to install `any-install` CLI.\n\nOf course, the installer scripts are provided by Any Install :)\n\nFor Linux and macOS:\n\n```sh\ncurl -fsSL https://github.com/opsbr/any-install/releases/latest/download/install.sh | sh\n\nexport PATH=\"${HOME}/.any-install:${PATH}\"\n\nany-install --version\n```\n\nFor Windows (x64 only):\n\n```pwsh\nirm https://github.com/opsbr/any-install/releases/latest/download/install.ps1 | iex\n\n$Env:Path = \"${HOME}/.any-install;\" + $Env:Path\n\nany-install --version\n```\n\n\u003e [!IMPORTANT]\n\u003e As you can see, managing PATH environment variable is out of the scope of Any Install.\n\u003e However, we're planning to release another software to make it easier and more powerful. Stay tuned!\n\n### Customize the install directory\n\nIf you want to install your custom location, set `ANY_INSTALL` environment variable:\n\n```sh\ncurl -fsSL https://github.com/opsbr/any-install/releases/latest/download/install.sh | ANY_INSTALL=\"/path/to/dir\" sh\n```\n\n```pwsh\n$Env:ANY_INSTALL = \"C:\\path\\to\\dir\"\nirm https://github.com/opsbr/any-install/releases/latest/download/install.ps1 | iex\n```\n\n\u003e [!NOTE]\n\u003e The parent directory must be created by yourself. (`/path/to` or `C:\\path\\to` in the example above)\n\n## Usage\n\n### `any-install init`\n\nThis command creates a initial manifest file on your current directory:\n\n```\n$ any-install init\nInitialized /workspaces/any-install/any-install.yaml\n```\n\nIt also creates `.any-install` directory to store JSON Schema and TypeScript type definition for aiding your IDE:\n\n```\n$ tree . -a\n.\n├── .any-install\n│   ├── schema.d.ts\n│   └── schema.json\n└── any-install.yaml\n```\n\n\u003e [!NOTE]\n\u003e You can add `.any-install` to `.gitignore`.\n\u003e We'll soon provide a way to update these schemas via CLI.\n\nYou can optionally specify the root directory and the format of the manifest file:\n\n```\n$ any-install init --help\nUsage: any-install init [options] [root-dir]\n\ninitialize Any Install manifest file\n\nArguments:\n  root-dir               directory to initialize (default: \"/workspaces/any-install\")\n\nOptions:\n  -f, --format \u003cformat\u003e  format of the manifest file (choices: \"yaml\", \"json\", \"js\", default: \"yaml\")\n  -h, --help             display help for command\n```\n\n### `any-install build`\n\nThis command builds the installer scripts based on your manifest file. By default, it tries to find a manifest file on your current directory:\n\n```\n$ any-install build\nLoaded /workspaces/any-install/any-install.yaml\nWritten /workspaces/any-install/install.sh\nWritten /workspaces/any-install/install.ps1\n```\n\nOptionally, you can specify the manifest file by `--manifest-file`:\n\n```\n$ any-install build -m /path/to/any-install.yaml\n```\n\nIf your manifest contains parameters e.g. `{{ tag }}`, you need to provide all the parameters via `--parameters`:\n\n```\n$ any-install build -p tag=v1.18.0\nReplacing https://github.com/opsbr/any-install/releases/download/{{ tag }}/any-install_linux-x64.tar.gz with tag=v1.18.0\nLoaded /workspaces/any-install/any-install/any-install.yaml\nWritten /workspaces/any-install/any-install/install.sh\nWritten /workspaces/any-install/any-install/install.ps1\n```\n\nIf you want to test the generated script on your local machine, `--test-sh` or `--test-ps1` will execute the script with installing to a temporary directory, then open a new shell on the directory so that you can explore the installation result. Here is the example of `gh` manifest in this repo:\n\n```\n$ any-install build -m toolset/gh/any-install.yaml --test-sh\nLoaded toolset/gh/any-install.yaml\nWritten toolset/gh/install.sh\ntemp_dir=/tmp/tmp.iIteCw6GLx\ninstall_dir=/tmp/cb8f6932326aadb35b8bec2c2f6379a2/sh\nurl=https://github.com/cli/cli/releases/download/v2.54.0/gh_2.54.0_linux_amd64.tar.gz\nasset=/tmp/tmp.iIteCw6GLx/gh_2.54.0_linux_amd64.tar.gz\nextract_dir=/tmp/tmp.iIteCw6GLx/extract\nsource_dir=/tmp/tmp.iIteCw6GLx/extract/gh_2.54.0_linux_amd64\n$ ls\nbin  LICENSE  share\n$ exit\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsbr%2Fany-install","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopsbr%2Fany-install","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopsbr%2Fany-install/lists"}