Skip to content

electrocucaracha/pkg-mgr_scripts

Repository files navigation

cURL package installer

License Docker Pulls GitHub Super-Linter

visitors Scc Code Badge Scc COCOMO Badge

This project pretends to centralize and facilitate the process to install and configure some Linux projects on major different Linux Distributions.

Why using curl instead of wget? Daniel Stenberg explains that curl works like a traditional Unix cat command and can do a single-shot transfer data

Why not using configuration management tools like Ansible, Puppet or Chef? These great tools require an initial installation step for its operation which results in additional undesired packages in the OS.

Supported distributions

Name Version
Ubuntu 16.04/18.04/20.04
CentOS 7/8
OpenSUSE Tumbleweed/Leap

How to use this script?

The install.sh bash script has been created to abstract the differences between different Linux distributions. For example, in order to install and configure Docker service the following instruction is needed:

curl -fsSL http://bit.ly/install_pkg | PKG="docker docker-compose" bash
flowchart TB
    A((start)) -- HTTP request --> B[bit.ly server redirects to raw.githubusercontent.com];
    B --> C[responds with the install script];
    C --> D[runs bash script];
    D --> E --> P;
    subgraph E [pkg-mgr_scripts/install.sh]
        direction TB
        F{is PKG_UPDATE set to `true`?};
        F -- yes --> G[runs `update_repos` function] --> H;
        F -- no --> H{does PKG_COMMANDS_LIST have values?};
        H -- yes --> I[collect PKG values];
        H -- no --> J;
        I --> J;
        subgraph J [`main` function]
            direction TB
            subgraph K [`_check_requirements` function]
                L[validates passwordless sudo];
            end
            L --> M[defines INSTALLER_CMD and PKG_OS_FAMILY vars];
            M --> N{is PKG defined?};
            N -- yes --> O[filters unsupported PKG values];
            N -- no --> Q;
            O --> P[executes INSTALLER_CMD + filtered PKG] --> Q;
        end
    end
    Q((end));

bit.ly/install_pkg redirects to the install script in this repository and the invocation above is equivalent to:

curl -fsSL https://raw.githubusercontent.com/electrocucaracha/pkg-mgr_scripts/master/install.sh | PKG="docker docker-compose" bash

Program environment variables

Name Description
PKG Package name(s) to be installed on the requester.(String value)
PKG_UPDATE Update package manager metadata information.(Boolean value)
PKG_DEBUG Enable verbose output during the execution.(Boolean value)

Bindep usage

The cURL package installer can be combined with bindep tool to perform multiOS installations. The following example demostrates how to install the Portable Hardware Locality tools in the current machine.

curl -fsSL http://bit.ly/install_pkg | PKG=bindep bash

cat << EOF > bindep.txt
hwloc [node]
hwloc-lstopo [node platform:suse]
EOF
curl -fsSL http://bit.ly/install_pkg | PKG="$(bindep node -b)" bash

lstopo-no-graphics

Or use the wrapper script provided to run in a single command

curl -fsSL http://bit.ly/install_bin | PKG_BINDEP_PROFILE=node bash

Installing multiple commands

It's also possible to install multiple command-line tools with a single cURL call. The following example will install docker, kind and kubectl commands.

curl -fsSL http://bit.ly/install_pkg | PKG_COMMANDS_LIST="docker,kind,kubectl" bash

About

Remote bash-based Linux package manager

Topics

Resources

Stars

Watchers

Forks

Languages