Edited to reflect latest update to tools.func

Slaviša Arežina
2025-06-27 22:30:41 +02:00
parent e2f36c3ba0
commit 53d2bdd3f5
+37 -38
@@ -28,7 +28,7 @@ fetch_and_deploy_gh_release "owner/repository"
---
## `install_node_and_modules`
## `setup_nodejs`
This function automates the installation of a specified version of Node.js and a list of global Node modules on a Debian-based system. It ensures the desired Node.js version is installed (replacing any existing version if necessary) and installs or updates specified Node.js global modules.
@@ -36,7 +36,7 @@ This function automates the installation of a specified version of Node.js and a
### Description
`install_node_and_modules()`:
`setup_nodejs()`:
- Checks if Node.js is installed.
- If Node.js is installed but not the desired version, it replaces it.
@@ -48,13 +48,13 @@ This function automates the installation of a specified version of Node.js and a
### Usage
```bash
install_node_and_modules
setup_nodejs
```
to install the latest version of Node.js with no additional Modules.
If you want to define a specified Version and install Modules use something like this:
```bash
NODE_VERSION=20 NODE_MODULE="yarn@latest,@vue/cli-service@5.0.0" install_node_and_modules
NODE_VERSION=20 NODE_MODULE="yarn@latest,@vue/cli-service@5.0.0" setup_nodejs
```
### User-Configurable Variables
@@ -66,10 +66,10 @@ NODE_VERSION=20 NODE_MODULE="yarn@latest,@vue/cli-service@5.0.0" install_node_an
---
## `install_postgresql`
## `setup_postgresql`
### Description
`install_postgresql()`:
`setup_postgresql()`:
- Checks if Postgressql is installed.
- If Postgressql is installed but not the desired version, it replaces it.
@@ -78,12 +78,12 @@ NODE_VERSION=20 NODE_MODULE="yarn@latest,@vue/cli-service@5.0.0" install_node_an
### Usage
```bash
install_postgresql
setup_postgresql
```
Specifie a Version:
```bash
PG_VERSION=15 install_postgresql
PG_VERSION=15 setup_postgresql
```
### User-Configurable Variables
@@ -94,11 +94,11 @@ PG_VERSION=15 install_postgresql
---
## install_mariadb
## setup_mariadb
### Description
`install_mariadb()`:
`setup_mariadb()`:
- Detecting the current version of MariaDB (if installed)
- Upgrading to the latest version if needed
@@ -110,13 +110,13 @@ PG_VERSION=15 install_postgresql
### Usage
```bash
install_mariadb
setup_mariadb
```
You can optionally set the `MARIADB_VERSION` environment variable before calling the function to specify a particular version to install.
Example:
```bash
MARIADB_VERSION="10.11.6" install_mariadb
MARIADB_VERSION="10.11.6" setup_mariadb
```
If no version is specified, the script will automatically fetch and install the latest GA (Generally Available) version of MariaDB.
@@ -128,11 +128,11 @@ If no version is specified, the script will automatically fetch and install the
---
## install_mysql
## setup_mysql
### Description
`install_mysql()`:
`setup_mysql()`:
- Detecting if MySQL is already installed
- Replacing it with the specified version if it differs
@@ -144,12 +144,12 @@ If no version is specified, the script will automatically fetch and install the
### Usage
```bash
install_mysql
setup_mysql
```
To install a specific version of MySQL, export the `MYSQL_VERSION` variable before calling the function:
```bash
MYSQL_VERSION="5.7" install_mysql
MYSQL_VERSION="5.7" setup_mysql
```
### User-Configurable Variables
@@ -160,11 +160,11 @@ MYSQL_VERSION="5.7" install_mysql
---
## install_php
## setup_php
### Description
`install_php()`:
`setup_php()`:
- Detects the current PHP version and upgrades or switches if necessary.
- Adds the `sury.org` repository if not already configured.
- Installs the specified PHP version along with default and user-defined modules.
@@ -174,12 +174,12 @@ MYSQL_VERSION="5.7" install_mysql
### Usage
```bash
install_php
setup_php
```
You can set any of the environment variables below to customize the behavior:
```bash
PHP_VERSION="8.3" PHP_APACHE="YES" PHP_FPM="NO" PHP_MEMORY_LIMIT="1G" install_php
PHP_VERSION="8.3" PHP_APACHE="YES" PHP_FPM="NO" PHP_MEMORY_LIMIT="1G" setup_php
```
#### PHP Modules
@@ -189,7 +189,7 @@ bcmath, cli, curl, gd, intl, mbstring, opcache, readline, xml, zip
```
You can add custom modules with this command:
```bash
PHP_MODULE="mysql,redis" install_php
PHP_MODULE="mysql,redis" setup_php
```
### User-Configurable Variables
@@ -206,11 +206,11 @@ PHP_MODULE="mysql,redis" install_php
---
## install_composer
## setup_composer
### Description
`install_composer()`:
`setup_composer()`:
- Detects existing Composer installation and updates if necessary.
- Installs the latest version using the official installer.
- Ensures the Composer binary is executable system-wide.
@@ -221,16 +221,16 @@ PHP_MODULE="mysql,redis" install_php
Simply call the function:
```bash
install_composer
setup_composer
```
---
## install_go Bash
## setup_go
### Description
`install_go()`:
`setup_go()`:
- Detects system architecture (supports `x86_64` and `aarch64`).
- Automatically fetches the latest Go version (if `GO_VERSION` is unset or set to `latest`).
- Installs Go system-wide to `/usr/local/go`, and symlinks the binary to `/usr/local/bin/go`.
@@ -242,16 +242,16 @@ install_composer
Simply call the function:
```bash
install_go
setup_go
```
---
## install_java
## setup_java
### Description
`install_java()`:
`setup_java()`:
- Automatically adds the Adoptium APT repository if missing.
- Detects the currently installed version of the Temurin JDK (if any).
- Installs the desired JDK version (defaults to 21) or upgrades it if already present.
@@ -261,12 +261,12 @@ install_go
### Usage
```bash
install_java
setup_java
```
This will install the default version of Temurin JDK.
You can set the JAVA_VERSION environment variable before calling the function:
```bash
JAVA_VERSION=17 install_java
JAVA_VERSION=17 setup_java
```
### User-Configurable Variables
| Variable | Description | Default Value |
@@ -279,7 +279,7 @@ JAVA_VERSION=17 install_java
### Description
`install_mongodb()`:
`setup_mongodb()`:
- Detects the currently installed version of MongoDB.
- Removes older versions (packages only; **data is preserved**).
- Adds the correct MongoDB APT repository and GPG key.
@@ -287,17 +287,16 @@ JAVA_VERSION=17 install_java
- Starts and enables the MongoDB service.
### Usage
```bash
install_mongodb
setup_mongodb
```
Installs the default MongoDB version.
To install a different version (e.g., 7.0):
```bash
MONGO_VERSION=7.0 install_mongodb
MONGO_VERSION=7.0 setup_mongodb
```
### User-Configurable Variables
@@ -362,11 +361,11 @@ Checks and installs/updates Ghostscript.
### Usage
```bash
setup_rbenv_stack
setup_ruby
```
Optionally, you can override defaults by setting environment variables:
```bash
RUBY_VERSION=3.3.2 RUBY_INSTALL_RAILS=false setup_rbenv_stack
RUBY_VERSION=3.3.2 RUBY_INSTALL_RAILS=false setup_ruby
```
### User-Configurable Variables
| Variable | Description | Default Value |
@@ -379,7 +378,7 @@ RUBY_VERSION=3.3.2 RUBY_INSTALL_RAILS=false setup_rbenv_stack
### Description
`donwload_with_progress()`:
`download_with_progress()`:
- Installs `pv` if not already present.
- Attempts to retrieve the file size (`Content-Length`) from the HTTP headers.
- If `Content-Length` is available, it uses `pv` to show a progress bar during the download.