Giter VIP home page Giter VIP logo

webi-installers's People

Contributors

aaronkchsu avatar adithyasunil26 avatar ajeetdsouza avatar alexravenna avatar anuragsati avatar brij-desaii avatar burntsushi avatar chetak123 avatar cjh-cloud avatar coolaj86 avatar creedasaurus avatar dbbrowne avatar devpalacio avatar hacdan avatar its-danny avatar jkunkee avatar jojobyte avatar libchan avatar liudonghua123 avatar lockszmith-gh avatar polo123qwe avatar rishavnandi avatar rubenram avatar ryanburnette avatar shyammahajan avatar tanvesht avatar thegreatestgiant avatar wmerfalen avatar y0rune avatar yollotltamayo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webi-installers's Issues

[feature] _common/brew.js: Brew Releases API

Wanted: _common/brew.js

The goal IS NOT to implement dependency management like Brew.

webinstall.dev is intended to be lightweight and simple.

However, brew does have an API for packages and there are some packages that officially release to brew, such as MariaDB.

correct Prettier cheat sheet about `--ignore`

As seen on https://webinstall.dev/prettier/ the Prettier cheat sheet, the --ignore option is incorrect.

  • --ignore is not the correct argument to pass names of directories to ignore
  • need to lookup in prettier docs the correct flag name (if any), or remove

Also, the format of .prettierignore is incorrect.

  • paths should not begin with ./, they should be left bare
  • ./dist should be dist/

Needs to be edited here: https://github.com/webinstall/packages/blob/master/prettier/README.md

fix `spctl` (Gate Keeper) permissions grant for High Sierra and below

High Sierra doesn't require spctl permission grants for Gate Keeper, yet spctl still reports everything as rejected.

Might need to check for 10.13 in some sort of system string.

Update

Should probabyl use

xattr -r -d com.apple.quarantine /path/to/MyApp.app

However, there's a tricky bit here in determining if it's Linux xattr or not, which does not support -r.

[linux/amd64] SOLVED pathman: Exec format error

Problem

On linux the x86 build of pathman is being downloaded in place of the amd64 build.

You'll get this message:

pathman-bootstrap.sh: line 214:
/home/me/.local/bin/pathman: cannot execute binary file: Exec format error

Workaround

Remove the incorrect build of pathman:

rm -rf ~/.local/*bin*/pathman

Re-install webi + (for example) node:

curl -fsS https://webinstall.dev/node | bash

Production Fix

This has been hotfixed in production as c6ff689 and will be merged into master after review.

cc/ @ryanburnette

problem with Ripgrep (alias) installer

$ curl https://webinstall.dev/ripgrep | bash

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3573  100  3573    0     0   8390      0 --:--:-- --:--:-- --:--:--  8407
Found ripgrep v12.0.1
'ripgrep' (project) is an alias for 'rg' (command)
Found rg v12.0.1
WARN: possible conflict with ripgrep v12.0.1 at /usr/local/bin/rg
Downloading ripgrep v12.0.1 from https://github.com/BurntSushi/ripgrep/releases/download/12.0.1/ripgrep-12.0.1-x86_64-apple-darwin.tar.gz
Installing ripgrep v12.0.1 as /Users/ryan/.local/bin/rg
mv: rename ./ripgrep-12.0.1-x86_64-apple-darwin/rg to /Users/ryan/.local/bin/: No such file or directory

[feature] Github release API

Goal

Translate the Github release data into a format that is pretty darn close to what we need for webinstall.dev, accepting that it may need to be wrapped in some cases so that manual manipulation can be applied afterwards.

