{"id":21003348,"url":"https://github.com/koding/kpm-scripts","last_synced_at":"2025-05-15T00:31:52.135Z","repository":{"id":23561145,"uuid":"26928665","full_name":"koding/kpm-scripts","owner":"koding","description":"Koding Package Manager Scripts","archived":false,"fork":false,"pushed_at":"2016-07-22T01:56:34.000Z","size":267,"stargazers_count":24,"open_issues_count":0,"forks_count":13,"subscribers_count":8,"default_branch":"develop","last_synced_at":"2024-04-13T07:08:42.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://koding.com","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koding.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}},"created_at":"2014-11-20T19:41:26.000Z","updated_at":"2019-09-25T18:16:54.000Z","dependencies_parsed_at":"2022-07-27T04:02:19.732Z","dependency_job_id":null,"html_url":"https://github.com/koding/kpm-scripts","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkpm-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkpm-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkpm-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koding%2Fkpm-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koding","download_url":"https://codeload.github.com/koding/kpm-scripts/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225318311,"owners_count":17455579,"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":[],"created_at":"2024-11-19T08:25:01.095Z","updated_at":"2024-11-19T08:25:01.775Z","avatar_url":"https://github.com/koding.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# kpm Scripts\n\nThe Koding Package Manager is a binary *(the `kpm` bin)*, and a \nseries of installation and removal scripts. The scripts install programs \nand frameworks with as minimal setup as possible, making them *entirely* \nbeginner friendly.\n\nThis document and repository are mainly for developers of the Installer \nScripts that the Koding Package Manager uses. If you're looking for a \nbeginner friendly installation and usage guide, [click here][user guide].\n\n## Installing the Bin\n\nTo install the bin, run the following command.\n\n```text\ncurl -sSL learn.koding.com/kpm.sh | sh\n```\n\nFor more detailed instructions, see the [user guide][user guide].\n\n## Installing Packages\n\nPackages can be listed and installed with the following commands.\n\n```text\nkpm list\nkpm install PACKAGENAME\n```\n\nFor more detailed instructions, see the [user guide][user guide].\n\n## Writing Scripts\n\nYou can add an Installer and Uninstaller script for just about anything.  \nSimply make a pull request against this repo and placing your script into \na new folder with the name of your script, eg `./scriptname` *(where \n`scriptname` is the name of your script)*, and name the script \n`./scriptname/installer` or `./scriptname/uninstaller`.\n\nYou can also place config files, zip files, or anything else you need in\nthat folder as well. Just make sure to keep the names `installer` and \n`uninstaller` reserved for the actual install/uninstall scripts.\n\nWith that said, your script must adhere to various standards to ensure a \nconsistent user experience between all of the scripts. Below, we outline \nthe major areas that your script must adhere to.\n\n### Language\n\nScripts can be written in any language that is pre-installed on Koding \nVMs, but a shell language (Fish, Bash, etc) is recommended.  Ensure that\nyour script has a shebang hash at the top pointing to an environment \nvariable, and `kpm` will use that as the run process for the \nscript.\n\n*NOTE:* Fish is currently required for scripts, but this requirement will \nbe removed in the near future.\n\n### Naming\n\nThe name of the script is very important, as the name of the script \ndirectly correlates to the name of the command. Every script seen in the \n`./foo/installer` format is accessible from `kpm install foo`.\n\nFor example, if you named your script `hello-world`, then it could be \ninstalled with:\n\n```text\nkpm install hello-world\n```\n\nLikewise, file extensions such as `.fish`, `.bash`, and `.sh` should not \nbe used as they would have to be part of the command as well. Such as:\n\n```text\nkpm install hello-world.fish\n```\n\nThis is unneeded, so it should not be used in the name of your script.\n\n### Minimal Configuration\n\nBecause these scripts are intended for absolute beginners, we cannot \nprompt for a full range of configuration options. Every prompt should be \nthought about carefully, and used only if required.\n\nIdeally, each script will have no more than two or three prompts.\n\n### Checking Edge Cases\n\nA series of checks should be done at the beginning of every script. Some \ncan be substituted where applicable.\n\n- Is this package already installed?\n- Is the user logged in as the proper user? *(Ie, not root)*\n- Does the user have enough storage space to install the package?\n- Does the user have requirements *(mysql, etc)* installed?\n\nIf any of your checks fail, the script should exit immediately. It's best \nto exit before any changes to the system are made, whenever possible, so \nthat a bad environment is an unchanged environment.\n\nLikewise, if any of your installation steps exit with any sort of \nfailure, it is important that the script exits with a meaningful, but \nconcise, error message.\n\nInstallations should not continue if the environment is not as expected.\n\n### Message Formatting\n\nWhere applicable, messages should be copied from existing scripts for a \nconsistent user experience.\n\n### Exit Statuses\n\nAfter each command, you should check for a non-zero exit status. After \ninforming the user that something went wrong *(in a beginner friendly \nway!)*, you should exit with the same status that the command exited \nwith. This may mean logging the error into a temporary variable, and \nlogging it.\n\nFish Shell Example:\n\n```fish\nsudo apt-get install foo\nor begin\n  set -l err $status\n  echo \"Error: Failed to install foo\"\n  exit $err\nend\n```\n\nIn this Fish Shell example, we run the command like normal. After the \ncommand runs, `or` is triggered if the `$status` is not-zero. `begin` \nstarts a codeblock.\n\nIn the `begin` codeblock, we store the `$status` into the `err` variable, \nbecause `echo` will set `$status` back to zero. We then `exit $err`.\n\n### Debug Messages\n\nIn kpm, `STDERR` is considered a debug stream. Print errors, or any debug \ninformation desired. By default, kpm does not display this debug \ninformation to the user.\n\nIf a command fails, as in the exit status example above, we should log a \nbeginner-friendly message to the user to inform them of the error. Don't \nbother including detailed information here, save that for the debug \nprint. You can print to STDERR *(debug)*, as seen below:\n\n```fish\necho \"This is a debug message\" \u003e\u00262\n```\n\nThe `\u003e\u00262` syntax forwards the output of `echo` to STDERR. Kpm will then \nrecord this information depending on user configuration.\n\n\n\n[user guide]: http://learn.koding.com/guides/getting-started-kpm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoding%2Fkpm-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoding%2Fkpm-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoding%2Fkpm-scripts/lists"}