Ensures you can access your computer from anywhere in the world with a single command.
- In your other repo, include a file named:
.gitmodulesthat includes:
[submodule "dependencies/bash-package-installer"]
path = dependencies/bash-package-installer
url = https://github.com/hiveminds/bash-package-installer- Create a file named
install-dependencies.shwith content:
# Remove the submodules if they were still in the repo.
git rm --cached dependencies/bash-package-installer
# Remove and re-create the submodule directory.
rm -r "$SCRIPT_PATH/dependencies"/bash-package-installer
mkdir -p "$SCRIPT_PATH/dependencies"/bash-package-installer
# (Re) add the BATS submodules to this repository.
git submodule add --force https://github.com/hiveminds/bash-package-installer dependencies/bash-package-installer- Install the submodule with:
chmod +x install-dependencies.sh
./install-dependencies.shAfter including this dependency you can use the functions in this module like:
#!/bin/bash
# Source the file containing the functions
source "$(dirname "${BASH_SOURCE[0]}")/src/main.sh"
# Execute prerequisites installation.
install_tor_and_ssh_requirements
# Configure tor such that it starts now, and when the pc reboots.
configure_tor_to_start_at_bootThe 0 and 1 after the package name indicate whether it will update the
package manager afterwards (0 = no update, 1 = package manager update after
installation/removal)
Put your unit test files (with extension .bats) in folder: /test/
(Re)-install the required submodules with:
chmod +x install-bats-libs.sh
./install-bats-libs.shInstall:
sudo gem install bats
sudo apt install bats -y
sudo gem install bashcov
sudo apt install shfmt -y
pre-commit install
pre-commit autoupdateRun pre-commit with:
pre-commit run --allRun the tests with:
bats testIf you want to run particular tests, you could use the test.sh file:
chmod +x test.sh
./test.shbashcov bats test- Include bash code coverage in GitLab CI.
- Add additional (relevant) pre-commit hooks.
- Develop Bash documentation checks here, and add them to this pre-commit.