Compare commits

..

2 Commits

Author SHA1 Message Date
AJ ONeal
557ef7fde5 WIP: docs(dashd): add stuff 2023-06-16 07:32:48 +00:00
AJ ONeal
c141ceb6fe feat: add dashcore (dash-cli, dashd, dash-qt) 2023-06-16 07:32:47 +00:00
74 changed files with 469 additions and 2101 deletions

View File

@@ -92,13 +92,8 @@ __webi_main() {
export WEBI_WGET="\$(command -v wget)" export WEBI_WGET="\$(command -v wget)"
set -e set -e
my_libc=''
if ldd /bin/ls 2> /dev/null | grep -q 'musl' 2> /dev/null; then
my_libc=' musl-native'
fi
export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}" export WEBI_HOST="\${WEBI_HOST:-https://webinstall.dev}"
export WEBI_UA="\$(uname -s)/\$(uname -r) \$(uname -m)/unknown\${my_libc}" export WEBI_UA="\$(uname -s)/\$(uname -r) \$(uname -m)/unknown"
webinstall() { webinstall() {

View File

@@ -85,11 +85,9 @@ function normalize(all) {
} }
// Hacky-doo for musl // Hacky-doo for musl
// TODO some sort of glibc vs musl tag? // TODO some sort of glibc vs musl tag?
if (!rel._musl_native) { if (!rel._musl) {
if (!rel._musl) { if (/(\b|\.|_|-)(musl)(\b|\.|_|-)/.test(rel.download)) {
if (/(\b|\.|_|-)(musl)(\b|\.|_|-)/.test(rel.download)) { rel._musl = true;
rel._musl = true;
}
} }
} }
supported.oses[rel.os] = true; supported.oses[rel.os] = true;

View File

@@ -47,14 +47,12 @@ async function serveInstaller(baseurl, ua, pkg, tag, ext, formats) {
// TODO maybe move package/version/lts/channel detection into getReleases // TODO maybe move package/version/lts/channel detection into getReleases
var myOs = uaDetect.os(ua); var myOs = uaDetect.os(ua);
var myArch = uaDetect.arch(ua); var myArch = uaDetect.arch(ua);
var myLibc = uaDetect.libc(ua);
let cfg = await packages.get(pkg); let cfg = await packages.get(pkg);
let rels = await getReleases({ let rels = await getReleases({
pkg: cfg.alias || pkg, pkg: cfg.alias || pkg,
ver, ver,
os: myOs, os: myOs,
arch: myArch, arch: myArch,
libc: myLibc,
lts, lts,
channel, channel,
formats, formats,

View File

@@ -6,11 +6,6 @@ __bootstrap_webi() {
set -u set -u
#set -x #set -x
my_libc=''
if ldd /bin/ls 2> /dev/null | grep -q 'musl' 2> /dev/null; then
my_libc=' musl-native'
fi
#WEBI_PKG= #WEBI_PKG=
#PKG_NAME= #PKG_NAME=
# TODO should this be BASEURL instead? # TODO should this be BASEURL instead?
@@ -35,7 +30,7 @@ __bootstrap_webi() {
#PKG_OSES= #PKG_OSES=
#PKG_ARCHES= #PKG_ARCHES=
#PKG_FORMATS= #PKG_FORMATS=
WEBI_UA="$(uname -s)/$(uname -r) $(uname -m)/unknown${my_libc}" WEBI_UA="$(uname -s)/$(uname -r) $(uname -m)/unknown"
WEBI_PKG_DOWNLOAD="" WEBI_PKG_DOWNLOAD=""
WEBI_DOWNLOAD_DIR="${HOME}/Downloads" WEBI_DOWNLOAD_DIR="${HOME}/Downloads"
if command -v xdg-user-dir > /dev/null; then if command -v xdg-user-dir > /dev/null; then
@@ -165,7 +160,7 @@ __bootstrap_webi() {
webi_download() { webi_download() {
# determine the url to download # determine the url to download
if [ -n "${1-}" ]; then if [ -n "${1-}" ]; then
my_url="${1}" my_url="$1"
else else
if [ "error" = "$WEBI_CHANNEL" ]; then if [ "error" = "$WEBI_CHANNEL" ]; then
# TODO pass back requested OS / Arch / Version # TODO pass back requested OS / Arch / Version
@@ -173,11 +168,7 @@ __bootstrap_webi() {
echo >&2 " '$PKG_NAME' is available for '$PKG_OSES' on '$PKG_ARCHES' as one of '$PKG_FORMATS'" echo >&2 " '$PKG_NAME' is available for '$PKG_OSES' on '$PKG_ARCHES' as one of '$PKG_FORMATS'"
echo >&2 " (check that the package name and version are correct)" echo >&2 " (check that the package name and version are correct)"
echo >&2 "" echo >&2 ""
my_release_url="$( echo >&2 " Double check at $(echo "$WEBI_RELEASES" | sed 's:\?.*::')"
echo "$WEBI_RELEASES" |
sed 's:\?.*::'
)"
echo >&2 " Double check at ${my_release_url}"
echo >&2 "" echo >&2 ""
exit 1 exit 1
fi fi
@@ -186,17 +177,11 @@ __bootstrap_webi() {
# determine the location to download to # determine the location to download to
if [ -n "${2-}" ]; then if [ -n "${2-}" ]; then
my_dl="${2}" my_dl="$2"
else else
my_dl="${WEBI_PKG_PATH}/$WEBI_PKG_FILE" my_dl="${WEBI_PKG_PATH}/$WEBI_PKG_FILE"
fi fi
if [ -n "${3-}" ]; then
my_dl_name="${3}"
else
my_dl_name="${PKG_NAME}"
fi
WEBI_PKG_DOWNLOAD="${my_dl}" WEBI_PKG_DOWNLOAD="${my_dl}"
export WEBI_PKG_DOWNLOAD export WEBI_PKG_DOWNLOAD
@@ -205,7 +190,7 @@ __bootstrap_webi() {
return 0 return 0
fi fi
echo "Downloading ${my_dl_name} from" echo "Downloading $PKG_NAME from"
echo "$my_url" echo "$my_url"
# It's only 2020, we can't expect to have reliable CLI tools # It's only 2020, we can't expect to have reliable CLI tools

View File

@@ -2,8 +2,6 @@
var path = require('path'); var path = require('path');
var Releases = require('./releases.js'); var Releases = require('./releases.js');
var uaDetect = require('./ua-detect.js');
var cache = {}; var cache = {};
//var staleAge = 5 * 1000; //var staleAge = 5 * 1000;
//var expiredAge = 15 * 1000; //var expiredAge = 15 * 1000;
@@ -54,14 +52,6 @@ function createFormatsSorter(formats) {
return 1; return 1;
} }
// Hacky-doo for musl-native: prefer non-musl
if (a._musl_native && !b._musl_native) {
return 1;
}
if (!a._musl_native && b._musl_native) {
return -1;
}
// Hacky-doo for linux: prefer musl // Hacky-doo for linux: prefer musl
if (a._musl && !b._musl) { if (a._musl && !b._musl) {
return -1; return -1;
@@ -171,7 +161,7 @@ async function getCachedReleases(pkg) {
async function filterReleases( async function filterReleases(
all, all,
{ ver, os, arch, libc, lts, channel, formats, limit }, { ver, os, arch, lts, channel, formats, limit },
) { ) {
// When multiple formats are downloadable (i.e. .zip and .pkg) // When multiple formats are downloadable (i.e. .zip and .pkg)
// sort the most compatible format first // sort the most compatible format first
@@ -180,62 +170,27 @@ async function filterReleases(
var sortByVerExt = createFormatsSorter(rformats); var sortByVerExt = createFormatsSorter(rformats);
var reVer = new RegExp('^' + ver + '\\b'); var reVer = new RegExp('^' + ver + '\\b');
function selectMatches(rel) { var sortedRels = all.releases
if (os) { .filter(function (rel) {
if (rel.os !== os) { if (
(os && rel.os !== os) ||
// Hacky-doo for linux musl
(arch && rel.arch !== arch) ||
(lts && !rel.lts) ||
(channel && rel.channel !== channel) ||
// to match 'tar.gz' and 'tar.xz' with just 'tar'
(formats.length &&
!formats.some(function (ext) {
return rel.ext.match(ext);
})) ||
(ver && !rel.version.match(reVer))
) {
return false; return false;
} }
} return true;
})
if (arch) { .sort(sortByVerExt);
if (rel.arch !== arch) {
return false;
}
}
// Hacky-doo for linux musl
if (libc === uaDetect.MUSL_NATIVE) {
if (!rel._musl && !rel._musl_native) {
return false;
}
} else if (rel._musl_native) {
return false;
}
if (lts) {
if (!rel.lts) {
return false;
}
}
if (channel) {
if (rel.channel !== channel) {
return false;
}
}
// to match 'tar.gz' and 'tar.xz' with just 'tar'
function hasExt(ext) {
return rel.ext.match(ext);
}
if (formats.length) {
if (!formats.some(hasExt)) {
return false;
}
}
if (ver) {
if (!rel.version.match(reVer)) {
return false;
}
}
return true;
}
var sortedRels = all.releases.filter(selectMatches).sort(sortByVerExt);
//console.log(sortedRels.slice(0, 4)); //console.log(sortedRels.slice(0, 4));
return sortedRels.slice(0, limit || 1000); return sortedRels.slice(0, limit || 1000);
} }
@@ -245,7 +200,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch, arch,
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -259,7 +213,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch, arch,
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -283,7 +236,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch: 'amd64', arch: 'amd64',
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -297,7 +249,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch: 'amd64', arch: 'amd64',
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -312,7 +263,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch: 'arm64', arch: 'arm64',
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -328,7 +278,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch: 'armv7l', arch: 'armv7l',
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -343,7 +292,6 @@ module.exports = function getReleases({
ver, ver,
os, os,
arch: 'armv6l', arch: 'armv6l',
libc,
lts, lts,
channel, channel,
formats, formats,
@@ -360,7 +308,6 @@ module.exports = function getReleases({
os: os || '-', os: os || '-',
arch: arch || '-', arch: arch || '-',
_musl: undefined, _musl: undefined,
_musl_native: undefined,
ext: 'err', ext: 'err',
download: 'https://example.com/doesntexist.ext', download: 'https://example.com/doesntexist.ext',
comment: comment:
@@ -388,7 +335,6 @@ if (require.main === module) {
os: 'macos', os: 'macos',
arch: 'amd64', arch: 'amd64',
lts: true, lts: true,
libc: '',
channel: 'stable', channel: 'stable',
formats: ['tar', 'exe', 'zip', 'xz', 'dmg', 'pkg'], formats: ['tar', 'exe', 'zip', 'xz', 'dmg', 'pkg'],
limit: 10, limit: 10,

View File

@@ -2,10 +2,6 @@
var uaDetect = module.exports; var uaDetect = module.exports;
const MUSL_NATIVE = 'musl-native';
uaDetect.MUSL_NATIVE = MUSL_NATIVE;
function getRequest(req) { function getRequest(req) {
var ua = req.headers['user-agent'] || ''; var ua = req.headers['user-agent'] || '';
var os = req.query.os; var os = req.query.os;
@@ -60,15 +56,10 @@ function getArch(ua) {
return '-'; return '-';
} }
// Quick hack for Apple Silicon M1 // quick hack for Apple Silicon M1
//
// Note: we now use `uname -srm` which does not have the native arch
// info included with `uname -v` and `uname -a`.
//
// Native: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64 // Native: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64
// Resetta: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 x86_64 // Resetta: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 x86_64
ua = ua.replace(/xnu-.*RELEASE_[^\s]*/, ''); ua = ua.replace(/xnu-.*RELEASE_[^\s]*/, '');
if (/aarch64|arm64|arm8|armv8/i.test(ua)) { if (/aarch64|arm64|arm8|armv8/i.test(ua)) {
return 'arm64'; return 'arm64';
} else if (/aarch|arm7|armv7/i.test(ua)) { } else if (/aarch|arm7|armv7/i.test(ua)) {
@@ -93,27 +84,6 @@ function getArch(ua) {
} }
} }
function getLibc(ua) {
if ('-' === ua) {
return '-';
}
// Use native 'libc' information, if provided
//
// Generally, we prefer 'musl' builds because they DO work on glibc systems (Ubuntu),
// but 'glibc' builds will NOT work on musl systems (Alpine / Docker).
//
// However, there are a few instances (ex: Node.js), where the 'musl' builds
// DO NOT work on glibc systems.
if (ua.match(MUSL_NATIVE)) {
return MUSL_NATIVE;
}
// TODO handle explicit invalid different
return '';
}
uaDetect.os = getOs; uaDetect.os = getOs;
uaDetect.arch = getArch; uaDetect.arch = getArch;
uaDetect.libc = getLibc;
uaDetect.request = getRequest; uaDetect.request = getRequest;

View File

@@ -1,47 +0,0 @@
#!/bin/sh
set -e
set -u
main() { (
sed '1,/^#~\/.local\/bin\/brew-updater/d' "${0}" > ~/.local/bin/brew-update-hourly
chmod a+x ~/.local/bin/brew-update-hourly
env PATH="$PATH" serviceman add --user \
--name sh.brew.updater -- \
~/.local/bin/brew-update-hourly
); }
if main; then
exit 0
fi
#~/.local/bin/brew-updater
#!/bin/sh
#set -e
set -u
if test -e ~/.config/envman/PATH.env; then
# shellcheck disable=SC1090
. ~/.config/envman/PATH.env
fi
while true; do
my_start="$(date '+%s')"
my_date="$(date '+%F %T')"
echo "[$my_date] Updating brew..."
brew update
echo ''
my_end="$(date '+%s')"
my_elapsed="$((my_end - my_start))"
my_date="$(date '+%F %T')"
echo "[$my_date] Updated in ${my_elapsed}s."
echo "[$my_date] Cleaning up..."
brew cleanup
echo "[$my_date] Waiting 24 hours..."
my_wait="$((24 * 60 * 60))"
sleep "$my_wait"
done

View File

@@ -7,9 +7,9 @@ _install_brew() {
# Straight from https://brew.sh # Straight from https://brew.sh
#/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
if test "Darwin" = "$(uname -s)"; then if [ "Darwin" = "$(uname -s)" ]; then
needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")" needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")"
if test -n "${needs_xcode}"; then if [ -n "${needs_xcode}" ]; then
echo "" echo ""
echo "" echo ""
echo "ERROR: Run this command to install XCode Command Line Tools first:" echo "ERROR: Run this command to install XCode Command Line Tools first:"
@@ -20,11 +20,11 @@ _install_brew() {
echo "" echo ""
fi fi
else else
if ! command -v gcc > /dev/null; then if [ -z "$(command -v gcc)" ]; then
echo >&2 "Warning: to install 'gcc' et al on Linux use the built-in package manager." echo >&2 "Warning: to install 'gcc' et al on Linux use the built-in package manager."
echo >&2 " For example, try: sudo apt install -y build-essential" echo >&2 " For example, try: sudo apt install -y build-essential"
fi fi
if ! command -v git > /dev/null; then if [ -z "$(command -v git)" ]; then
echo >&2 "Error: to install 'git' on Linux use the built-in package manager." echo >&2 "Error: to install 'git' on Linux use the built-in package manager."
echo >&2 " For example, try: sudo apt install -y git" echo >&2 " For example, try: sudo apt install -y git"
exit 1 exit 1
@@ -32,7 +32,7 @@ _install_brew() {
fi fi
# From Straight from https://brew.sh # From Straight from https://brew.sh
if ! test -d "$HOME/.local/opt/brew"; then if ! [ -d "$HOME/.local/opt/brew" ]; then
echo "Installing to '$HOME/.local/opt/brew'" echo "Installing to '$HOME/.local/opt/brew'"
echo "" echo ""
echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:" echo "If you prefer to have brew installed to '/usr/local' cancel now and do the following:"
@@ -44,13 +44,6 @@ _install_brew() {
git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.local/opt/brew" git clone --depth=1 https://github.com/Homebrew/brew "$HOME/.local/opt/brew"
fi fi
rm -rf "$HOME/.local/bin/brew-update-service-install"
webi_download \
"$WEBI_HOST/packages/brew/brew-update-service-install" \
"$HOME/.local/bin/brew-update-service-install" \
brew-update-service-install
chmod a+x "$HOME/.local/bin/brew-update-service-install"
webi_path_add "$HOME/.local/opt/brew/bin" webi_path_add "$HOME/.local/opt/brew/bin"
export PATH="$HOME/.local/opt/brew/bin:$PATH" export PATH="$HOME/.local/opt/brew/bin:$PATH"
@@ -67,10 +60,6 @@ _install_brew() {
# shellcheck disable=2016 # shellcheck disable=2016
echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"' echo ' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"'
echo "" echo ""
echo "To register 'brew update' as a hourly system service:"
echo " brew-update-service-install"
echo ""
} }
_install_brew _install_brew

View File

@@ -1,83 +0,0 @@
---
title: CMake
homepage: https://github.com/Kitware/CMake
tagline: |
CMake is a cross-platform, open-source build system generator
---
To update or switch versions, run `webi cmake@stable` (or `@v2`, `@beta`, etc).
### Files
These are the files / directories that are created and/or modified with this
install:
```text
~/.config/envman/PATH.env
~/.local/bin/cmake
~/.local/opt/cmake
```
## Cheat Sheet
> CMake is a cross-platform alternative to autoconf that works on Windows, Mac,
> and Linux
A project structure looks like this:
```text
my-project/
├── build/
├── CMakeLists.txt
├── hello-world*
└── hello-world.cpp
```
And can be built my running `cmake` from the `build` directory:
```sh
pushd ./build/
cmake ../
make
```
### How to create a Hello World with CMake
Lets create a hello world program in C++ and build it with CMake.
1. Create a project directory
```sh
mkdir ./my-project/
pushd ./my-project/
```
2. Create a Hello World C++ file named `hello-world.cpp` `hello-world.cpp`:
```cpp
#include <iostream>
int main(int argc, char** argv) {
std::cout << "Hello World!" << std::endl;
return 0;
}
```
3. Create a `CMakeLists.txt` to compile our code `CMakeLists.txt`:
```cmake
project{hello-world}
cmake_minimum_required(VERSION 3.10)
add_executable(hello-world hello-world.cpp)
```
4. Create a build directory and build the binary
```sh
mkdir ./build/
pushd ./build/
cmake ../
make
```
5. Test the built binary:
```sh
./hello-world
```

View File

@@ -1,56 +0,0 @@
#!/usr/bin/env pwsh
#################
# Install cmake #
#################
# Every package should define these variables
$pkg_cmd_name = "cmake"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\cmake\bin\cmake.exe"
$pkg_dst_dir = "$Env:USERPROFILE\.local\opt\cmake"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\cmake-v$Env:WEBI_VERSION\bin\cmake.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\cmake-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\cmake-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading cmake from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_dir"))
{
echo "Installing cmake"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\cmake*" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
Move-Item -Path ".\cmake*" -Destination "$pkg_src_dir"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

View File

@@ -1,47 +0,0 @@
#!/bin/sh
# shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it."
__init_cmake() {
set -e
set -u
##################
# Install cmake #
##################
# Every package should define these 6 variables
pkg_cmd_name="cmake"
pkg_dst_cmd="$HOME/.local/opt/cmake/bin/cmake"
pkg_dst_dir="$HOME/.local/opt/cmake"
pkg_dst="$pkg_dst_dir"
pkg_src_cmd="$HOME/.local/opt/cmake-v$WEBI_VERSION/bin/cmake"
pkg_src_dir="$HOME/.local/opt/cmake-v$WEBI_VERSION"
pkg_src="$pkg_src_dir"
# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/cmake-v3.27.0/
mkdir -p "$(dirname "${pkg_src_dir}")"
# mv ./cmake-*/ ~/.local/opt/cmake-v3.27.0/
mv ./cmake-*/ "${pkg_src_dir}"
}
# pkg_get_current_version is recommended, but not required
pkg_get_current_version() {
# 'cmake --version' has output in this format:
# cmake 3.27.0 (rev abcdef0123)
# This trims it down to just the version number:
# 3.27.0
cmake --version 2> /dev/null |
head -n 1 |
cut -d ' ' -f 3
}
}
__init_cmake

View File

@@ -1,20 +0,0 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'Kitware';
var repo = 'CMake';
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);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
console.info(JSON.stringify(all, null, 2));
});
}

9
dash-cli/README.md Normal file
View File

@@ -0,0 +1,9 @@
---
title: dash-cli (alias)
homepage: https://webinstall.dev/dashcore
tagline: |
`dash-cli` (dash daemon) is an alias for `dashcore` (the dash suite)
alias: dashcore
---
See [Dash Core](/dashcore).

3
dash-cli/install.ps1 Normal file
View File

@@ -0,0 +1,3 @@
echo "'dash-cli@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell

11
dash-cli/install.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -u
function __redirect_alias_dashcore() {
echo "'dash-cli@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
}
__redirect_alias_dashcore

3
dash-cli/releases.js Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('../dashcore/releases.js');

9
dash-qt/README.md Normal file
View File

@@ -0,0 +1,9 @@
---
title: dash-qt (alias)
homepage: https://webinstall.dev/dashcore
tagline: |
`dash-qt` (dash daemon) is an alias for `dashcore` (the dash suite)
alias: dashcore
---
See [Dash Core](/dashcore).

3
dash-qt/install.ps1 Normal file
View File

@@ -0,0 +1,3 @@
echo "'dash-qt@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell

11
dash-qt/install.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -u
function __redirect_alias_dashcore() {
echo "'dash-qt@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
}
__redirect_alias_dashcore

3
dash-qt/releases.js Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('../dashcore/releases.js');

9
dash-wallet/README.md Normal file
View File

@@ -0,0 +1,9 @@
---
title: dash-wallet (alias)
homepage: https://webinstall.dev/dashcore
tagline: |
`dash-wallet` (dash daemon) is an alias for `dashcore` (the dash suite)
alias: dashcore
---
See [Dash Core](/dashcore).

3
dash-wallet/install.ps1 Normal file
View File

@@ -0,0 +1,3 @@
echo "'dash-wallet@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell

11
dash-wallet/install.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -u
function __redirect_alias_dashcore() {
echo "'dash-wallet@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
}
__redirect_alias_dashcore

3
dash-wallet/releases.js Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('../dashcore/releases.js');

9
dash/README.md Normal file
View File

@@ -0,0 +1,9 @@
---
title: Dash (alias)
homepage: https://webinstall.dev/dashcore
tagline: |
`dash` (digital cash) is an alias for `dashcore` (the dash suite)
alias: dashcore
---
See [Dash Core](/dashcore).

3
dash/install.ps1 Normal file
View File

@@ -0,0 +1,3 @@
echo "'dash@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell

11
dash/install.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
set -u
function __redirect_alias_dashcore() {
echo "'dash@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
}
__redirect_alias_dashcore

3
dash/releases.js Normal file
View File

@@ -0,0 +1,3 @@
'use strict';
module.exports = require('../dashcore/releases.js');

View File

@@ -1,112 +0,0 @@
---
title: Dash Core Desktop Wallet
homepage: https://webinstall.dev/dashcore-utils/
tagline: |
Utilities for Dash Core (DASH / Digital Cash)
---
To update, run `webi dashcore-utils`.
### Files
These are the files / directories that are created and/or modified with this
install:
```txt
~/.config/envman/PATH.env
~/.local/opt/dashcore/
~/.local/bin/dash-qt-hd
~/.local/bin/dashd-hd
~/.local/bin/dashd-hd-service-install
```
[`dashcore`](../dashcore/) will also be installed if not present.
## Cheat Sheet
> Convenience scripts for running the Dash Daemon or the Dash Core Desktop
> Wallet.
- `dash-qt-hd`
- `dash-qt-testnet`
- `dashd-hd`
- `dashd-hd-service-install`
- `dashd-testnet`
- `dashd-testnet-service-install`
For historical reasons [`dashd`](../dashd/) (System Daemon) and
[`dash-qt`](../dashcore/) (Desktop Wallet) use _lossy_ keys (non-HD wallets) by
default, and the storage options options are not intuitive.
These scripts run them with safer options that are easier to configure for
server and desktop deployment, respectively.
### How to run the DASH System Daemon
1. Mount or otherwise designate a user-owned folder on a storage volume with
60g+ free space, such as
```sh
/mnt/slc1_vol_100g/dashcore/
```
2. Generally you'll want to install the Dash Daemon as a system service
```sh
dashd-hd-install-service /mnt/vol_slc1_100g/dashcore/
```
To accomplish the same manually you would:
1. Create `~/.dashcore/dash.conf` with reasonable defaults
```ini
```
Which is essentially the same as:
```sh
my_user="$(id -u -n)"
sudo mkdir /mnt/slc1_vol_100g/dashcore/
chown -R "$my_user" /mnt/slc1_vol_100g/dashcore/
mkdir -p ~/.dashcore/wallets/
mkdir -p /mnt/slc1_vol_100g/dashcore/_data
mkdir -p /mnt/slc1_vol_100g/dashcore/_caches
sudo env PATH="$PATH" serviceman add \
--system --user "$my_user" --path "$PATH" --name dashd --force -- \
dashd \
-usehd \
-conf="$HOME/.dashcore/dash.conf" \
-walletdir="$HOME/.dashcore/wallets/" \
-datadir=/mnt/slc1_vol_100g/dashcore/_data \
-blocksdir=/mnt/slc1_vol_100g/dashcore/_caches
```
See also:
- [The `dashd` Cheat Sheet](../dashd/).
### How to run the DASH Desktop Wallet
To open an existing (or create a new) Dash Desktop Wallet:
```sh
dash-qt-hd
```
Which is essentially the same as:
```sh
dash-qt \
-usehd \
-walletdir="$HOME/.config/dashcore/wallets/" \
-settings="$HOME/.config/dashcore/settings.json" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/"
```
Or pass `-testnet` to use with _TestNet_.
See also:
- [The `dash-qt` Cheat Sheet](../dashcore/).

View File

@@ -1,21 +0,0 @@
#!/bin/sh
set -e
set -u
# I don't have the gall to change the defaults (Webi values),
# but I would *strongly* recommend that you do!
#
# Instance-specific data should be separate from global caches:
#
# -settings="$HOME/.config/dashcore/settings.json" \
# -walletdir="$HOME/.config/dashcore/wallets/" \
# -datadir="$HOME/.dashcore/_data/" \
# -blocksdir="$HOME/.dashcore/_caches/" \
dash-qt \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25

View File

@@ -1,22 +0,0 @@
#!/bin/sh
set -e
set -u
# I don't have the gall to change the defaults (Webi values),
# but I would *strongly* recommend that you do!
#
# Instance-specific data should be separate from global caches:
#
# -settings="$HOME/.config/dashcore/settings.json" \
# -walletdir="$HOME/.config/dashcore/wallets/" \
# -datadir="$HOME/.dashcore/_data/" \
# -blocksdir="$HOME/.dashcore/_caches/" \
dash-qt \
-testnet \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25

View File

@@ -1,44 +0,0 @@
txindex=1
addressindex=1
timestampindex=1
spentindex=1
[main]
rpcuser=RPCUSER_MAIN
rpcpassword=RPCPASS_MAIN
# to run on multiple interfaces, use multiple config lines
# ex: bind=127.0.0.1:9999 and bind=10.0.0.100:9999)
bind=127.0.0.1:9999
rpcbind=127.0.0.1:9998
rpcconnect=127.0.0.1:9998
rpcallowip=127.0.0.1/16
# zmq* can only be bound to a single interface
# See https://github.com/dashpay/dash/issues/5461
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubrawtxlock=tcp://127.0.0.1:28332
zmqpubrawchainlock=tcp://127.0.0.1:28332
zmqpubhashchainlock=tcp://127.0.0.1:28332
[test]
rpcuser=RPCUSER_TEST
rpcpassword=RPCPASS_TEST
bind=127.0.0.1:19999
rpcbind=127.0.0.1:19998
rpcconnect=127.0.0.1:19998
rpcallowip=127.0.0.1/16
zmqpubrawtx=tcp://127.0.0.1:18009
zmqpubrawtxlock=tcp://127.0.0.1:18009
zmqpubrawchainlock=tcp://127.0.0.1:18009
zmqpubhashchainlock=tcp://127.0.0.1:18009
[regtest]
rpcuser=RPCUSER_REGTEST
rpcpassword=RPCPASS_REGTEST
bind=127.0.0.1:19899
rpcbind=127.0.0.1:19898
rpcconnect=127.0.0.1:19898
rpcallowip=127.0.0.1/16
zmqpubrawtx=tcp://127.0.0.1:18809
zmqpubrawtxlock=tcp://127.0.0.1:18809
zmqpubrawchainlock=tcp://127.0.0.1:18809
zmqpubhashchainlock=tcp://127.0.0.1:18809

View File

@@ -1,46 +0,0 @@
#!/bin/sh
set -e
set -u
# Unfortunately we can't know that datadir won't be used
# for other non-cache files, but we can at least protect
# the ones we're aware of.
my_netname="${1:-}"
if test -n "${my_netname}"; then
if test "${my_netname}" != mainnet &&
test "${my_netname}" != testnet &&
test "${my_netname}" != regnet &&
test "${my_netname}" != devnet; then
echo ""
echo "ERROR"
echo " '${my_netname}' is not one of 'testnet', 'regnet', 'devnet'"
echo ""
echo ""
fi
if test "${my_netname}" != mainnet; then
my_netname=''
fi
fi
my_net_arg=''
if test -n "${my_netname}"; then
my_net_arg="-${my_netname}"
fi
# shellcheck disable=2086
dashd \
-usehd \
${my_net_arg} \
-conf="$HOME/.dashcore/dash.conf" \
-settings="$HOME/.dashcore/settings.json" \
-walletdir="$HOME/.dashcore/wallets/" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_data/"
# -enablecoinjoin=1 \
# -coinjoinautostart=1 \
# -coinjoinrounds=16 \
# -coinjoindenomsgoal=10 \
# -coinjoindenomshardcap=25

View File

@@ -1,176 +0,0 @@
#!/bin/sh
set -e
set -u
fn_usage() { (
echo >&2 ""
echo >&2 "USAGE"
echo >&2 " dashd-hd-service-install [datadir] ['testnet']"
echo >&2 ""
echo >&2 "EXAMPLE"
echo >&2 " dashd-hd-service-install /mnt/vol_slc1_100g/dashcore/"
echo >&2 ""
echo >&2 "NOTE"
echo >&2 " If a directory matching '/mnt/*/dashcore/' is found,"
echo >&2 " it will be used automatically."
echo >&2 ""
); }
fn_datadir_help() { (
my_vol="${1:-}"
my_user="$(
id -n -u
)"
my_group="$(
id -n -g
)"
echo >&2 ""
echo >&2 "ERROR"
echo >&2 " '${my_vol}' is not writable"
echo >&2 ""
echo >&2 "SOLUTION"
echo >&2 " 1. Mount a large (50gb+) volume"
echo >&2 ""
echo >&2 " sudo mkdir -p /mnt/EXAMPLE"
echo >&2 " sudo mount /dev/sdx1 /mnt/EXAMPLE"
echo >&2 ""
echo >&2 " 2. Create a 'dashcore' inside of it"
echo >&2 ""
echo >&2 " sudo mkdir -p '${my_vol}'"
echo >&2 ""
echo >&2 " 3. Make it writable to this user"
echo >&2 ""
echo >&2 " sudo chown -R '${my_user}':'${my_group}' '${my_vol}'"
echo >&2 ""
echo >&2 ""
); }
fn_srv_install() { (
my_vol="${1:-}"
my_netname="${2:-}"
my_name='dashd'
# both of these will get '/testnet3' suffixes with -testnet
my_datadir="${my_vol}/_data"
my_blocksdir="${my_vol}/_caches"
if test -n "${my_netname}"; then
if test "mainnet" = "${my_netname}"; then
my_netname=""
elif test "testnet" != "${my_netname}"; then
fn_usage
return 1
fi
fi
if ! test -d "${my_datadir}"; then
mkdir "${my_datadir}"
chmod 0700 "${my_datadir}"
fi
if ! test -d "${my_blocksdir}"; then
mkdir -p "${my_blocksdir}"
chmod 0700 "${my_blocksdir}"
fi
my_net_flag=''
if test -n "${my_netname}"; then
# ex: -testnet
my_net_flag="-${my_netname}"
# ex: dashd-testnet
my_name="dashd-${my_netname}"
fi
my_system_args=""
my_kernel="$(
uname -s
)"
if test "Darwin" != "${my_kernel}"; then
my_user="$(
id -u -n
)"
my_system_args="--system --username ${my_user}"
fi
# shellcheck disable=SC2016,SC1090
echo 'sudo env PATH="$PATH"' \
"serviceman add ${my_system_args} --path \"\$PATH\" --name \"${my_name}\" --force --" \
"dashd " \
"${my_net_flag}" \
-usehd \
'-conf="$HOME/.dashcore/dash.conf"' \
'-settings="$HOME/.dashcore/settings.json"' \
'-walletdir="$HOME/.dashcore/wallets/"' \
"-datadir=\"${my_datadir}\"" \
"-blocksdir=\"${my_blocksdir}\""
if ! command -v serviceman > /dev/null; then
echo ""
echo "Installing 'serviceman'..."
echo ""
{
curl -fsSL "${WEBI_HOST}/serviceman" | sh
} > /dev/null
# shellcheck disable=SC1090
. ~/.config/envman/PATH.env || true
fi
mkdir -p "$HOME/.dashcore/wallets/"
chmod 0700 "$HOME/.dashcore/wallets/"
mkdir -p "${my_datadir}"
chmod 0700 "${my_datadir}"
mkdir -p "${my_blocksdir}"
chmod 0700 "${my_blocksdir}"
cd "${my_vol}" || return 1
# leave options unquoted so they're interpreted separately
# shellcheck disable=SC2086
sudo env PATH="${PATH}" \
serviceman add ${my_system_args} --path "${PATH}" --name "${my_name}" --force -- \
dashd \
${my_net_flag} \
-usehd \
-conf="${HOME}/.dashcore/dash.conf" \
-settings="${HOME}/.dashcore/settings.json" \
-walletdir="${HOME}/.dashcore/wallets/" \
-datadir="${my_datadir}" \
-blocksdir="${my_blocksdir}"
); }
main() { (
my_vol="${1:-}"
my_netname="${2:-}"
if test -z "${my_vol}"; then
my_vol="$(
ls -d /mnt/*/dashcore/ 2> /dev/null || true
)"
fi
if test "help" = "${my_vol}" ||
test "--help" = "${my_vol}"; then
fn_usage
return 0
fi
if test -z "${my_vol}"; then
fn_usage
return 1
fi
if ! test -d "${my_vol}" ||
! test -w "${my_vol}"; then
fn_datadir_help "${my_vol}"
return 1
fi
fn_srv_install "${my_vol}" "${my_netname}"
); }
main "${@:-}"

View File

@@ -1,13 +0,0 @@
#!/bin/sh
set -e
set -u
# NOTE:
# The '-testnet' flag will always cause a './testnet3/' folder
# to be created under '-datadir' (it won't the 'datadir' directly)
#
# Example:
# dashd -testnet -datadir="$HOME/.dashcore/"
# will save to ~/.dashcore/testnet3/, NOT ~/.dashcore/
dashd-hd testnet

View File

@@ -1,5 +0,0 @@
#!/bin/sh
set -e
set -u
dashd-hd-service-install "${1:-}" "testnet"

View File

@@ -1,91 +0,0 @@
#!/bin/sh
set -e
set -u
__install_dashcore_utils() {
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dash-qt-hd" \
"$HOME/.local/bin/dash-qt-hd"
chmod a+x "$HOME/.local/bin/dash-qt-hd"
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dash-qt-testnet" \
"$HOME/.local/bin/dash-qt-testnet"
chmod a+x "$HOME/.local/bin/dash-qt-testnet"
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dashd-hd" \
"$HOME/.local/bin/dashd-hd"
chmod a+x "$HOME/.local/bin/dashd-hd"
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dashd-testnet" \
"$HOME/.local/bin/dashd-testnet"
chmod a+x "$HOME/.local/bin/dashd-testnet"
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dashd-hd-service-install" \
"$HOME/.local/bin/dashd-hd-service-install"
chmod a+x "$HOME/.local/bin/dashd-hd-service-install"
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dashd-testnet-service-install" \
"$HOME/.local/bin/dashd-testnet-service-install"
chmod a+x "$HOME/.local/bin/dashd-testnet-service-install"
if ! test -e "${HOME}/.dashcore"; then
mkdir -p "${HOME}/.dashcore"
chmod 0700 "${HOME}/.dashcore"
fi
if ! test -e "${HOME}/.dashcore/dash.conf"; then
touch "${HOME}/.dashcore/dash.conf"
chmod 0600 "${HOME}/.dashcore/dash.conf"
fi
webi_download \
"$WEBI_HOST/packages/dashcore-utils/dash.example.conf" \
"$HOME/.dashcore/dash.example.conf"
if ! grep -q rpcuser ~/.dashcore/dash.conf; then
cat ~/.dashcore/dash.example.conf >> ~/.dashcore/dash.conf
cmd_sed="sed -i -E"
my_bsd_sed=''
if ! sed -V 2>&1 | grep -q 'GNU'; then
cmd_sed="sed -i .dascore-utils-bak -E"
my_bsd_sed='true'
fi
my_user="$(
id -u -n
)"
my_main_pass="$(xxd -l16 -ps /dev/urandom)"
my_test_pass="$(xxd -l16 -ps /dev/urandom)"
my_regtest_pass="$(xxd -l16 -ps /dev/urandom)"
$cmd_sed "s/RPCUSER_MAIN/${my_user}/" ~/.dashcore/dash.conf
$cmd_sed "s/RPCPASS_MAIN/${my_main_pass}/" ~/.dashcore/dash.conf
$cmd_sed "s/RPCUSER_TEST/${my_user}-test/" ~/.dashcore/dash.conf
$cmd_sed "s/RPCPASS_TEST/${my_test_pass}/" ~/.dashcore/dash.conf
$cmd_sed "s/RPCUSER_REGTEST/${my_user}-regtest/" ~/.dashcore/dash.conf
$cmd_sed "s/RPCPASS_REGTEST/${my_regtest_pass}/" ~/.dashcore/dash.conf
if test -n "${my_bsd_sed}"; then
rm -f ~/.dashcore/dash.conf.dascore-utils-bak
fi
fi
export PATH="$HOME/.local/opt/dashcore/bin:$PATH"
if ! command -v dashd > /dev/null ||
! command -v dash-qt > /dev/null; then
"$HOME/.local/bin/webi" dashcore
fi
# Always try to correct the permissions due to
# https://github.com/dashpay/dash/issues/5420
chmod -R og-rwx "${HOME}/.dashcore/" || true
}
__install_dashcore_utils

View File

@@ -1,19 +1,13 @@
--- ---
title: Dash Core Desktop Wallet title: Dash Core
homepage: https://github.com/dashpay/dash homepage: https://github.com/dashpay/dash
tagline: | tagline: |
Dash Core is the Desktop Wallet for Digital Cash (DASH) foobar: An example that doesn't exist.
--- ---
To update or switch versions, run `webi dashcore@stable` (or `@v19`, `@beta`, To update or switch versions, run `webi dashcore@stable` (or `@v0.17`, `@beta`,
etc). etc).
### System Requirements
- 50GB Free Storage (100GB recommended)
- 4GB RAM (8GB recommended)
- 4 hours for initial sync
### Files ### Files
These are the files / directories that are created and/or modified with this These are the files / directories that are created and/or modified with this
@@ -21,169 +15,26 @@ install:
```txt ```txt
~/.config/envman/PATH.env ~/.config/envman/PATH.env
~/.local/bin/
~/.local/opt/dashcore/ ~/.local/opt/dashcore/
# For convenience
~/.local/bin/dash-qt-hd
~/.local/bin/dash-qt-testnet
# Linux
~/.dashcore/settings.json
~/.dashcore/testnet3/
# macOS
~/Library/Application Support/DashCore/settings.json
~/Library/Application Support/DashCore/testnet3/
~/Library/Saved Application State/org.dash.Dash-Qt.savedState ~/Library/Saved Application State/org.dash.Dash-Qt.savedState
~/Library/Preferences/org.dash.Dash-Qt.plist ~/Library//Preferences/org.dash.Dash-Qt.plist
``` ```
[`dashcore-utils`](../dashcore-utils/) will also be installed if not present.
## Cheat Sheet ## Cheat Sheet
> _DASH_ (portmanteau of _Digital Cash_) is an international currency. _Dash > _Dash Core_ is a suite of tools for _Dash_, the international digital
> Core_ is the original suite of tools for _Dash_, maintained by DCG. > currency.
The original tools include: The tools include:
- `dash-qt` - a _Desktop Wallet_ for sending and receiving money - `dash-qt` the _Desktop Wallet_ for sending and receiving payments
- [`dashd`](../dashd/) - the [_Full Node_](../dashd/) server daemon \ - `dash-cli` the _Command Line Wallet_
(for APIs, servers, and such) - [`dashd`](/dashd) the ledger and transaction service
- `dash-cli` - send RPC commands (same as the dash-qt command console) - `dash-tx` the transaction debugger
- `dash-tx` - create and debug raw (hex) transactions
- `dash-wallet` - interact with wallet files offline
The webi installer also includes two convenience wrapper scripts: To open the Dash Desktop Wallet:
- `dash-qt-hd` ```bash
- `dash-qt-testnet` dash-qt
To open an existing (or create a new) Dash Desktop Wallet:
```sh
dash-qt \
-usehd \
-walletdir="$HOME/.config/dashcore/wallets/" \
-settings="$HOME/.config/dashcore/settings.json" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/"
``` ```
Or pass `-testnet` to use with _TestNet_:
```sh
dash-qt \
-testnet \
-usehd \
-walletdir="$HOME/.config/dashcore/wallets/" \
-settings="$HOME/.config/dashcore/settings.json" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/"
```
### IMPORTANT: How to NOT Lose Money!
`dash-qt-hd` should be preferred to `dash-qt`.
For historical reasons, `dash-qt` uses **lossy keys** by default!
This is very dangerous - without a Wallet Phrase to recover HD Keys, file
corruption (or losing the device) can lead to losing money permanently.
To avoid this you may use `dash-qt-hd`, or create your wallet with `-usehd`
(optionally with `-mnemonic=<wallet phrase>` if you'd like to recover an
existing wallet), or `upgradetohd`.
### How to Convert from Lossy to HD
If you used `dash-qt` without `-usehd` and already created a wallet, you can fix
it from the command console, which can be found in _Window => Console_.
```text
# Usage
# upgradetohd [wallet phrase] [legacy salt] <wallet encryption phrase>
# Example
upgradetohd "" "" "correct horse battery staple"
# Example with the "zoomonic" and a legacy salt
upgradetohd "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong" \
"TREZOR" "correct horse battery staple"
```
It's a good idea to back up your wallet before running the conversion.
For more detail see:
<https://docs.dash.org/en/stable/docs/user/wallets/dashcore/advanced.html>
### How to Separate Caches from Data
You can make your data much safer by separating it from the caches you may need
to delete by setting:
- `-walletdir=` your money!!
- `-settings=` desktop app settings!
- `-conf=` server settings
- `-datadir=` miscellaneous
- `-blocksdir=` generic caches
```sh
dash-qt \
-usehd \
-settings="$HOME/.config/dashcore/settings.json" \
-walletdir="$HOME/.config/dashcore/wallets/" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/" \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25
```
### How to Mix with CoinJoin
CoinJoin aids in preventing some bad actors and malicious observers being able
to easily reconstruct details about your transactions from the publicly
available data by creating many excess transactions. \
(be aware, however, that dedicated bad actors can use sophisticated software that
will reveal much of the same information over time)
`dash-qt` does not enable CoinJoin mixing by default.
`dash-qt-hd` does. It runs the following:
```sh
dash-qt \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25
```
The `coinjoindenomsgoal` and `coinjoindenomshardcap` prevent CoinJoin from
splitting coins down into hundreds of small, unusable coins.
### Other Tools
- [`dashphrase`](https://github.com/dashhive/dashphrase-cli) for generating
secure Wallet Phrases
- [`dashsight`](https://github.com/dashhive/dashphrase-cli) for inspecting
balances, transactions, etc via API (without downloading the indexes)
### More Documentation
All of the **command line flags and options** for the Dash Core Desktop Wallet
are documented between these two pages:
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dash-qt.html
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dashd.html
The **config files** `dash.conf` (mainly for _Full Nodes_) and `settings.json`
(mainly for Desktop Wallets) are documented at:
- <https://github.com/dashpay/dash/blob/master/contrib/debian/examples/dash.conf>
- <https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-configuration-file.html>

View File

@@ -1,17 +1,17 @@
#!/usr/bin/env pwsh #!/usr/bin/env pwsh
#################### ##################
# Install dashcore # # Install dashcore #
#################### ##################
# Every package should define these variables # Every package should define these variables
$pkg_cmd_name = "dash-qt" $pkg_cmd_name = "dashd"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\dashcore\bin\dash-qt.exe" $pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\dashcore\bin\dashd.exe"
$pkg_dst_dir = "$Env:USERPROFILE\.local\opt\dashcore" $pkg_dst_dir = "$Env:USERPROFILE\.local\opt\dashcore"
$pkg_dst = "$pkg_dst_cmd" $pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin\dash-qt.exe" $pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin\dashd.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin" $pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION" $pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd" $pkg_src = "$pkg_src_cmd"

View File

@@ -1,81 +1,45 @@
#!/bin/sh #!/bin/bash
# shellcheck disable=SC2034 # shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it." # "'pkg_cmd_name' appears unused. Verify it or export it."
__init_dashcore() { function __init_dashcore() {
set -e set -e
set -u set -u
#################### ##################
# Install dashcore # # Install dashcore #
#################### ##################
# Every package should define these 6 variables # Every package should define these 6 variables
pkg_cmd_name="dash-qt" pkg_cmd_name="dashd"
pkg_dst_cmd="$HOME/.local/opt/dashcore/bin/dash-qt" pkg_dst_cmd="$HOME/.local/opt/dashcore/bin/dashd"
pkg_dst_dir="$HOME/.local/opt/dashcore" pkg_dst_dir="$HOME/.local/opt/dashcore"
pkg_dst="$pkg_dst_dir" pkg_dst="$pkg_dst_dir"
pkg_src_cmd="$HOME/.local/opt/dashcore-v$WEBI_VERSION/bin/dash-qt" pkg_src_cmd="$HOME/.local/opt/dashcore-v$WEBI_VERSION/bin/dashd"
pkg_src_dir="$HOME/.local/opt/dashcore-v$WEBI_VERSION" pkg_src_dir="$HOME/.local/opt/dashcore-v$WEBI_VERSION"
pkg_src="$pkg_src_dir" pkg_src="$pkg_src_dir"
# pkg_install must be defined by every package # pkg_install must be defined by every package
pkg_install() { pkg_install() {
# mv ./dashcore-* ~/.local/opt/dashcore-v0.19.1 # mv ./dashcore-* ~/.local/opt/dashcore-v0.17.0
mv ./dashcore-* "${pkg_src_dir}" mv ./dashcore-* "${pkg_src_dir}"
if ! test -e "${HOME}/.dashcore"; then
mkdir -p "${HOME}/.dashcore"
chmod 0700 "${HOME}/.dashcore" || true
fi
# if ! test -e "${HOME}/.dashcore/dash.conf"; then
# my_main_pass="$(xxd -l16 -ps /dev/urandom)"
# my_test_pass="$(xxd -l16 -ps /dev/urandom)"
# {
# echo '[main]'
# echo "rpcuser=$(id -u -n)"
# echo "rpcpassword=${my_main_pass}"
# echo ''
# echo '[test]'
# echo "rpcuser=$(id -u -n)-test"
# echo "rpcpassword=${my_test_pass}"
# echo ''
# } >> "${HOME}/.dashcore/dash.conf"
# chmod 0600 "${HOME}/.dashcore/dash.conf" || true
# fi
# if ! test -e "${HOME}/.dashcore/settings.json"; then
# echo '{}' >> "${HOME}/.dashcore/settings.json"
# chmod 0600 "${HOME}/.dashcore/settings.json" || true
# fi
if ! test -e "$HOME/.local/bin/dash-qt-hd" ||
! test -e "$HOME/.local/bin/dash-qt-testnet"; then
"$HOME/.local/bin/webi" dashcore-utils
fi
# Always try to correct the permissions due to
# https://github.com/dashpay/dash/issues/5420
chmod -R og-rwx "${HOME}/.dashcore/" || true
} }
# pkg_get_current_version is recommended, but not required # pkg_get_current_version is recommended, but not required
pkg_get_current_version() { pkg_get_current_version() {
# 'dash-qt' doesn't have version info, so we use 'dashd'
# 'dashd --version' has output in this format: # 'dashd --version' has output in this format:
# Dash Core Daemon version v19.1.0 # Dash Core Daemon version v0.17.0.3
# This trims it down to just the version number: # This trims it down to just the version number:
# 19.1.0 # 0.17.0
dashd --version 2> /dev/null | dashd --version 2> /dev/null |
head -n 1 | head -n 1 |
cut -d ' ' -f 5 | cut -d ' ' -f 5 |
sed 's:^v::' sed 's:^v::'
} }
} }
__init_dashcore __init_dashcore

View File

@@ -1,20 +1,14 @@
--- ---
title: Dash Core Full Node Daemon title: dashd (alias)
homepage: https://github.com/dashpay/dash homepage: https://webinstall.dev/dashcore
tagline: | tagline: |
dashd is the Full Node service for Digital Cash (DASH) `dashd` (dash daemon) is an alias for `dashcore` (the dash suite)
alias: dashcore
--- ---
To update or switch versions, run `webi dashd@stable` (or `@v0.19`, `@beta`, To update or switch versions, run `webi dashd@stable` (or `@v0.17`, `@beta`,
etc). etc).
### Recommended Hardware
- 100GB+ Block Storage
- 8GB RAM
- 4 vCPUs
- **30 hours** for initial indexing
### Files ### Files
These are the files / directories that are created and/or modified with this These are the files / directories that are created and/or modified with this
@@ -22,289 +16,101 @@ install:
```txt ```txt
~/.config/envman/PATH.env ~/.config/envman/PATH.env
~/.dashcore/dash.conf ~/.local/bin/
~/.dashcore/wallets/
~/.local/bin/bin/dashd-hd-service-install
~/.local/opt/dashcore/ ~/.local/opt/dashcore/
/mnt/<BLK_VOL>/dashcore/ ~/.dashcore/
``` ```
[`dashcore-utils`](../dashcore-utils/) will also be installed if not present.
## Cheat Sheet ## Cheat Sheet
> A DASH _Full Node_ syncs and indexes the DASH blockchain and can be used to > The _Dash Daemon_ joins and listens on the Dash network for payment
> broadcast transactions (sending money) and retrieve information about > transactions.
> transactions, balances, etc. This "Dash Core" implementation is maintained by
> DCG.
To install as **a system service** with reasonable defaults, \ You will at least 2GB+ RAM + Swap (or 4GB+ without swap) and 50GB storage (20GB
you can use these convenience scripts provided by Webi: for the ledger + another 20gb for indices) for `dashd` to be able to provide
transaction info and RPC services.
```sh A first run will typically take _several_ hours to sync.
# USAGE
# dashd-hd-service-install [storage-volume] [testnet] ```bash
# dashd -- -conf=/home/app/.dashcore/dash.conf -datadir=/mnt/volume_100gb/dashcore/
# EXAMPLE
dashd-hd-service-install
``` ```
### QuickStart ### How to configure dashd
0. Check that you have enough Storage and RAM `~/.dashcore/dash.conf`:
- mainnet: 100GB+ Storage, 8GB RAM
- testnet: 20GB+ Storage, 2GB RAM
1. Create a mount for your storage volume
```sh
sudo mkdir -p /mnt/100gb-vol/
sudo mount /dev/vda1 /mnt/100gb-vol/
```
2. Create a correctly permissioned `dashcore` directory
```sh
sudo mkdir -p /mnt/100g-vol/dashcore/
sudo chown -R "$(id -u -n):$(id -g -n)" /mnt/100gb-vol/dashcore/
```
3. Register `dashd` with the system launcher
```sh
dashd-hd-service-install
```
4. Wait **about 30 hours** for initial sync and indexing to complete
5. Test with the DashCore CLI
```sh
dash-cli getaddresstxids '{
"addresses": ["XchrTJFPGFiror4zjXQRR7XTSN25YtLYhC"],
"start": 0,
"end":1000000000
}'
```
### How to use DashCore CLI ```txt
rpcuser=dash
rpcpassword=local321
rpcallowip=127.0.0.1/0
After it completes the initial sync (about 4 hours), \ #listen=1
you can query address information: server=1
#daemon=1
```sh whitelist=127.0.0.1/0
# Balances
dash-cli getaddressbalance '{"addresses": ["XchrTJFPGFiror4zjXQRR7XTSN25YtLYhC"]}'
# UTXOs # light mode
dash-cli getaddressutxos '{"addresses": ["XpLVjhDd6vNJamtcJXcrpQYA1sE6fmxVDa"]}' #prune=945
# TXes
dash-cli getaddresstxids '{
"addresses": ["XchrTJFPGFiror4zjXQRR7XTSN25YtLYhC"],
"start": 0,
"end":1000000000
}'
# Broadcast TX
dash-cli -testnet sendrawtransaction 01000000...0c0226b428a488ac00000000
```
### How to Run dashd Manually
To run **in the foreground**: \
(add `-testnet` to run on testnet)
```sh
dashd \
-usehd \
-conf="$HOME/.dashcore/dash.conf" \
-settings="$HOME/.dashcore/settings.json" \
-walletdir="$HOME/.dashcore/wallets/" \
-datadir="/mnt/100gb/dashcore/_data/" \
-blocksdir="/mnt/100gb/dashcore/_caches/" \
-addressindex=1 \
-timestampindex=1 \
-txindex=1 \
-spentindex=1
```
**Warning**: killing the process with ctrl+c before the first full sync may
corrupt the data and require starting over (see below)
### Server Requirements
150MB for Applications on OS Storage
For **mainnet**:
- 100GB Block Storage Volume \
- minimum of 40GB (blockchain) + 50GB (indexes) as of 2023
- plus 4-8GB per year
- 8GB RAM \
(min 4GB RAM + 4GB swap, otherwise it crashes during indexing)
- 4 vCPUs \
(min 2x 2.0GHz vCPUs, higher clock speed is better than more cors)
- 100 megabit network
- 28-30 hours to sync and index in ideal conditions
- minimum of 4 hours to sync
- approximately 28 hours to index regardless of sync time
For **testnet**:
- 20GB Block Storage Volume \
- min 4GB (blockchain) + 5 GB (indexes) as of 2022
- plus 0.5-1GB/year
- 2GB RAM
- 1 vCPU
- 4 hours to sync and index in ideal conditions
- 1 hour to sync
- about 4 hours to index regardless of sync time
### How to configure `dash.conf`
You can set options for `main`, `test`, and `regtest`.
If you intend to use the various RPCs you must enable indexes.
```ini
txindex=1 txindex=1
addressindex=1 addressindex=0
timestampindex=1 timestampindex=0
spentindex=1 spentindex=0
[main]
rpcuser=alice
rpcpassword=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
bind=127.0.0.1:9999
rpcbind=127.0.0.1:9998
rpcconnect=127.0.0.1:9998
rpcallowip=127.0.0.1/16
zmqpubrawtx=tcp://127.0.0.1:28332 zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubrawtxlock=tcp://127.0.0.1:28332 zmqpubrawtxlock=tcp://127.0.0.1:28332
zmqpubrawchainlock=tcp://127.0.0.1:28332 zmqpubhashblock=tcp://127.0.0.1:28332
zmqpubhashchainlock=tcp://127.0.0.1:28332 #ip=
rpcport=9998
[test] uacomment=bitcore
rpcuser=alice-test #debug=1
rpcpassword=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy #testnet=1
bind=127.0.0.1:19999
rpcbind=127.0.0.1:19998
rpcconnect=127.0.0.1:19998
rpcallowip=127.0.0.1/16
zmqpubrawtx=tcp://127.0.0.1:18009
zmqpubrawtxlock=tcp://127.0.0.1:18009
zmqpubrawchainlock=tcp://127.0.0.1:18009
zmqpubhashchainlock=tcp://127.0.0.1:18009
``` ```
See also: ### How to run dashd as a system service
- [dash: examples/dash.conf](https://github.com/dashpay/dash/blob/549e347b742cb4dc63807a292729e658218d7d0f/contrib/debian/examples/dash.conf#L2) ```bash
- [dashd: Indexing Options](https://docs.dash.org/projects/core/en/19.0.0/docs/dashcore/wallet-arguments-and-commands-dashd.html#indexing-options) sudo env PATH="${PATH}" \
serviceman add --system --username "$(whoami)" --path "${PATH}" --name dashd -- \
### How to Separate Caches from Data dashd -- -conf=/home/app/.dashcore/dash.conf -datadir=/mnt/volume_100gb/dashcore/
You can make your data much safer by separating it from the caches you may need
to delete by setting:
- `-walletdir=` your money!!
- `-settings=` desktop app settings!
- `-conf=` server settings
- `-datadir=` generic caches
```sh
dashd \
-usehd \
-conf="$HOME/.config/dashcore/dash.conf" \
-walletdir="$HOME/.config/dashcore/wallets/" \
-datadir="/mnt/dashcore/dashcore/"
``` ```
### How to Run as a System Service ### How to enable Swap Space
You can use [`serviceman`](../serviceman/): `dashd` takes a _lot_ of RAM during the initial sync phase. Once that is
completed, it uses _significantly_ less for daily use.
**Linux** If you want to save money you can give yourself 4GB+ Swap and although the sync
process will run a little slower (but probably not that much), you'll be able to
complete it using disk storage.
```sh To create a swap file:
sudo env PATH="$PATH" \
serviceman add \ ```bash
--system \ sudo fallocate -l 8G /var/swapfile
--username "$(id -n -u)" \ sudo chmod 0600 /var/swapfile
--path "$PATH" \ sudo mkswap /var/swapfile
--name dashd \
--force \
-- \
dashd \
-usehd \
-conf="$HOME/.dashcore/dash.conf" \
-settings="$HOME/.dashcore/settings.json" \
-walletdir="$HOME/.dashcore/wallets/" \
-datadir="/mnt/100gb/dashcore/_data/" \
-blocksdir="/mnt/100gb/dashcore/_caches/"
``` ```
**Mac** To temporarily enable swap:
```sh ```bash
serviceman add \ sudo swapon /var/swapfile
--path "$PATH" \
--name dashd \
--force \
-- \
dashd \
-usehd \
-conf="$HOME/.dashcore/dash.conf" \
-settings="$HOME/.dashcore/settings.json" \
-walletdir="$HOME/.dashcore/wallets/" \
-datadir="/Volumes/100gb/dashcore/_data/" \
-blocksdir="/Volumes/100gb/dashcore/_caches/"
``` ```
**Windows** To permanently enable swap:
(be sure modify variables appropriately for `cmd.exe` or `powershell`) ```bash
sudo bash -c 'echo "/var/swapfile none swap sw 0 0" > /etc/fstab'
```sh
& serviceman add \
--name dashd \
--force \
-- \
dashd \
-usehd \
-conf="$Env:UserProfile/.dashcore/dash.conf" \
-settings="$Env:UserProfile/.dashcore/settings.json" \
-walletdir="$Env:UserProfile/.dashcore/wallets/" \
-datadir="D:/100gb/dashcore/_data/" \
-blocksdir="D:/100gb/dashcore/_caches/"
``` ```
### How to Trim Excessive Storage To disable and delete swap:
If the service **crashes** during the initial syncing and indexing (such as when ```bash
using less than 4GB RAM + 4GB Swap) it **will not resume** (typically). sudo swapoff /var/swapfile
```
Instead it will create duplicate new data, and not clean up the old data. (don't forget to remove it from `/etc/fstab` as well)
You may need to **delete /mnt/<BLK_VOL>/dashcore/** and start from scratch See [vps-addswap](/vps-addswap) for details.
(being careful not to delete any wallet information, if you have any).
Generally I wouldn't recommend storing money on a Full Node -since it's
primarily used for creating APIs for transactions and validations - but if you
do, please always make sure to use `-usehd` and print out your Wallet Phrase as
a failsafe.
### More Tools
In particular, you may find these useful:
- [`dashphrase`](https://github.com/dashhive/dashphrase-cli) for generating
secure Wallet Phrases
- [`dashsight`](https://github.com/dashhive/dashphrase-cli) for inspecting
balances, transactions, etc via API (without downloading the indexes)
### More Documentation
All of the **command line flags and options** for the Dash Core Desktop Wallet
are documented between these two pages:
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dash-qt.html
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dashd.html
The **config files** `dash.conf` (mainly for _Full Nodes_) and `settings.json`
(mainly for Desktop Wallets) are documented at:
- <https://github.com/dashpay/dash/blob/master/contrib/debian/examples/dash.conf>
- <https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-configuration-file.html>

View File

@@ -1,56 +1,3 @@
#!/usr/bin/env pwsh echo "'dashd@$Env:WEBI_TAG' is an alias for 'dashcore@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
################# curl.exe -fsSL "$Env:WEBI_HOST/dashcore@$Env:WEBI_VERSION" | powershell
# Install dashd #
#################
# Every package should define these variables
$pkg_cmd_name = "dashd"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\dashcore\bin\dashd.exe"
$pkg_dst_dir = "$Env:USERPROFILE\.local\opt\dashcore"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin\dashd.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading dashd from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_dir"))
{
echo "Installing dashd"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\dashcore*" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
Move-Item -Path ".\dashcore*" -Destination "$pkg_src_dir"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

View File

@@ -1,74 +1,11 @@
#!/bin/sh #!/bin/bash
set -e
set -u
# shellcheck disable=SC2034,2317 function __redirect_alias_dashcore() {
# "'pkg_cmd_name' appears unused. Verify it or export it." echo "'dashd@${WEBI_TAG:-}' (project) is an alias for 'dashcore@${WEBI_VERSION:-}' (command)"
# "Command appears to be unreachable." WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/dashcore@${WEBI_VERSION:-}" | bash
__init_dashd() {
set -e
set -u
#################
# Install dashd #
#################
# Every package should define these 6 variables
pkg_cmd_name="dashd"
pkg_dst_cmd="$HOME/.local/opt/dashcore/bin/dashd"
pkg_dst_dir="$HOME/.local/opt/dashcore"
pkg_dst="$pkg_dst_dir"
pkg_src_cmd="$HOME/.local/opt/dashcore-v$WEBI_VERSION/bin/dashd"
pkg_src_dir="$HOME/.local/opt/dashcore-v$WEBI_VERSION"
pkg_src="$pkg_src_dir"
# pkg_install must be defined by every package
pkg_install() {
# mv ./dashcore-* ~/.local/opt/dashcore-v0.19.1
mv ./dashcore-* "${pkg_src_dir}"
if ! test -e "${HOME}/.dashcore"; then
mkdir -p "${HOME}/.dashcore"
chmod 0700 "${HOME}/.dashcore"
fi
if ! test -e "$HOME/.local/bin/dashd-hd-service-install" ||
! test -e "$HOME/.local/bin/dashd-testnet-service-install"; then
"$HOME/.local/bin/webi" dashcore-utils
fi
# Always try to correct the permissions due to
# https://github.com/dashpay/dash/issues/5420
chmod -R og-rwx "${HOME}/.dashcore/" || true
}
pkg_done_message() {
echo "Installed 'dashd@v$WEBI_VERSION' to ~/.local/opt/dashcore/"
echo ""
echo "TO START THE DAEMON"
echo ""
echo " # mainnet"
echo " dashd-hd-service-install"
echo ""
echo ""
echo " # testnet"
echo " dashd-testnet-service-install"
echo ""
}
# pkg_get_current_version is recommended, but not required
pkg_get_current_version() {
# 'dashd --version' has output in this format:
# Dash Core Daemon version v19.1.0
# This trims it down to just the version number:
# 19.1.0
dashd --version 2> /dev/null |
head -n 1 |
cut -d ' ' -f 5 |
sed 's:^v::'
}
} }
__init_dashd __redirect_alias_dashcore

View File

@@ -19,16 +19,3 @@ that produce the most similar quality by default.
```sh ```sh
ffmpeg -i input.m4a output.mp3 ffmpeg -i input.m4a output.mp3
``` ```
Important information per https://johnvansickle.com/ffmpeg/release-readme.txt
> Notes: A limitation of statically linking `glibc` is the loss of DNS resolution. Installing `nscd` through your package manager will fix this.
*This is relevant if using ffmpeg to relay to an RTMP server via domain name.*
```sh
# for example, this will not work without `nscd` installed.
ffmpeg -re -stream_loop -1 -i "FooBar.m4v" -c copy -f flv rtmp://stream.example.com/foo/bar
```

View File

@@ -1,66 +1,5 @@
#!/usr/bin/env pwsh #!/bin/pwsh
if (!(Get-Command "go.exe" -ErrorAction SilentlyContinue)) echo "'go@$Env:WEBI_TAG' is an alias for 'golang@$Env:WEBI_VERSION'"
{ IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
& "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" go curl.exe -fsSL "$Env:WEBI_HOST/golang@$Env:WEBI_VERSION" | powershell
# because we need git.exe to be available to golang immediately
$Env:PATH = "$Env:USERPROFILE\go\bin;$Env:USERPROFILE\.local\opt\go\bin;$Env:PATH"
}
# Special to go: re-run all go tooling builds
echo "Building go language tools..."
echo ""
echo godoc
& go install golang.org/x/tools/cmd/godoc@latest
echo ""
echo gopls
& go install golang.org/x/tools/gopls@latest
echo ""
echo guru
& go install golang.org/x/tools/guru@latest
echo ""
echo golint
& go install golang.org/x/lint/golint@latest
#echo ""
#echo errcheck
#& go install github.com/kisielk/errcheck
#echo ""
#echo gotags
#& go install github.com/jstemmer/gotags
echo ""
echo goimports
& go install golang.org/x/tools/cmd/goimports@latest
echo ""
echo gomvpkg
& go install golang.org/x/tools/cmd/gomvpkg@latest
echo ""
echo gorename
& go install golang.org/x/tools/cmd/gorename
echo ""
echo gotype
& go install golang.org/x/tools/cmd/gotype
echo ""
echo stringer
& go install golang.org/x/tools/cmd/stringer
echo ""
# literal %USERPROFILE% on purpose
echo 'Installed go "x" tools to GOBIN=%USERPROFILE%/go/bin'
echo ""
echo "Suggestion: Also check out these great productivity multipliers:"
echo ""
echo " - vim-essentials (sensible defaults for vim)"
echo " - vim-go (golang linting, etc)"
echo ""

View File

@@ -3,7 +3,9 @@ set -e
set -u set -u
__run_go_essentials() { __run_go_essentials() {
if command -v go 2> /dev/null; then WEBI__GO_ESSENTIALS='true'
export WEBI__GO_ESSENTIALS
if [ -z "${WEBI__GO_INSTALL-}" ]; then
"$HOME/.local/bin/webi" "golang@${WEBI_TAG}" "$HOME/.local/bin/webi" "golang@${WEBI_TAG}"
fi fi
@@ -73,9 +75,6 @@ __run_go_essentials() {
go "${my_install}" golang.org/x/tools/cmd/stringer@latest > /dev/null #2>/dev/null go "${my_install}" golang.org/x/tools/cmd/stringer@latest > /dev/null #2>/dev/null
echo "" echo ""
# literal $HOME on purpose
# shellcheck disable=SC2016
echo 'Installed go "x" tools to GOBIN=$HOME/go/bin'
printf '\n' printf '\n'
printf 'Suggestion: Also check out these great productivity multipliers:\n' printf 'Suggestion: Also check out these great productivity multipliers:\n'

View File

@@ -1,89 +1,11 @@
--- ---
title: Go title: Go (golang alias)
homepage: https://golang.org homepage: https://webinstall.dev/golang
tagline: | tagline: |
Go makes it easy to build simple, reliable, and efficient software. Alias for https://webinstall.dev/golang
alias: golang
description: |
See https://webinstall.dev/golang
--- ---
To update or switch versions, run `webi go@stable` (or `@v1.21`, `@beta`, etc). Alias for https://webinstall.dev/golang
### Files
```text
~/.config/envman/PATH.env
~/.local/opt/go/
~/go/
```
## Cheat Sheet
> Go is designed, through and through, to make Software Engineering easy. It's
> fast, efficient, reliable, and something you can learn in a weekend.
>
> If you subscribe to
> [_The Zen of Python_](https://www.python.org/dev/peps/pep-0020/), you'll
> [love](https://go-proverbs.github.io/) >
> [Go](https://www.youtube.com/watch?v=PAAkCSZUG1c).
You may also want to install the Go IDE tooling:
[go-essentials](/go-essentials).
### Hello World
1. Make and enter your project directory
```sh
mkdir -p ./hello/cmd/hello
pushd ./hello/
```
2. Initialize your `go.mod` to your _git repository_ url:
```sh
go mod init github.com/example/hello
```
3. Create a `hello.go`
```sh
cat << EOF >> ./cmd/hello/hello.go
package main
import (
"fmt"
)
func main () {
fmt.Println("Hello, World!")
}
EOF
```
4. Format, build, and run your `./hello`
```sh
go fmt ./...
go build -o hello ./cmd/hello/
./hello
```
You should see your output:
```text
> Hello, World!
```
### How to run a Go program as a service
On Linux:
```sh
# Install serviceman (compatible with systemd)
webi serviceman
```
```sh
# go into your programs 'opt' directory
pushd ./hello/
# swap 'hello' and './hello' for the name of your project and binary
sudo env PATH="$PATH" \
serviceman add --system --username "$(whoami)" --name hello -- \
./hello
# Restart the logging service
sudo systemctl restart systemd-journald
```

View File

@@ -1,63 +1,5 @@
#!/usr/bin/env pwsh #!/bin/pwsh
$pkg_cmd_name = "go" echo "'go@$Env:WEBI_TAG' is an alias for 'golang@$Env:WEBI_VERSION'"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE" curl.exe -fsSL "$Env:WEBI_HOST/golang@$Env:WEBI_VERSION" | powershell
$pkg_src = "$Env:USERPROFILE\.local\opt\$pkg_cmd_name-v$Env:WEBI_VERSION"
$pkg_dst = "$Env:USERPROFILE\.local\opt\$pkg_cmd_name"
$pkg_dst_cmd = "$pkg_dst\bin\$pkg_cmd_name"
$pkg_dst_bin = "$pkg_dst\bin"
if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue))
{
& "$Env:USERPROFILE\.local\bin\webi-pwsh.ps1" git
# because we need git.exe to be available to golang immediately
$Env:PATH = "$Env:USERPROFILE\.local\opt\git\cmd;$Env:PATH"
}
# Fetch archive
IF (!(Test-Path -Path "$pkg_download"))
{
echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src"))
{
echo "Installing $pkg_cmd_name"
# TODO: temp directory
# Enter opt
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path "$pkg_cmd_name*" -Recurse -ErrorAction Ignore
# Unpack archive
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "New Name: $pkg_cmd_name-v$Env:WEBI_VERSION"
Get-ChildItem "$pkg_cmd_name*" | Select -f 1 | Rename-Item -NewName "$pkg_cmd_name-v$Env:WEBI_VERSION"
echo "New Location: $pkg_src"
Move-Item -Path "$pkg_cmd_name-v$Env:WEBI_VERSION" -Destination "$Env:USERPROFILE\.local\opt"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst' from '$pkg_src'"
Remove-Item -Path "$pkg_dst" -Recurse -ErrorAction Ignore
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
IF (!(Test-Path -Path go\bin)) { New-Item -Path go\bin -ItemType Directory -Force | out-null }
# Add to path
webi_path_add ~/.local/opt/go/bin
# Special to go: add default GOBIN to PATH
webi_path_add ~/go/bin

View File

@@ -2,61 +2,10 @@
set -e set -e
set -u set -u
GOBIN="${HOME}/go" __redirect_alias_golang() {
GOBIN_REAL="${HOME}/.local/opt/go-bin-v${WEBI_VERSION}" echo "'go@${WEBI_TAG:-stable}' is an alias for 'golang@${WEBI_VERSION-}'"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
# The package is 'golang', but the command is 'go' curl -fsSL "$WEBI_HOST/golang@${WEBI_VERSION-}" | sh
pkg_cmd_name="go"
# NOTE: pkg_* variables can be defined here
# pkg_cmd_name
# pkg_src, pkg_src_bin, pkg_src_cmd
# pkg_dst, pkg_dst_bin, pkg_dst_cmd
#
# Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages
pkg_get_current_version() {
# 'go version' has output in this format:
# go version go1.14.2 darwin/amd64
# This trims it down to just the version number:
# 1.14.2
go version 2> /dev/null |
head -n 1 |
cut -d' ' -f3 |
sed 's:go::'
} }
pkg_format_cmd_version() { __redirect_alias_golang
# 'go v1.14.0' will be 'go1.14'
my_version=$(echo "$1" | sed 's:\.0::g')
echo "${pkg_cmd_name}${my_version}"
}
pkg_link() {
# 'pkg_dst' will default to $HOME/.local/opt/go
# 'pkg_src' will be the installed version, such as to $HOME/.local/opt/go-v1.14.2
rm -rf "$pkg_dst"
ln -s "$pkg_src" "$pkg_dst"
# Go has a special $GOBIN
# 'GOBIN' is set above to "${HOME}/go"
# 'GOBIN_REAL' will be "${HOME}/.local/opt/go-bin-v${WEBI_VERSION}"
rm -rf "$GOBIN"
mkdir -p "$GOBIN_REAL/bin"
ln -s "$GOBIN_REAL" "$GOBIN"
}
pkg_post_install() {
pkg_link
# web_path_add is defined in _webi/template.sh at https://github.com/webinstall/packages
# Updates PATH with
# "$HOME/.local/opt/go"
webi_path_add "$pkg_dst_bin"
webi_path_add "$GOBIN/bin"
}
pkg_done_message() {
echo "Installed 'go v$WEBI_VERSION' to ~/.local/opt/go"
}

View File

@@ -1,11 +0,0 @@
---
title: Golang Essentials (go-essentials alias)
homepage: https://webinstall.dev/go-essentials
tagline: |
Alias for https://webinstall.dev/go-essentials
alias: go-essentials
description: |
See https://webinstall.dev/go-essentials
---
Alias for https://webinstall.dev/go-essentials

View File

@@ -1,5 +0,0 @@
#!/bin/pwsh
echo "'go@$Env:WEBI_TAG' is an alias for 'golang@$Env:WEBI_VERSION'"
IF ($Env:WEBI_HOST -eq $null -or $Env:WEBI_HOST -eq "") { $Env:WEBI_HOST = "https://webinstall.dev" }
curl.exe -fsSL "$Env:WEBI_HOST/golang@$Env:WEBI_VERSION" | powershell

View File

@@ -1,11 +0,0 @@
#!/bin/sh
set -e
set -u
__redirect_alias_golang() {
echo "'go@${WEBI_TAG:-stable}' is an alias for 'golang@${WEBI_VERSION-}'"
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL "$WEBI_HOST/golang@${WEBI_VERSION-}" | sh
}
__redirect_alias_golang

View File

@@ -3,14 +3,9 @@ title: Go
homepage: https://golang.org homepage: https://golang.org
tagline: | tagline: |
Go makes it easy to build simple, reliable, and efficient software. Go makes it easy to build simple, reliable, and efficient software.
alias: go
description: |
See https://webinstall.dev/go
--- ---
Alias for <https://webinstall.dev/go>. To update or switch versions, run `webi golang@stable` (or `@v1.19`, `@beta`,
To update or switch versions, run `webi go@stable` (or `@v1.21`, `@beta`,
etc). etc).
### Files ### Files

View File

@@ -17,6 +17,15 @@ if (!(Get-Command "git.exe" -ErrorAction SilentlyContinue))
$Env:PATH = "$Env:USERPROFILE\.local\opt\git\cmd;$Env:PATH" $Env:PATH = "$Env:USERPROFILE\.local\opt\git\cmd;$Env:PATH"
} }
Write-Host '' -ForegroundColor red -BackgroundColor white
Write-Host '*********************' -ForegroundColor red -BackgroundColor white
Write-Host '* BREAKING CHANGE *' -ForegroundColor red -BackgroundColor white
Write-Host '*********************' -ForegroundColor red -BackgroundColor white
Write-Host '' -ForegroundColor red -BackgroundColor white
Write-Host ' ''webi golang'' will NOT install go tooling starting with go1.21+' -ForegroundColor red -BackgroundColor white
Write-Host ' use ''webi go-essentials'' to preserve the previous behavior' -ForegroundColor red -BackgroundColor white
Write-Host '' -ForegroundColor red -BackgroundColor white
# Fetch archive # Fetch archive
IF (!(Test-Path -Path "$pkg_download")) IF (!(Test-Path -Path "$pkg_download"))
{ {
@@ -56,6 +65,25 @@ Remove-Item -Path "$pkg_dst" -Recurse -ErrorAction Ignore
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
IF (!(Test-Path -Path go\bin)) { New-Item -Path go\bin -ItemType Directory -Force | out-null } IF (!(Test-Path -Path go\bin)) { New-Item -Path go\bin -ItemType Directory -Force | out-null }
# Special to go: re-run all go tooling builds
echo "Building go language tools..."
echo gopls
& "$pkg_dst_cmd" install golang.org/x/tools/gopls
echo golint
& "$pkg_dst_cmd" install golang.org/x/lint/golint
echo errcheck
& "$pkg_dst_cmd" install github.com/kisielk/errcheck
echo gotags
& "$pkg_dst_cmd" install github.com/jstemmer/gotags
echo goimports
& "$pkg_dst_cmd" install golang.org/x/tools/cmd/goimports
echo gorename
& "$pkg_dst_cmd" install golang.org/x/tools/cmd/gorename
echo gotype
& "$pkg_dst_cmd" install golang.org/x/tools/cmd/gotype
echo stringer
& "$pkg_dst_cmd" install golang.org/x/tools/cmd/stringer
# Add to path # Add to path
webi_path_add ~/.local/opt/go/bin webi_path_add ~/.local/opt/go/bin

View File

@@ -15,6 +15,19 @@ pkg_cmd_name="go"
# #
# Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages # Their defaults are defined in _webi/template.sh at https://github.com/webinstall/packages
if [ -z "${WEBI__GO_ESSENTIALS-}" ]; then
# TODO nix for go1.21+
echo >&2 ""
printf >&2 '\e[31m%s:\e[0m\n' '#####################'
printf >&2 '\e[31m%s:\e[0m\n' '# BREAKING CHANGE #'
printf >&2 '\e[31m%s:\e[0m\n' '#####################'
echo >&2 ""
printf >&2 "\e[31m 'webi golang' will NOT install go tooling starting with go1.21+\e[0m\n"
printf >&2 "\e[31m use 'webi go-essentials' to preserve the previous behavior\e[0m\n"
echo >&2 ""
sleep 4
fi
pkg_get_current_version() { pkg_get_current_version() {
# 'go version' has output in this format: # 'go version' has output in this format:
# go version go1.14.2 darwin/amd64 # go version go1.14.2 darwin/amd64
@@ -55,8 +68,18 @@ pkg_post_install() {
# "$HOME/.local/opt/go" # "$HOME/.local/opt/go"
webi_path_add "$pkg_dst_bin" webi_path_add "$pkg_dst_bin"
webi_path_add "$GOBIN/bin" webi_path_add "$GOBIN/bin"
if [ -z "${WEBI__GO_ESSENTIALS-}" ]; then
# TODO nix for go1.21+
WEBI__GO_INSTALL='true'
export WEBI__GO_INSTALL
"$HOME/.local/bin/webi" "go-essentials@${WEBI_TAG}"
fi
} }
pkg_done_message() { pkg_done_message() {
echo "Installed 'go v$WEBI_VERSION' to ~/.local/opt/go" echo "Installed 'go v$WEBI_VERSION' to ~/.local/opt/go"
# note: literal $HOME on purpose
#shellcheck disable=SC2016
echo 'Installed go "x" tools to GOBIN=$HOME/go/bin'
} }

View File

@@ -1,23 +1,15 @@
--- ---
title: LSDeluxe title: LSDeluxe
homepage: https://github.com/lsd-rs/lsd homepage: https://github.com/Peltoche/lsd
tagline: | tagline: |
LSDeluxe: next gen ls command LSDeluxe: next gen ls command
--- ---
To update or switch versions, run `webi lsd@stable` (or `@v0.20`, `@beta`, etc). To update or switch versions, run `webi lsd@stable` (or `@v0.20`, `@beta`, etc).
### Files
```text
~/.config/envman/PATH.env
~/.config/lsd/config.yaml
~/.local/bin/lsd
```
## Cheat Sheet ## Cheat Sheet
![](https://raw.githubusercontent.com/lsd-rs/lsd/assets/screen_lsd.png) ![](https://raw.githubusercontent.com/Peltoche/lsd/assets/screen_lsd.png)
> `lsd` is a modern, cross-platform, drop-in replacement for `ls`. It does > `lsd` is a modern, cross-platform, drop-in replacement for `ls`. It does
> everything that you expect it to, plus modern extras that you can check out > everything that you expect it to, plus modern extras that you can check out
@@ -54,16 +46,6 @@ alias lsd=lsd --icon=never --color=never
lsd lsd
``` ```
(you may also enjoy [`aliasman`](../aliasman/))
Or update the config file:
`~/.config/lsd/config.yaml`
```yaml
classic: true
```
### How to alias as `ls`, `ll`, `la`, etc ### How to alias as `ls`, `ll`, `la`, etc
This will affect the interactive shell, but not scripts. This will affect the interactive shell, but not scripts.
@@ -110,14 +92,8 @@ Or manually update your `.bashrc`, `.zshrc`, or `.profile`
alias tree="lsd -AF --tree" alias tree="lsd -AF --tree"
``` ```
And when you want to use GNU `tree` you can escape the alias in some shells: And when you want to use GNU `tree`, just escape the alias:
```sh ```sh
\tree \tree
``` ```
Or use the full path:
```sh
/bin/tree
```

View File

@@ -1,13 +1,13 @@
'use strict'; 'use strict';
var github = require('../_common/github.js'); var github = require('../_common/github.js');
var owner = 'lsd-rs'; var owner = 'Peltoche';
var repo = 'lsd'; var repo = 'lsd';
module.exports = function (request) { module.exports = function (request) {
return github(request, owner, repo).then(function (all) { return github(request, owner, repo).then(function (all) {
all.releases = all.releases.filter(function (rel) { all.releases = all.releases.filter(function (rel) {
return !/(-msvc\.)|(\.deb$)/.test(rel.name); return !/(-musl\.)|(-msvc\.)|(\.deb$)/.test(rel.name);
}); });
return all; return all;
}); });

View File

@@ -1,22 +1,14 @@
'use strict'; 'use strict';
// https://blog.risingstack.com/update-nodejs-8-end-of-life-no-support/ // Map from node conventions to webinstall conventions
// 6 mos "current" + 18 mos LTS "active" + 12 mos LTS "maintenance" var map = {
//var endOfLife = 3 * 366 * 24 * 60 * 60 * 1000; // OSes
// If there have been no updates in 12 months, it's almost certainly end-of-life osx: 'macos',
const END_OF_LIFE = 366 * 24 * 60 * 60 * 1000;
// OSes
let osMap = {
osx: 'macos', // NOTE: filename is 'darwin'
linux: 'linux', linux: 'linux',
win: 'windows', // windows win: 'windows', // windows
sunos: 'sunos', sunos: 'sunos',
aix: 'aix', aix: 'aix',
}; // CPU architectures
// CPU architectures
let archMap = {
x64: 'amd64', x64: 'amd64',
x86: 'x86', x86: 'x86',
ppc64: 'ppc64', ppc64: 'ppc64',
@@ -25,150 +17,124 @@ let archMap = {
armv7l: 'armv7l', armv7l: 'armv7l',
armv6l: 'armv6l', armv6l: 'armv6l',
s390x: 's390x', s390x: 's390x',
// file extensions
pkg: 'pkg',
exe: 'exe',
msi: 'msi',
'7z': '7z',
zip: 'zip',
tar: 'tar.gz',
}; };
// file extensions function getAllReleases(request) {
let pkgMap = { return request({
pkg: ['pkg'], url: 'https://nodejs.org/dist/index.json',
//exe: ['exe'], // disable
'7z': ['7z'],
zip: ['zip'],
tar: ['tar.gz', 'tar.xz'],
// oddity - no os in download
msi: ['msi'],
// oddity - no pkg info
musl: ['tar.gz', 'tar.xz'],
};
async function getAllReleases(request) {
let all = {
releases: [],
download: '',
};
/*
[
{
"version":"v20.3.1",
"date":"2023-06-20",
"files":["headers","linux-armv6l","linux-x64-musl","linux-x64-pointer-compression"],
"npm":"9.6.7",
"v8":"11.3.244.8",
"uv":"1.45.0",
"zlib":"1.2.13.1-motley",
"openssl":"3.0.9+quic",
"modules":"115",
"lts":false,
"security":true
},
]
*/
// Alternate: 'https://nodejs.org/dist/index.json',
let baseUrl = `https://nodejs.org/download/release`;
let officialP = request({
url: `${baseUrl}/index.json`,
json: true, json: true,
}).then(function (resp) { }).then(function (resp) {
transform(baseUrl, resp.body); var rels = resp.body;
return; var all = {
}); releases: [],
download: '', // node's download URLs are unpredictable
};
let unofficialBaseUrl = `https://unofficial-builds.nodejs.org/download/release`; // https://blog.risingstack.com/update-nodejs-8-end-of-life-no-support/
let unofficialP = request({ // 6 mos "current" + 18 mos LTS "active" + 12 mos LTS "maintenance"
url: `${unofficialBaseUrl}/index.json`, //var endOfLife = 3 * 366 * 24 * 60 * 60 * 1000;
json: true, // If there have been no updates in 12 months, it's almost certainly end-of-life
}) var endOfLife = 366 * 24 * 60 * 60 * 1000;
.then(function (resp) {
transform(unofficialBaseUrl, resp.body);
return;
})
.catch(function (err) {
console.error('failed to fetch unofficial-builds');
console.error(err);
});
function transform(baseUrl, builds) { rels.forEach(function (rel) {
builds.forEach(function (build) { if (Date.now() - new Date(rel.date).valueOf() > endOfLife) {
let buildDate = new Date(build.date).valueOf();
let age = Date.now() - buildDate;
let maintained = age < END_OF_LIFE;
if (!maintained) {
return; return;
} }
rel.files.forEach(function (file) {
let lts = false !== build.lts;
// skip 'v'
let vparts = build.version.slice(1).split('.');
let major = parseInt(vparts[0], 10);
let channel = 'stable';
let isEven = 0 === major % 2;
if (!isEven) {
channel = 'beta';
}
build.files.forEach(function (file) {
if ('src' === file || 'headers' === file) { if ('src' === file || 'headers' === file) {
return; return;
} }
var parts = file.split(/-/);
let fileParts = file.split('-'); var os = map[parts[0]];
if (!os) {
let osPart = fileParts[0]; console.warn('node versions: unknown os "%s"', parts[0]);
let os = osMap[osPart];
let archPart = fileParts[1];
let arch = archMap[archPart];
let pkgPart = fileParts[2];
let pkgs = pkgMap[pkgPart];
if (!pkgPart) {
pkgs = pkgMap.tar;
} }
if (!pkgs?.length) { var arch = map[parts[1]];
if (!arch) {
console.warn('node versions: unknown arch "%s"', parts[1]);
}
var ext = map[parts[2] || 'tar'];
if (!ext) {
console.warn('node versions: unknown ext "%s"', parts[2]);
}
if ('exe' === ext) {
// node exe files are not self-extracting installers
return; return;
} }
let extra = ''; var even = 0 === rel.version.slice(1).split('.')[0] % 2;
let muslNative; var r = {
if (fileParts[2] === 'musl') { // nix leading 'v'
extra = '-musl'; version: rel.version.slice(1),
muslNative = true; date: rel.date,
lts: !!rel.lts,
// historically odd releases have been beta and even have been stable
channel: even ? 'stable' : 'beta',
os: os,
arch: arch,
ext: ext,
//sha1: '',
// See https://nodejs.org/dist/v14.0.0/
// usually like https://nodejs.org/dist/v14.0.0/node-{version}-{plat}-{arch}.{ext}
download:
'https://nodejs.org/dist/' + rel.version + '/node-' + rel.version,
};
all.releases.push(r);
// handle all the special cases (which there are many)
if ('pkg' === ext) {
r.download += '.pkg';
return;
}
if ('msi' === ext) {
if ('amd64' === arch) {
r.download += '-x64.msi';
} else {
r.download += '-x86.msi';
}
return;
} }
pkgs.forEach(function (pkg) { if ('macos' === os) {
if (osPart === 'osx') { r.download += '-darwin';
osPart = 'darwin'; } else if ('windows' === os) {
} r.download += '-win';
} else {
r.download += '-' + os;
}
let filename = `node-${build.version}-${osPart}-${archPart}${extra}.${pkg}`; if ('amd64' === arch) {
if ('msi' === pkg) { r.download += '-x64';
filename = `node-${build.version}-${archPart}${extra}.${pkg}`; } else {
} r.download += '-' + arch;
let downloadUrl = `${baseUrl}/${build.version}/${filename}`; }
let release = { if ('aix' === os) {
name: filename, r.download += '.tar.gz';
version: build.version, return;
lts: lts, }
channel: channel,
date: build.date,
os: os,
arch: arch,
ext: pkg,
download: downloadUrl,
_musl_native: muslNative,
};
all.releases.push(release); r.download += '.' + ext;
});
if ('tar.gz' === ext) {
r.download = r.download.replace(/\.tar\.gz$/, '.tar.xz');
r.ext = 'tar.xz';
all.releases.push(JSON.parse(JSON.stringify(r)));
r.download = r.download.replace(/\.tar\.xz$/, '.tar.gz');
r.ext = 'tar.gz';
}
}); });
}); });
}
await officialP; return all;
await unofficialP; });
return all;
} }
module.exports = getAllReleases; module.exports = getAllReleases;

View File

@@ -6,7 +6,7 @@ __install_ssh_adduser() {
# ssh-adduser # ssh-adduser
rm -f "$HOME/.local/bin/ssh-adduser" rm -f "$HOME/.local/bin/ssh-adduser"
webi_download \ webi_download \
"$WEBI_HOST/packages/ssh-adduser/ssh-adduser" \ "$WEBI_HOST/packages/ssh-adduser/ssh-adduser.sh" \
"$HOME/.local/bin/ssh-adduser" "$HOME/.local/bin/ssh-adduser"
chmod a+x "$HOME/.local/bin/ssh-adduser" chmod a+x "$HOME/.local/bin/ssh-adduser"

View File

@@ -3,14 +3,18 @@ set -e
set -u set -u
__install_ssh_pubkey() { __install_ssh_pubkey() {
rm -f "$HOME/.local/bin/ssh-pubkey" my_cmd="ssh-pubkey"
rm -f "$HOME/.local/bin/${my_cmd}"
webi_download \ webi_download \
"$WEBI_HOST/packages/ssh-pubkey/ssh-pubkey" \ "$WEBI_HOST/packages/${my_cmd}/${my_cmd}.sh" \
"$HOME/.local/bin/ssh-pubkey" "$HOME/.local/bin/${my_cmd}"
chmod a+x "$HOME/.local/bin/ssh-pubkey"
chmod a+x "$HOME/.local/bin/${my_cmd}"
# run the command # run the command
"$HOME/.local/bin/ssh-pubkey" "$HOME/.local/bin/${my_cmd}"
} }
__install_ssh_pubkey __install_ssh_pubkey

View File

@@ -3,13 +3,20 @@ set -e
set -u set -u
__install_ssh_setpass() { __install_ssh_setpass() {
rm -f "$HOME/.local/bin/ssh-setpass" my_cmd="ssh-setpass"
webi_download \
"$WEBI_HOST/packages/ssh-setpass/ssh-setpass" \
"$HOME/.local/bin/ssh-setpass"
chmod a+x "$HOME/.local/bin/ssh-setpass"
"$HOME/.local/bin/ssh-setpass" --help rm -f "$HOME/.local/bin/${my_cmd}"
webi_download \
"$WEBI_HOST/packages/${my_cmd}/${my_cmd}.sh" \
"$HOME/.local/bin/${my_cmd}"
chmod a+x "$HOME/.local/bin/${my_cmd}"
# run the command
echo ''
echo 'Set passphrase for ~/.ssh/id_rsa?'
"$HOME/.local/bin/${my_cmd}"
} }
__install_ssh_setpass __install_ssh_setpass

View File

@@ -1,55 +0,0 @@
#!/bin/sh
set -e
set -u
fn_usage() { (
echo ""
echo "USAGE"
echo " ssh-setpass [ssh-key-file]"
echo ""
echo "EXAMPLE"
echo " ssh-setpass ~/.ssh/id_rsa"
echo " OR"
echo " ssh-keygen -p -f ~/.ssh/id_rsa"
echo ""
); }
fn_grep_keyfiles() { (
grep -r -- '-----BEGIN' ~/.ssh 2> /dev/null |
cut -d: -f1 |
sort -u ||
true |
while read -r my_keyfile; do
echo " ${my_keyfile}"
done
); }
main() {
my_key="${1:-"${HOME}/.ssh/id_rsa"}"
if test "{my_key}" = "help" ||
test "{my_key}" = "--help"; then
fn_usage
return 0
fi
if ! test -e "${my_key}"; then
{
echo ""
echo "ERROR"
echo " '${my_key}' not found"
echo ""
echo "KEYS FOUND"
if ! fn_list_keyfiles; then
echo " (none)"
fi
} >&2
return 1
fi
ssh-keygen -p -f "${my_key}"
}
main "${1-}"

View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -e
set -u
main() {
my_key="${1:-"${HOME}/.ssh/id_rsa"}"
ssh-keygen -p -f "${my_key}"
}
main "${1-}"

View File

@@ -11,19 +11,19 @@ __install_ssh_utils() {
rm -rf "$HOME/.local/bin/ssh-adduser" rm -rf "$HOME/.local/bin/ssh-adduser"
webi_download \ webi_download \
"$WEBI_HOST/packages/ssh-adduser/ssh-adduser" \ "$WEBI_HOST/packages/ssh-adduser/ssh-adduser.sh" \
"$HOME/.local/bin/ssh-adduser" "$HOME/.local/bin/ssh-adduser"
chmod a+x "$HOME/.local/bin/ssh-adduser" chmod a+x "$HOME/.local/bin/ssh-adduser"
rm -rf "$HOME/.local/bin/ssh-pubkey" rm -rf "$HOME/.local/bin/ssh-pubkey"
webi_download \ webi_download \
"$WEBI_HOST/packages/ssh-pubkey/ssh-pubkey" \ "$WEBI_HOST/packages/ssh-pubkey/ssh-pubkey.sh" \
"$HOME/.local/bin/ssh-pubkey" "$HOME/.local/bin/ssh-pubkey"
chmod a+x "$HOME/.local/bin/ssh-pubkey" chmod a+x "$HOME/.local/bin/ssh-pubkey"
rm -rf "$HOME/.local/bin/ssh-setpass" rm -rf "$HOME/.local/bin/ssh-setpass"
webi_download \ webi_download \
"$WEBI_HOST/packages/ssh-setpass/ssh-setpass" \ "$WEBI_HOST/packages/ssh-setpass/ssh-setpass.sh" \
"$HOME/.local/bin/ssh-setpass" "$HOME/.local/bin/ssh-setpass"
chmod a+x "$HOME/.local/bin/ssh-setpass" chmod a+x "$HOME/.local/bin/ssh-setpass"

View File

@@ -1 +0,0 @@
../ssh-adduser/ssh-adduser

1
ssh-utils/ssh-adduser.sh Symbolic link
View File

@@ -0,0 +1 @@
../ssh-adduser/ssh-adduser.sh

View File

@@ -1 +0,0 @@
../ssh-pubkey/ssh-pubkey

1
ssh-utils/ssh-pubkey.sh Symbolic link
View File

@@ -0,0 +1 @@
../ssh-pubkey/ssh-pubkey.sh

View File

@@ -1 +0,0 @@
../ssh-setpass/ssh-setpass

1
ssh-utils/ssh-setpass.sh Symbolic link
View File

@@ -0,0 +1 @@
../ssh-setpass/ssh-setpass.sh

View File

@@ -13,7 +13,6 @@ __rmrf_local() {
bat \ bat \
caddy \ caddy \
chromedriver \ chromedriver \
cmake \
comrak \ comrak \
curlie \ curlie \
delta \ delta \
@@ -107,7 +106,6 @@ __rmrf_local() {
bat \ bat \
caddy \ caddy \
chromedriver \ chromedriver \
cmake \
comrak \ comrak \
curlie \ curlie \
delta \ delta \
@@ -204,7 +202,6 @@ __test() {
bat \ bat \
caddy \ caddy \
chromedriver \ chromedriver \
cmake \
comrak \ comrak \
curlie \ curlie \
delta \ delta \

View File

@@ -10,19 +10,18 @@ let g:ale_lint_on_save = 1
let g:ale_virtualtext_cursor = 'current' let g:ale_virtualtext_cursor = 'current'
" These emojis go in the sidebar for errors and warnings " These emojis go in the sidebar for errors and warnings
" other considerations: '💥' '☢️' '⚡' '☠' '●' '.' '✘' '⚠️' " other considerations: '💥' '☢️' '⚡' '☠' '●' '.'
" Note: one- and two-byte characters are more compatible " Note: one- and two-byte characters are more compatible
let g:ale_sign_error = 'x' let g:ale_sign_error = ''
let g:ale_sign_warning = '!' let g:ale_sign_warning = '⚠️'
" show error count " show error count
function! LinterStatus() abort function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr('')) let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors let l:all_non_errors = l:counts.total - l:all_errors
" \ '%d⨉ %d⚠ ',
return l:counts.total == 0 ? 'OK' : printf( return l:counts.total == 0 ? 'OK' : printf(
\ '%dx %d! ', \ '%d %d ',
\ all_non_errors, \ all_non_errors,
\ all_errors \ all_errors
\) \)