/scripts-common

Common Linux scripts.

Primary LanguageShell

SINGLETON SD - SCRIPTS - COMMON

This project contains common Linux bash scripts.

The main repository is hosted in gitlab.com/singletonsd/scripts/common but it is automatically mirrored to github.com/singletonsd, github.com/patoperpetua and to gitlab.com/patoperpetua. If you are in the Github page it may occur that is not updated to the last version.

AVAILABLE SCRIPTS

BASH COMMON

It provides common options to reuse with a binary.

curl -s https://singletonsd.gitlab.io/scripts/common/latest/bash_common.sh | bash /dev/stdin -b="${BINARY_NAME}"

It contains the following options:

-b | --binary: binary to execute.
-h | --help: display help.
-o | --only: the name of the file or folder to test.

It can be downloaded by:

curl -o bash_common.sh -L https://singletonsd.gitlab.io/scripts/common/latest/bash_common.sh

BASH SCRIPT TEST

It tests bash script file(s) using shellcheck. It depends on common script, so to use it you need to have both in the same directory. Shellcheck must be installed in the host computer, follow this link to install (It contains the following options:

-h | --help: display help.
-o | --only: the name of the file or folder to test.

It can be downloaded by:

curl -o bash_common.sh -L https://singletonsd.gitlab.io/scripts/common/latest/bash_common.sh && \
curl -o bash_script_test.sh -L https://singletonsd.gitlab.io/scripts/common/latest/bash_script_test.sh

BASH SCRIPT TEST STANDALONE

It is the same script as bash script test but it contains everything in one file.

It can be downloaded by:

curl -o bash_script_test_standalone.sh -L https://singletonsd.gitlab.io/scripts/common/latest/bash_script_test_standalone.sh

COMMON HOOK INSTALLER

Script to install gitlab-ci checker and script checker as a git hook type pre-commit. It is use for common git projects that contains bash scripts and gitlab-ci.

It can be downloaded by:

curl -o common_hook_installer.sh -L https://singletonsd.gitlab.io/scripts/common/latest/common_hook_installer.sh

Or it can be installed in a repository by:

curl -s https://singletonsd.gitlab.io/scripts/common/latest/common_hook_installer.sh | bash /dev/stdin

BASH SCRIPT HOOK INSTALLER

Script to install gitlab-ci checker and script checker as a git hook type pre-commit. It is use for scripts git projects that contains bash scripts and gitlab-ci.

It can be downloaded by:

curl -o bash_script_hook_installer.sh -L https://singletonsd.gitlab.io/scripts/common/latest/bash_script_hook_installer.sh

Or it can be installed in a repository by:

curl -s https://singletonsd.gitlab.io/scripts/common/latest/bash_script_hook_installer.sh | bash /dev/stdin

DOWNLOAD

All scripts are available also inside a zip file under this url. Or you can execute the following to download:

mkdir -p binaries && \
curl -o binaries/scripts.zip -L https://singletonsd.gitlab.io/scripts/common/latest/scripts.zip && \
cd binaries && unzip scripts.zip && mv src/* . && rm -r src && rm -r scripts.zip && cd ..

GIT HOOK

BASH PROJECTS

For those projects that are bash based, you can setup shellcheck to be run before a commit. To do that just execute the following script under your git repository:

curl -s https://singletonsd.gitlab.io/scripts/common/latest/bash_script_test_hook_installer.sh | bash /dev/stdin

COMMON PROJECTS

For those projects that have bash scripts and/or make use of gitlab ci/cd but its main language is other than bash, you can setup shellcheck to be run before a commit. To do that just execute the following script under your git repository:

curl -s https://singletonsd.gitlab.io/scripts/common/latest/bash_script_common_hook_installer.sh | bash /dev/stdin

STRUCTURE

Master branch is setup as latest folder. To use an specific version, put the version name before the file name like:

https://singletonsd.gitlab.io/scripts/common/latest/bash_script_test_standalone.sh
https://singletonsd.gitlab.io/scripts/common/develop/bash_script_test_standalone.sh
https://singletonsd.gitlab.io/scripts/common/v0.0.2/bash_script_test_standalone.sh

DOCUMENTATION

TODO

  • Fix documentation.
  • Add script to download test script from gitlab pages.
  • Zip all scripts and put inside pages.
  • Create a docker image with all scripts inside.

© Singleton SD, Italy, 2019.