(using false, "", etc for fields that don't apply).

API

https://api.github.com/repos/:user/:repo/releases

Example:

From

{
  "url": "https://api.github.com/repos/BurntSushi/ripgrep/releases/assets/19122945",
  "id": 19122945,
  "node_id": "MDEyOlJlbGVhc2VBc3NldDE5MTIyOTQ1",
  "name": "ripgrep-12.0.1-arm-unknown-linux-gnueabihf.tar.gz",
  "label": "",
  "uploader": {
    "login": "github-actions[bot]",
    "id": 41898282,
    "node_id": "MDM6Qm90NDE4OTgyODI=",
    "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-actions%5Bbot%5D",
    "html_url": "https://github.com/apps/github-actions",
    "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
    "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
    "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
    "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
    "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
    "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
    "type": "Bot",
    "site_admin": false
  },
  "content_type": "application/octet-stream",
  "state": "uploaded",
  "size": 1853213,
  "download_count": 182,
  "created_at": "2020-03-29T23:07:18Z",
  "updated_at": "2020-03-29T23:07:19Z",
  "browser_download_url": "https://github.com/BurntSushi/ripgrep/releases/download/12.0.1/ripgrep-12.0.1-arm-unknown-linux-gnueabihf.tar.gz"
}

To

  {
    version: 'v1.0.0',
    date: '2020-04-01',
    lts: true, // false,
    channel: 'stable', // 'beta', 'unstable'... ?
    os: 'macos', // linux, windows
    arch: 'amd64',
    ext: 'tar.gz',
    //sha1: '', // ?
    download: 'https://.../<package>.tar.gz'
  }

Starter

'use strict';

// this may need customizations between packages
var map = {
  // OSes
  'macos': /\b(mac|darwin|iPhone|iOS|iPad)/i,
  linux: /\b(linux)/i,
  win: /\b(win|microsoft|msft)/i,
  sunos: /\b(sun)/i,
  aix: /\b(aix)/i,
  // CPU architectures
  x64: /\b(amd64|x64|_64|-64)/i,
  x86: /\b(x86)/i,
  ppc64le: /\b(ppc64le)/i,
  ppc64: /\b(ppc64)\b/i,
  arm64: /\b(arm64)/i,
  armv7l: /\b(armv?7l?/i,
  armv6l: /\b(armv?6l?/i,
  s390x: /\b(s390x)/i,
  // file extensions
  pkg: /\.pkg$/i,
  exe: /\.exe$/i,
  msi: /\.msi$/i,
  '7z': /\.7;$/i,
  zip: /\.zip$/i,
  tar: /\.tar\./i
};

function getAllReleases(request, owner, repo) {
  return request({
    url: 'https://api.github.com/repos/' + owner + '/' + repo + '/releases',
    json: true
  }).then(function (resp) {
    var rels = resp.body;

    // transform here

    return all;
  });
}
module.exports = getAllReleases;

if (module === require.main) {
  getAllReleases(require('@root/request')).then(function (all) {
    console.log(JSON.stringify(all));
    //console.log(JSON.stringify(all, null, 2));
  });
}

[sticky] How to add a Windows installer

We do need to update the bootstrap bat file to include the relevant variables and pass them in, but in the meantime it would still be useful to have some templates that successfully unpack various software from windows zip files and put the right things in the right places.

This is the node example:

https://github.com/webinstall/packages/blob/master/node/node.bat:

@echo off
setlocal
pushd "%userprofile%" || goto :error
  pushd "%userprofile%\.local\opt" || goto :error
    powershell $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://nodejs.org/dist/v12.16.2/node-v12.16.2-win-x64.zip -OutFile node-v12.16.2-win-x64.zip || goto :error
    rem BSD-tar handles ZIP in Windows 10. Imagine that.
    tar xf node-v12.16.2-win-x64.zip || goto :error
    rename node-v12.16.2-win-x64 node-v12.16.2 || goto :error
    del node-v12.16.2-win-x64.zip || goto :error
  popd || goto :error

  rem make npm not act stupid about which node to use... ugh (this should be the default)
  .\.local\opt\node-v12.16.2\npm.cmd" --scripts-prepend-node-path=true config set scripts-prepend-node-path true || goto :error
  pathman add .local\opt\node-v12.16.2 || goto :error
popd || goto :error

goto :EOF

:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%

Add gitea

Since gitea uses Github releases (and will use the nearly identical Gitea releases in the future), this is just a copy/paste/test job.

add `lsd`

We want to add this as a cross-platform drop-in replacement for ls - because icons and highlighting are awesome

This may be tricky as it requires a nerd-font to be installed.
( we now have nerdfont https://webinstall.dev/nerdfont )

This could be as simple as copying jq or rg and changing a few things:

rsync -av jq/ lsd/
  1. Official Releases are at https://github.com/Peltoche/lsd/releases
    • update lsd/release.js to use this repo
  2. How does lsd unpack (i.e. as a single file? as a .tar.gz? as a .tar.gz with a folder named lsd?)
    • update lsd/install.sh following the example of either jq or rg
    • update lsd/install.ps1 following the example of either jq or rg
  3. Needs an updated tagline and cheat sheet
    • update lsd/README.md
      • official URL
      • tagline
      • Switch versions
      • description / summary
      • How to alias and escape the alias (see bat)
      • General pointers on usage (drop in replacement for ls)

Skills required

  • Basic Command Line knowledge (mkdir, ls, tar, unzip)

It's also okay to have multiple people work on part of this (i.e. the Cheat Sheet can be done independently from the install.sh)

deno for Windows 10

This should pretty much be copy/paste to get working, just needs 30-60 minutes to test and deploy.

root path

Maybe this should be documented. Maybe it could be improved. Forgive my bad memory and poor search technique, this may be a duplicate.

I'm often in Linux as user ryan, and need to do things as root through sudo. Here is an example.

sudo $(which serviceman) add $(which caddy) run

I make it work using $().

If this is a good thing, perhaps it should be documented.

If there's a better way, enlighten me.

install fish locally to $HOME via .pkg?

I want to have fish without all of the hundreds of megabytes of brew.

It may be installable locally (Mac only):

installer -pkg "$HOME/Downloads/fish-3.1.2.pkg" -target CurrentUserHomeDirectory

add `pandoc` (for markdown to html conversion)

I've investigated goldmark, comrak, and pandoc. I like goldmark the best since it's written and go and is used by hugo, which we already have.

However, it looks like pandoc is the only one with a release API at the moment:

Mac file structure looks like this when unzipped:

pandoc-2.10.1
  bin
    pandoc
    pandoc-citeproc
  share

Should be easy to add following rg as a template.

problem with rg installer

โฏ webi rg
Downloading rg to /Users/ryan/Downloads/ripgrep-12.1.1-x86_64-apple-darwin.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   652  100   652    0     0   3243      0 --:--:-- --:--:-- --:--:--  3243
100 1842k  100 1842k    0     0  3379k      0 --:--:-- --:--:-- --:--:-- 3379k
Extracting /Users/ryan/Downloads/ripgrep-12.1.1-x86_64-apple-darwin.tar.gz
Installing to /Users/ryan/.local/xbin/rg-12.1.1
rm: /Users/ryan/.local/bin/rg: No such file or directory

Make it possible to test bash script in-repo

Now that the bash template has moved to webi/template.bash we should we able to make a webi/test.js or some such that makes it easy to test locally without running the server.

I'm thinking like this:

node webi/template.js ./my-new-project/
bash my-new-project-test.bash

Sidenote: might also want to change the structure to my-new-project/install.bash rather than my-new-project/my-new-project.bash. And make an _example or _template for people to copy from.

Update node/install.bat to split commas into variables

Three things to do:

  1. Fetch a single line of CSV with this exact URL:

https://webinstall.dev/api/releases/[email protected]?os=win&arch=amd64&channel=stable&ext=zip&limit=1

Which looks like this:

12.16.3,lts,stable,2020-04-28,windows,amd64,zip,-,https://nodejs.org/dist/v12.16.3/node-v12.16.3-windows-x64.zip

2 . Split that string into variables

  • version
  • pkg_url
  • pkg_file
  • pkg_dir
  • os
  • arch
  1. Update this batch script to use those variables

I also need to know the variable for the OS and ARCH.

I think %PROCESSOR_ARCHITECTURE% is the best / most reliable for ARCH (i.e. AMD64)?

Notes

You can use PowerShell commands from Batch, but I think it has to be batch and be able to run in cmd.exe because by default windows won't allow you to run PS1 scripts.

error when zip not present

I was installing webi on WSL/Ubuntu in Windows. I got this error.

ryan@RYAN-WIN10:~$ webi pathman
Error: no 'pathman' release for 'windows' on 'amd64' as one of 'tar,exe,xz,git,dmg' by the tag ''
       'pathman' is available for 'linux,macos,windows' on 'amd64' as one of 'zip'
       (check that the package name and version are correct)

       Double check at https://webinstall.dev/api/releases/[email protected]

I installed zip.

sudo apt install zip

Then it installed. But it wasn't that clear about what was going wrong.

problem with Hugo installer

Installed hugo on my 64-bit darwin os, but got 32-bit binary.

โฏ webi hugo
Found /Users/ryanburnette/Downloads/hugo_0.64.1_macOS-32bit.tar.gz
Extracting /Users/ryanburnette/Downloads/hugo_0.64.1_macOS-32bit.tar.gz
Installing to /Users/ryanburnette/.local/xbin/hugo-v0.64.1
Checking permission to execute 'hugo' on macOS 11+
Installed 'hugo' v0.64.1 as /Users/ryan/.local/bin/hugo

I also expected 0.73, but got 0.64.

Maybe install path should be in output, and how about a path warning?

I had occasion to install caddy on a server where I had already installed it previously. When I installed again with webi, it did everything it was supposed to, but the old caddy was the one I stll got as shown by which caddy.

The installer output looked something like this

...
caddy may conflict with /root/bin/caddy
caddy install

Maybe the install message could be something like

caddy installed to ~/.local/bin/caddy
WARNING: ~/.local/bin/caddy may not be in $PATH

Just brain storming here.

webi should self update before running

before doing anything, webi should check itself before it wrecks itself... meaning, it should check to make sure it's up-to-date, update itself if necessary, and call itself again if an update occurred

Add postgres

I'm not really sure how to get the releases. I can't find a canonical source that lists versions that aren't the absolute latest.

I guess just scrape the html and pray that linux support returns soon? (nevermind, it won't.) Maybe cache old versions and check to see when they're removed?

Here's the script I use currently:

#!/bin/bash
echo "=== INSTALLING POSTGRES ==="
sleep 1

set -e
set -u

# Notes on convention:
# variables expected to be imported or exported are ALL_CAPS and prefixed with POSTGRES_
# variables expected to remain private are lowercase and prefixed as to not be affected by `source`

# source .env
DOWNLOADS_DIR=${DOWNLOADS_DIR:-"$HOME/Downloads"}
OPT_DIR=${OPT_DIR:-"$HOME/Applications"}
DATA_DIR=${DATA_DIR:-"$HOME/.local/share"}
POSTGRES_DATA_DIR=${POSTGRES_DATA_DIR:-"$DATA_DIR/postgres/var"}
mkdir -p "$DOWNLOADS_DIR"
mkdir -p "$OPT_DIR"
mkdir -p "$POSTGRES_DATA_DIR"

is_macos="$(uname -a | grep -i darwin)"
if [ -n "$is_macos" ]; then
  TRASH_DIR=${TRASH_DIR:-"$HOME/.Trash"}
  POSTGRES_VERSION=${POSTGRES_VERSION:-"10.13"} # 10.13-1
  POSTGRES_BUILD=${POSTGRES_BUILD:-"1-osx"}
  postgres_pkg="postgresql-${POSTGRES_VERSION}-${POSTGRES_BUILD}-binaries.zip"
  is_zip="true"
else
  TRASH_DIR=${TRASH_DIR:-"$HOME/tmp"}
  POSTGRES_VERSION=${POSTGRES_VERSION:-"10.12"} # 10.12-1
  POSTGRES_BUILD=${POSTGRES_BUILD:-"1-linux-x64"}
  postgres_pkg="postgresql-${POSTGRES_VERSION}-${POSTGRES_BUILD}-binaries.tar.gz"
  is_zip=""
fi

mkdir -p "$TRASH_DIR"

# https://www.enterprisedb.com/download-postgresql-binaries

postgres_tmp="$(mktemp -d -t postgres-installer.XXXXXXXX)"
postgres_unpack="pgsql"
postgres_dir="postgres-server-${POSTGRES_VERSION}"
postgres_lnk="postgres-server"

echo "Here's what this script will do:"
echo "    โ€ข Download postgres server v${POSTGRES_VERSION}"
echo "    โ€ข Install it to ${OPT_DIR}/${postgres_dir}"
echo "    โ€ข Link that to ${OPT_DIR}/${postgres_lnk}"
echo "    โ€ข Create a database in $POSTGRES_DATA_DIR (first-time only)"
echo "    โ€ข Start Postgres with $OPT_DIR/${postgres_lnk}/bin/pg_ctl"

echo ""
echo "Working directory is ${postgres_tmp}"
echo ""
if [ -f "${DOWNLOADS_DIR}/${postgres_pkg}" ]; then
  rsync -aq "${DOWNLOADS_DIR}/${postgres_pkg}" "$postgres_tmp/$postgres_pkg"
else
  echo "Downloading $postgres_pkg"
  curl -fSL --progress-bar 'https://get.enterprisedb.com/postgresql/'"${postgres_pkg}"'?ls=Crossover&type=Crossover' -o "$postgres_tmp/$postgres_pkg"
  rsync -aq "$postgres_tmp/$postgres_pkg" "${DOWNLOADS_DIR}/"
fi
pushd "$postgres_tmp" >/dev/null
  if [ -n "$is_zip" ]; then
    unzip -q "$postgres_pkg"
  else
    tar xvf "$postgres_pkg"
  fi
  mv "$postgres_unpack" "$postgres_dir"
popd >/dev/null
if [ -d "$OPT_DIR/$postgres_dir" ]; then
  mv "$OPT_DIR/$postgres_dir" "$TRASH_DIR/$postgres_dir".$(date '+%Y-%m-%d_%H-%M-%S' )
  echo "moved old $OPT_DIR/$postgres_dir to the Trash folder"
fi
mv "$postgres_tmp/$postgres_dir" "$OPT_DIR/"
rm -f "$OPT_DIR/$postgres_lnk"
ln -s "$OPT_DIR/$postgres_dir" "$OPT_DIR/$postgres_lnk"

mkdir -p "$POSTGRES_DATA_DIR"
chmod 0700 "$POSTGRES_DATA_DIR"
if [ ! -f "$POSTGRES_DATA_DIR/postgresql.conf" ]; then
  echo "postgres" > "${postgres_tmp}/pwfile"
  "$OPT_DIR/$postgres_lnk/bin/initdb" \
    -D "$POSTGRES_DATA_DIR/" \
    --username postgres --pwfile "${postgres_tmp}/pwfile" \
    --auth-local=password --auth-host=password
fi

echo "PostgreSQL installed, database initialized in $POSTGRES_DATA_DIR/"

rm -rf "${postgres_tmp}"

How to add a package to webinstall.dev in 5 minutes or less.

Why is package xxxx Awesome?

Obviously you think that the thing you're proposing that we add is awesome.

Be sure to let us know! Don't bury the lead.

Please include or link to a screenshot, asciinema, or 5-10 second screencast, if at all possible.

Is xxxx a good fit for Webi?

brew and apt are for complex things.

webi is for simple things.

The more of these boxes you can check, the more likely it is that we'd love to have it:

  • Has official builds on an official releases API - Github (most things) or custom (Node, Go, Flutter, etc)
  • Self-contained (can install to ~/.local/opt/<pkg>), No dependencies
  • Modern drop-in replacements for unix coreutils, and programming platforms
  • Minimizes frustration for code bootcamp students, and clients
  • Uses semver versioning
  • Verifiable / Contactable authors, good security policy

There are exceptions, of course. We also host a few standalone utility scripts (myip, ssh-pubkey) and shortcuts for other installers (brew, rust).

In the case where there are multiple similar tools, we prefer to just add the one that checks the most boxes.

What is the release API?

If it's hosted on Github, all you have to do is copy rg/release.js and change the github owner and package name to the one you want to submit.

How does it unpack?

webi, by default, will handle almost all of the plumbing for your package.

  • download
  • create tmp dir
  • untar, unzip, unxz, copy (exe, bin)
  • Should SINGLE=true be set?
  • Which file(s) or folder(s) should be moved?
  • make executable
  • link (or copy) to destination directory
  • update PATH to include bin directory

SINGLE=true

SINGLE=true simply defines that the binary will end up in ~/.local/bin/ rather than ~/.local/opt/<pkg>/bin/ and causes a few changes to be made accordingly.

When the bash functions that you provide run, the current working directory will be a temporary directory into which the package has been unpacked.

Using ripgrep as an example, this what is done just before your pkg_install function is called:
Here's an example of what we need to know, using ripgrep as an example:

pushd /tmp

# What's the release API?
wget https://github.com/BurntSushi/ripgrep/releases/download/12.1.1/ripgrep-12.1.1-x86_64-apple-darwin.tar.gz

# What's the directory structure when it unpacks?
mkdir ripgrep
pushd ripgrep
tar xvf ../ripgrep-12.1.1-x86_64-apple-darwin.tar.gz
find .
.
./ripgrep-12.1.1-x86_64-apple-darwin
./ripgrep-12.1.1-x86_64-apple-darwin/complete
./ripgrep-12.1.1-x86_64-apple-darwin/complete/_rg
./ripgrep-12.1.1-x86_64-apple-darwin/complete/_rg.ps1
./ripgrep-12.1.1-x86_64-apple-darwin/complete/rg.bash
./ripgrep-12.1.1-x86_64-apple-darwin/complete/rg.fish
./ripgrep-12.1.1-x86_64-apple-darwin/COPYING
./ripgrep-12.1.1-x86_64-apple-darwin/doc
./ripgrep-12.1.1-x86_64-apple-darwin/doc/CHANGELOG.md
./ripgrep-12.1.1-x86_64-apple-darwin/doc/FAQ.md
./ripgrep-12.1.1-x86_64-apple-darwin/doc/GUIDE.md
./ripgrep-12.1.1-x86_64-apple-darwin/doc/rg.1
./ripgrep-12.1.1-x86_64-apple-darwin/LICENSE-MIT
./ripgrep-12.1.1-x86_64-apple-darwin/README.md
./ripgrep-12.1.1-x86_64-apple-darwin/rg
./ripgrep-12.1.1-x86_64-apple-darwin/UNLICENSE

Your pkg_install basically just needs to identify the main file or directory that needs to be moved. In this case that would be ./ripgrep-12.1.1-x86_64-apple-darwin/rg.


This means that the install function is going to need to look something like this:

```bash
pkg_install() {
    mv ./ripgrep*/rg "$pkg_src"
}

Where "$pkg_src" is a variable that's set up by webi.

How do you get its version?

We also need to know how to get just the version string from rg, which turns out to look like this:

rg --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2

Copy and Paste

With that information (above), you can copy and paste from the _example package, change the parts that need changing, and you're done.

In many cases, nothing needs to change other than the name.

Create a Cheat Sheet

Copy and paste jq/README.md, update the metadata (official URL, tagline, etc) and add a cheat sheet for how to do a few common things.

Notes to self

  • _example needs update
  • variable documentation needs cleanup, with examples

I want to make a video for how to submit a PR to add a project to webi.

  1. releases.js - should point to github project, or use custom API
  2. README.md - update metadata (yaml-ish format)
  3. pkg_get_current_version
  4. pkg_src, pkg_dst (if single vs dir)
  5. pkg_cmd_name (if golang vs go)

WSL presents an interesting situation

WSL presents an interesting situation

I tried installing Node, but I get node.exe

ryan@RYAN-WIN10:~$ webi node@lts
Downloading node to /home/ryan/Downloads/node-v12.18.2-win-x64.zip
/home/ryan/Downloads/node-v12 100%[=================================================>]  17.87M  45.3MB/s    in 0.4s
Extracting /home/ryan/Downloads/node-v12.18.2-win-x64.zip
Installing to /home/ryan/.local/opt/node-v12.18.2/bin/node
mv: cannot move './node-v12.18.2-win-x64' to '/home/ryan/.local/opt/node-v12.18.2/node-v12.18.2-win-x64': Directory not empty
[email protected]: line 311: /home/ryan/.local/opt/node-v12.18.2/bin/node: No such file or directory

And node.exe is no good in this environment.

update Windows pathman to enable console output

Pathman's release.js needs to be updated to select pathman.debug.exe for windows, maybe, so that pathman will output text in Terminal.

Or in some way shape or form we need to choose between GUI-enabled and Terminal-enabled pathman.

Also, not sure what the difference between these two might be or which should be added:

  • .local\bin
  • %USERPROFILE%\.local\bin

Also, using quotes seem to mess up the pathnames.

Also, pathman sometimes seems to cause hangs (potentially after modifying the registry?) but then continues when 'enter' is pressed.

cc/ @jkunkee Thoughts?

Show the download source when downloading.

Currently we show were a download will be downloaded:

Downloading node to /Users/aj/Downloads/node-v14.7.0-darwin-x64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30.2M  100 30.2M    0     0   879k      0  0:00:35  0:00:35 --:--:--  987k

To increase transparency and trust, it may be good to show where the download is coming from:

Downloading https://nodejs.org/dist/v12.18.3/node-v12.18.3-darwin-x64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30.2M  100 30.2M    0     0   879k      0  0:00:35  0:00:35 --:--:--  987k

Saved node to /Users/aj/Downloads/node-v12.18.3-darwin-x64.tar.gz

Two things that need to be solved for here:

  • How can we show (potentially long) URLs in a friendly way?
  • Update the webi_download function _webi/template.sh with the new wording

Skills required

  • Visual / Verbal Communication
  • Basic Command Line knowledge (mkdir, ls, tar, unzip)

It's fine for the display to be brainstormed by one person and the implementation to be done by another. However, this is probably basic enough for anyone with minimal bash experience to make the change.

Wanted: DuckDNS Updater

DuckDNS Updater

Would be nice to have a little bash / pwsh script for updating domains

https://www.duckdns.org/spec.jsp

https://www.duckdns.org/update?domains={YOURVALUE}&token={YOURVALUE}[&ip={YOURVALUE}][&ipv6={YOURVALUE}][&verbose=true][&clear=true]

Perhaps could ask questions and store secrets in ~/.config/duckdns.org/config?

Would be great to store secrets in the native secret manager of the OS, but not sure how to do that yet.

Add curlie, bat, fd, and friends

Curlie wraps curl to behave similar to HTTPie (syntax highlighting and such), but in Go rather than Python, and hence easier to install. Again, github releases, should just be copy/paste/test.

bat is cat with wings - a code aware pager

fd finds better

hexyl is a hex viewer with type highlighting

Request for hugo

me: I want a hugo installer
aj: you can make it yourself
me: i'll try

Add comrak for Markdown

I used ./bat as a template and made a few changes to accommodate ./comrak.

I'd like to give the author a chance to make any comments, or PR if desired, after that this should be good to go live in production.

Live Beta

In development at https://beta.webinstall.dev/comrak

This is the current cheatsheet, install files, and releases API for installing ad using comrak:

comrak/README.md:

---
title: Comrak
homepage: https://github.com/kivikakk/comrak
tagline: |
  Comrak is a Rust port of github's cmark-gfm.
---

### Updating `comrak`

```bash
webi comrak@stable
```

Use the `@beta` tag for pre-releases.

## Cheat Sheet

> Comrak supports the five extensions to CommonMark defined in the GitHub
> Flavored Markdown Spec: Tables, Task list items, Strikethrough, Autolinks, &
> Disallowed Raw HTML

<!-- TODO ask about ~/.comrakrc -->

### Convert _trusted_ Markdown files to HTML

```bash
comrak --unsafe --gfm --github-pre-lang --header-ids '' README.md
```

comrak/install.sh:

#!/bin/bash

{
    set -e
    set -u

    ##################
    # Install comrak #
    ##################

    WEBI_SINGLE=true

    pkg_get_current_version() {
      # 'comrak --version' has output in this format:
      #       comrak 0.8.1
      # This trims it down to just the version number:
      #       0.8.1
      echo $(comrak --version 2>/dev/null | head -n 1 | cut -d' ' -f 2)
    }

    pkg_install() {
        # ~/.local/bin
        mkdir -p "$pkg_src_bin"

        # mv ./comrak* ~/.local/opt/comrak-v0.8.1/bin/comrak
        mv ./comrak* "$pkg_src_cmd"

        # chmod a+x ~/.local/opt/comrak-v0.8.1/bin/comrak
        chmod a+x "$pkg_src_cmd"
    }
}

comrak/install.ps1:

#!/usr/bin/env pwsh

$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe"
$EXENAME = "$Env:PKG_NAME.exe"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"))
{
    # TODO: arch detection
    echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
    & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part"
    & move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE"
}

IF (!(Test-Path -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin\$VERNAME"))
{
    echo "Installing $Env:PKG_NAME"
    # TODO: temp directory

    # Enter tmp
    pushd .local\tmp

        # Remove any leftover tmp cruft
        Remove-Item -Path "$Env:PKG_NAME-v*" -Recurse -ErrorAction Ignore

        # Move single binary into root of temporary folder
        & move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" "$VERNAME"
        & dir

        # Settle unpacked archive into place
        echo "New Name: $VERNAME"
        echo "New Location: $Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin\$VERNAME"
        New-Item "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin" -ItemType Directory
        Move-Item -Path "$VERNAME" -Destination "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin"

    # Exit tmp
    popd
}

echo "Copying into '$Env:USERPROFILE\.local\bin\$EXENAME' from '$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin\$VERNAME'"
Remove-Item -Path "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse -ErrorAction Ignore
Copy-Item -Path "$Env:USERPROFILE\.local\opt\$Env:PKG_NAME-v$Env:WEBI_VERSION\bin\$VERNAME" -Destination "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse

comrak/release.js:

'use strict';

var github = require('../_common/github.js');
var owner = 'kivikakk';
var repo = 'comrak';

module.exports = function (request) {
  return github(request, owner, repo).then(function (all) {
    return all;
  });
};

if (module === require.main) {
  module.exports(require('@root/request')).then(function (all) {
    all = require('../_webi/normalize.js')(all);
    all.releases = all.releases.slice(0, 10);
    //console.info(JSON.stringify(all));
    console.info(JSON.stringify(all, null, 2));
  });
}

Add `sd`

Add sd

We want to add sd because it works consistently across Windows, Mac, and Linux.

(sed is not as easy to get on Windows, and works differently between GNU and BSD builds).

This could be as simple as copying _example (or bat or rg) and changing a few things.

How to create a webi installer

Video Tutorial: How to create a webi Installer

Skills required

  • Basic Command Line knowledge (mkdir, mv, ls, tar, unzip, variables)

Steps

  1. Clone and setup the webi packages repo
    git clone [email protected]:webinstall/packages.git
    pushd packages/
    npm install
  2. Copy the example template and update with info from Official Releases: https://github.com/chmln/sd/releases
    rsync -av _example/ sd/
    • update sd/release.js to use the official repo
    • Learn how sd unpacks (i.e. as a single file? as a .tar.gz? as a .tar.gz with a folder named sd?)
    • find and replace to change the name
      • update sd/install.sh (see bat and jq as examples)
      • update sd/install.ps1 (see bat and jq as examples)
  3. Needs an updated tagline and cheat sheet
    • update sd/README.md
      • official URL
      • tagline
      • Switch versions
      • description / summary
      • General pointers on usage (and differences from sed)

It's also okay to have multiple people work on part of this (i.e. the Cheat Sheet can be done independently from the install.sh)

[BUG] deno didn't update to v1.3.0 (due to prior download)

The deno download name doesn't include the version and therefore the cached version is used.

Found /Users/aj/Downloads/deno-x86_64-apple-darwin.zip # <====  problem
Extracting /Users/aj/Downloads/deno-x86_64-apple-darwin.zip
Installing to /Users/aj/.local/opt/deno-v1.3.0/bin/deno # <====  wrong version!
Checking permission to execute 'deno' on macOS 11+
Installed 'deno' v1.3.0 as /Users/aj/.local/bin/deno

Workaround

  1. Delete the incorrect copy, and the cached download
rm -rf ~/Downloads/deno-* ~/.local/opt/deno-v1.3.0
  1. Reinstall
curl -fsS https://webinstall.dev/[email protected] | bash

add `watchexec`

a great cross-platform language-agnostic file watcher / task runner

xvm - replace nvm, gvm, etc

Phase 1

Re-installing a previously installed version should just switch symlinks.

webi node@v12 # install
webi node@v14 # install 
webi node@v12 # swap symlinks

Phase 2

xvm node@v12

Make a bash script xvm that tries to switch to an installed version matching node and v12.x, and falls back to webi node@v12 otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.