diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..d21eedd --- /dev/null +++ b/.codespellrc @@ -0,0 +1,9 @@ +[codespell] +builtin = clear,rare,names,code,en-GB_to_en-US +check-filenames = +context = 2 +enable-colors = true +quiet-level = 3 +# TODO Add _false positives_ to the ignore list below +# ignore-words-list = +skip = .extras,.git,.password-store,.venv,build,Pipfile diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1441d77 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.yaml] +indent_size = 2 +indent_style = space + +# kate: hl ini; diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..90a7687 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# TODO Provide GitHub names here... +# * @username1 @username2 ... diff --git a/.github/commit-message.template b/.github/commit-message.template new file mode 100644 index 0000000..cab0cef --- /dev/null +++ b/.github/commit-message.template @@ -0,0 +1,32 @@ + +#--------------------------------------------------------------------- +# Format for the commit title (the very first line) is the following: +# +# : (If applied, this commit will...) (max 72 chars) +# +# Where `` is one of the following: +# - build = Changes to the build system +# - ci = CI related changes (GH actions, hooks, ...) +# - docs = Changes to the documentation/manuals +# - feat = The commit introduces a new feature +# - fix = The commit fixes a bug/regression/typo +# - impr = The commit bring some improvements +# - misc = Other actions +# - package = Changes to the package produced +# - refactor = The commit performs a refactoring +# - release = The commit prepares a repo for release +# - style = The commit fixes formatting +# - testing = Changes to the tests or testing process +# - wip = Work In Progress +# +# About conventional commits: https://www.conventionalcommits.org +#--------------------------------------------------------------------- +# NOTE: Leave the next line empty to separate title from the body + +# Explain why this change is being made below... (max 120 chars per line) + + +# Optionally provide links or keys to any relevant tickets, articles or other resources. +# See also: https://confluence.atlassian.com/fisheye/using-smart-commits-960155400.html + +#---[Git inserted text goes blow]------------------------------------- diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..8477460 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,9 @@ +## Changes in this PR + + + + diff --git a/.github/workflows/pre-commit-check.yaml b/.github/workflows/pre-commit-check.yaml new file mode 100644 index 0000000..d224a53 --- /dev/null +++ b/.github/workflows/pre-commit-check.yaml @@ -0,0 +1,29 @@ +name: Checking `pre-commit` hooks + +on: + push: + branches: + - master + + pull_request: + branches: + - master + +jobs: + pr-checks: + name: Checking `pre-commit` hooks + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Check the `pre-commit` hook configuration presence + id: check_files + uses: andstor/file-existence-action@v1 + with: + files: .pre-commit-config.yaml + + - name: Checking configured hooks + if: steps.check_files.outputs.files_exists == 'true' + uses: pre-commit/action@v2.0.3 diff --git a/.github/workflows/pre-commit-update.yaml b/.github/workflows/pre-commit-update.yaml new file mode 100644 index 0000000..8305bf8 --- /dev/null +++ b/.github/workflows/pre-commit-update.yaml @@ -0,0 +1,32 @@ +name: Pre-commit auto-update + +on: + # every Sunday at midnight + schedule: + - cron: "0 0 * * 0" + # on demand + workflow_dispatch: + +jobs: + auto-update: + name: Checking `pre-commit` hooks updates + + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Prepare Python Environment + uses: actions/setup-python@v2 + + - name: Pre-installing requirements + uses: browniebroke/pre-commit-autoupdate-action@main + + - name: Create PR to Update configs + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update/pre-commit-hooks + title: 'misc: Version bump `pre-commit` hook plugins' + commit-message: 'misc: Version bump `pre-commit` hook plugins' + body: Update plugins of `pre-commit` hooks to latest version. diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..789d8a6 --- /dev/null +++ b/.gitlint @@ -0,0 +1,90 @@ +# All these sections are optional, edit this file as you like. +[general] +# Ignore certain rules, you can reference them by their id or by their full name +ignore=B6,T5 + +# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this +verbosity = 2 + +# By default gitlint will ignore merge commits. Set to 'false' to disable. +# ignore-merge-commits=true + +# By default gitlint will ignore fixup commits. Set to 'false' to disable. +# ignore-fixup-commits=true + +# By default gitlint will ignore squash commits. Set to 'false' to disable. +# ignore-squash-commits=true + +# Enable debug mode (prints more output). Disabled by default. +# debug=true + +# Set the extra-path where gitlint will search for user defined rules +# See http://jorisroovers.github.io/gitlint/user_defined_rules for details +# extra-path=examples/ + +# NOTE Enable https://www.conventionalcommits.org/en/v1.0.0/ specification +contrib=contrib-title-conventional-commits + +[title-max-length] +line-length=72 + +# [title-must-not-contain-word] +# Comma-separated list of words that should not occur in the title. Matching is case +# insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING" +# will not cause a violation, but "WIP: my title" will. +# words=wip + +# [title-match-regex] +# python like regex (https://docs.python.org/2/library/re.html) that the +# commit-msg title must be matched to. +# Note that the regex can contradict with other rules if not used correctly +# (e.g. title-must-not-contain-word). +#regex=^(\[[A-Z0-9]+-[0-9]+\]|(Build|Documentation|Feature|Fix|Improvement|Misc|Package|Refactor|Release|Style|Testing|WIP):) .*$ + +[B1] +# B1 = body-max-line-length +line-length=120 + +[body-min-length] +min-length=0 + +# [body-is-missing] +# Whether to ignore this rule on merge commits (which typically only have a title) +# default = False +# gnore-merge-commits=false + +# [body-changed-file-mention] +# List of files that need to be explicitly mentioned in the body when they are changed +# This is useful for when developers often erroneously edit certain files or git submodules. +# By specifying this rule, developers can only change the file when they explicitly reference +# it in the commit message. +# files=gitlint/rules.py,README.md + +# [author-valid-email] +# python like regex (https://docs.python.org/2/library/re.html) that the +# commit author email address should be matched to +# For example, use the following regex if you only want to allow email addresses from foo.com +# regex=[^@]+@foo.com + +# [ignore-by-title] +# Ignore certain rules for commits of which the title matches a regex +# E.g. Match commit titles that start with "Release" +# regex=^Release(.*) +# +# Ignore certain rules, you can reference them by their id or by their full name +# Use 'all' to ignore all rules +# ignore=T1,body-min-length + +# [ignore-by-body] +# Ignore certain rules for commits of which the body has a line that matches a regex +# E.g. Match bodies that have a line that that contain "release" +# regex=(.*)release(.*) +# +# Ignore certain rules, you can reference them by their id or by their full name +# Use 'all' to ignore all rules +# ignore=T1,body-min-length + +[contrib-title-conventional-commits] +types=build,ci,docs,feat,fix,impr,misc,refactor,release,style,testing,wip + +# kate: hl ini; diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1e31741 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,45 @@ +# Read the docs here: https://pre-commit.com and http://jorisroovers.github.io/gitlint/ +# Install hooks to your clone: +# $ pre-commit install --install-hooks +# and +# $ pre-commit install --install-hooks -t commit-msg + +default_stages: [commit] +fail_fast: false +repos: + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: check-case-conflict + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + + - repo: https://github.com/jorisroovers/gitlint + rev: v0.17.0 + hooks: + - id: gitlint + name: Commit message check + language: python + entry: gitlint --msg-filename + stages: [commit-msg] + + - repo: https://github.com/codespell-project/codespell + rev: v2.2.2 + hooks: + - id: codespell + + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.8.0 + hooks: + - id: shellcheck + args: ['--shell=bash', '--color=always'] + files: '\.sh$' + types: ['file', 'text'] + +# kate: indent-width 2; tab-width 2; diff --git a/wireguard-mikrotik.sh b/wireguard-mikrotik.sh index 8cec293..184a97f 100644 --- a/wireguard-mikrotik.sh +++ b/wireguard-mikrotik.sh @@ -42,7 +42,7 @@ function installWireGuard() { echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Oracle or Arch Linux system" exit 95 fi - + #? Install WireGuard tools and module if [[ ${OS} == 'ubuntu' ]] || [[ ${OS} == 'debian' && ${VERSION_ID} -gt 10 ]]; then apt-get update @@ -254,7 +254,7 @@ function newClient() { mkdir -p "$(pwd)/wireguard/${SERVER_WG_NIC}/client/${CLIENT_NAME}" >/dev/null 2>&1 HOME_DIR="$(pwd)/wireguard/${SERVER_WG_NIC}/client/${CLIENT_NAME}" - + # Create client file and add the server as a peer echo "[Interface] PrivateKey = ${CLIENT_PRIV_KEY} @@ -325,7 +325,7 @@ function manageMenu() { } #? Check for root, OS, WireGuard -installCheck +installCheck #? Check server exist serverName