Cross-platform—/bin/sh
;
cmd.exe
—scripts
library for: Windows; Linux; macOS; FreeBSD; SunOS; &etc.
See also libscript’s: WHY.md; ROADMAP.md; and IDEAS.md. For testing see TEST.md.
Finally, see the official website with generated cross-linked hosted libscript documentation @ https://verMan.io
OS support for:
Relocatable; no need to cd
into the scripts directory.
Library directory structure is super-readable and modular.
Plenty of guards everywhere—idempotency style—so scripts can be interdependent—and rerun—without worry.
Dockerfiles are generated. These are well optimised for Docker’s cache mechanism.
Example of generated files are found in the gen
directory.
Care is taken to use open-source alternatives. For example: Valkey [and Garnet for Windows] over Redis; and FerretDB over MongoDB.
Name | Parameters |
---|---|
Node.js | NODEJS_VERSION * |
Python | PYTHON_VERSION * |
Rust | RUST_VERSION * |
Name | Parameters |
---|---|
PostgreSQL | POSTGRESQL_VERSION †; POSTGRES_USER †;
POSTGRES_PASSWORD ‡; POSTGRES_PASSWORD_FILE ‡;
POSTGRES_HOST ; POSTGRES_DB † |
Valkey [Redis fork] |
Name | Parameters |
---|---|
nginx | VARS ‡ |
VARS
—if provided—must include SERVER_NAME
and: NGINX_FRAGMENT_CONF
; xor WWWROOT
with
optional WWWROOT_AUTOINDEX
; xor PROXY_PASS
with optional (PROXY_WEBSOCKETS
with optional
PROXY_WEBSOCKETS_ADVANCED
)./bin/sh
[this repo] targeting macOS; Linux (.deb, .rpm, .apk (Alpine
Linux) distributions); SunOS; *BSDs;
and cmd.exe
for Windows;Generally these scripts are extremely portable and could be used to benchmark and security-audit any:
All the aforementioned advantages, plus:
NOTE: You might want to manually set LIBSCRIPT_DATA_DIR
;
LIBSCRIPT_BUILD_DIR
; and
LIBSCRIPT_TOOLS_DIR
.
Run from the same directory as this README.md file. Alternatively, set
SCRIPT_NAME
to the correct install.sh
location
and run it anywhere.
$ # Replace `$(pwd)` if not in the 'libscript' directory.
$ export LIBSCRIPT_ROOT_DIR="$(pwd)"
$ # Disable all options (everything set to do-*not*-install)
$ . "${LIBSCRIPT_ROOT_DIR}"'/conf-no-all.env.sh'
$ # Enable installation of *just* Jupyter Hub
$ export JUPYTERHUB_INSTALL=1
$ # Set script location.
$ export SCRIPT_NAME="${LIBSCRIPT_ROOT_DIR}"'/install.sh'
$ . "${SCRIPT_NAME}"
See gen/env.sh
for options
that can be overridden by setting environment variables.
To simplify usage, a JSON file format is provided. See ./install.json for an example.
$ ./create_installer_from_json.sh -h
Create install scripts from JSON.
-a whether to install all dependencies (required AND optional)
-f filename
-o output folder (defaults to ./tmp)
-v verbosity (can be specified multiple times)
-b base images for docker (space seperated, default: "alpine:latest debian:bookworm-slim")
-h show help text
Which will create these files:
env.sh
; env.cmd
Default environment. When nothing preexists in your env, this sets everything to install.
false_env.sh
;
false_env.cmd
False environment. This sets everything to not install.
install_gen.sh
;
install_gen.cmd
The actual installation script. Execute this like so:
$ # Set script location. Change from `pwd` if 'install_gen.sh' isn't in current dir.
$ export LIBSCRIPT_ROOT_DIR="$(pwd)"
$ export SCRIPT_NAME="${LIBSCRIPT_ROOT_DIR}"'/install_gen.sh'
$ . "${SCRIPT_NAME}"
install_parallel_gen.sh
Parallel version of the above installation script. Execute same way.
For example, set POSTGRES_PASSWORD
to null
in the json like so:
{
"name": "POSTGRES",
"version": "17",
"env": "POSTGRES_URL",
"vars": {
"POSTGRES_USER": "rest_user",
"POSTGRES_PASSWORD": null,
"POSTGRES_DB": "rest_db",
"POSTGRES_PASSWORD_FILE": null
}
}
Then SET
or export
it manually before
execution of install_gen.sh
.
For debugging, you might want to run something like:
$ distro='debian' # or 'alpine'
$ docker build --file "${distro}"'.Dockerfile' --progress='plain' --no-cache --tag "${PWD##*/}":"${distro}" .
To make things more convenient, use this docker builder; setting
-i
to same as -o
of
./create_installer_from_json.sh
:
$ ./create_docker_builder.sh -h
Create Docker image builder scripts.
-p prefix ($DOCKER_IMAGE_PREFIX, default: "deploysh")
-s suffix ($DOCKER_IMAGE_SUFFIX, default: "-latest")
-i input directory (`cd`s if provided, defaults to current working directory; adds scripts here also)
-v verbosity (can be specified multiple times)
-h show help text
$ ./build_docker_images.sh -o ./tmp
$ cd ./tmp && sh ./docker_builder.sh
# or docker_builder_parallel.sh ^
Licensed under any of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.