From 523bca2327a7ed08eef23261ca4df0c140602099 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Mon, 8 Jul 2024 17:26:34 +0200 Subject: [PATCH] fix: conform files to editorconfig specification --- .github/workflows/main.yaml | 4 ---- docs/SALT.md | 6 +++--- rpm_spec/qusal-dev.spec | 3 +++ rpm_spec/qusal-dotfiles.spec | 3 +++ rpm_spec/qusal-electrum.spec | 3 +++ rpm_spec/qusal-fetcher.spec | 4 ++-- rpm_spec/qusal-sys-cacher.spec | 6 +++--- rpm_spec/qusal-sys-ssh-agent.spec | 3 +++ salt/dom0/files/bin/qvm-mgmt | 7 +++---- salt/dom0/files/bin/qvm-port-forward | 6 +++--- salt/dom0/files/bin/qvm-screenshot | 6 ++++-- salt/fetcher/README.md | 4 ++-- salt/signal/README.md | 2 +- scripts/shell-lint.sh | 13 ++++++++----- scripts/spec-build.sh | 2 +- scripts/spec-gen.sh | 2 +- scripts/spec-get.sh | 9 +++++---- scripts/unicode-prohibit.sh | 2 +- 18 files changed, 49 insertions(+), 36 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c83ac9f..3ecbf75 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -45,17 +45,13 @@ jobs: - name: Install pip packages run: pip3 install $(cat dependencies/pip.txt) - uses: pre-commit/action@v3.0.1 - continue-on-error: true env: SPEC_VENDOR: Github Actions SPEC_PACKAGER: Github Actions - uses: editorconfig-checker/action-editorconfig-checker@main - name: Run Editorconfig Checker - continue-on-error: true run: editorconfig-checker - name: Lint commits - continue-on-error: true - # yamllint disable-line rule:line-length run: | if test "${{ github.event_name}}" = "pull_request" then diff --git a/docs/SALT.md b/docs/SALT.md index 7044b18..29f1c86 100644 --- a/docs/SALT.md +++ b/docs/SALT.md @@ -128,8 +128,8 @@ name: keys force: True {# Only run this state if the requirements are executed successfully #} require: - {# Ensure successful 'qvm.clone' run to create 'tpl-keys-clone' - This module was executed in the 'clone_template' macro #} + {# Ensure successful 'qvm.clone' run to create 'tpl-keys-clone' #} + {# This module was executed in the 'clone_template' macro #} - qvm: tpl-keys-clone {# If qube does not exist, create it with the specified settings #} present: @@ -157,7 +157,7 @@ features: - service.cups {# Set feature values, useful for string values #} - set: - {# Help GUI users find useful applications for this qube #} + {# Help GUI users find useful applications for this qube #} - menu-items: "org.keepassxc.KeepPassXC.desktop qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop" {# Stop loading to the 'defaults' variable #} {% endload %} diff --git a/rpm_spec/qusal-dev.spec b/rpm_spec/qusal-dev.spec index 2e783dc..43c3cff 100644 --- a/rpm_spec/qusal-dev.spec +++ b/rpm_spec/qusal-dev.spec @@ -116,6 +116,9 @@ fi %dnl TODO: missing '%ghost', files generated during %post, such as Qrexec policies. %changelog +* Mon Jul 08 2024 Ben Grande - f60077f +- doc: spell check + * Fri Jul 05 2024 Ben Grande - 34d2943 - fix: correct markdown lint package name diff --git a/rpm_spec/qusal-dotfiles.spec b/rpm_spec/qusal-dotfiles.spec index 4bcc8ab..ad02166 100644 --- a/rpm_spec/qusal-dotfiles.spec +++ b/rpm_spec/qusal-dotfiles.spec @@ -118,6 +118,9 @@ fi %dnl TODO: missing '%ghost', files generated during %post, such as Qrexec policies. %changelog +* Mon Jul 08 2024 Ben Grande - f60077f +- doc: spell check + * Thu Jul 04 2024 Ben Grande - 383c840 - doc: lint markdown files diff --git a/rpm_spec/qusal-electrum.spec b/rpm_spec/qusal-electrum.spec index ed4fc94..6bc8ca9 100644 --- a/rpm_spec/qusal-electrum.spec +++ b/rpm_spec/qusal-electrum.spec @@ -126,6 +126,9 @@ fi %dnl TODO: missing '%ghost', files generated during %post, such as Qrexec policies. %changelog +* Mon Jul 08 2024 Ben Grande - f60077f +- doc: spell check + * Thu Jul 04 2024 Ben Grande - 383c840 - doc: lint markdown files diff --git a/rpm_spec/qusal-fetcher.spec b/rpm_spec/qusal-fetcher.spec index fa6211e..be79c52 100644 --- a/rpm_spec/qusal-fetcher.spec +++ b/rpm_spec/qusal-fetcher.spec @@ -43,8 +43,8 @@ will be able to download from many protocol as long as the installed tools accepts them. Supported protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, - IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, - SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS, RSYNC, BitTorrent. +IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, +SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS, RSYNC, BitTorrent. %prep %setup -q diff --git a/rpm_spec/qusal-sys-cacher.spec b/rpm_spec/qusal-sys-cacher.spec index 9067a31..73d141f 100644 --- a/rpm_spec/qusal-sys-cacher.spec +++ b/rpm_spec/qusal-sys-cacher.spec @@ -130,6 +130,9 @@ fi %dnl TODO: missing '%ghost', files generated during %post, such as Qrexec policies. %changelog +* Mon Jul 08 2024 Ben Grande - f60077f +- doc: spell check + * Sat Jul 06 2024 Ben Grande - 8604887 - feat: unify cacher tag list to a single script @@ -276,6 +279,3 @@ fi * Wed Dec 20 2023 Ben Grande - 38d98ec - fix: nft shebang and table names - -* Wed Dec 20 2023 Ben Grande - d3ae662 -- fix: cacher client installation indentation diff --git a/rpm_spec/qusal-sys-ssh-agent.spec b/rpm_spec/qusal-sys-ssh-agent.spec index f4f6375..0a48889 100644 --- a/rpm_spec/qusal-sys-ssh-agent.spec +++ b/rpm_spec/qusal-sys-ssh-agent.spec @@ -120,6 +120,9 @@ fi %dnl TODO: missing '%ghost', files generated during %post, such as Qrexec policies. %changelog +* Mon Jul 08 2024 Ben Grande - f60077f +- doc: spell check + * Thu Jul 04 2024 Ben Grande - 383c840 - doc: lint markdown files diff --git a/salt/dom0/files/bin/qvm-mgmt b/salt/dom0/files/bin/qvm-mgmt index ccbf2fa..d706ce7 100755 --- a/salt/dom0/files/bin/qvm-mgmt +++ b/salt/dom0/files/bin/qvm-mgmt @@ -12,10 +12,9 @@ usage(){ get_qube_feat(){ qube="${1}" - qvm-features "${qube}" \ - | grep -e os-distribution -e os-version -e template-release \ - -e template-release -e template-name \ - | tr -s " " | sed "s/ /: /;s/^/ /" + qvm-features "${qube}" | \ + grep -E "^(os-(distribution|version)|template-(release|name))" | \ + sed "s/ / /g;s/ /: /;s/^/ /" } case "${1-}" in diff --git a/salt/dom0/files/bin/qvm-port-forward b/salt/dom0/files/bin/qvm-port-forward index 7be4133..4b4d5f3 100755 --- a/salt/dom0/files/bin/qvm-port-forward +++ b/salt/dom0/files/bin/qvm-port-forward @@ -105,13 +105,13 @@ forward() { unset dev ## TODO: Handle multiple interfaces in upstream. untrusted_dev="$(run_qube "${from_qube}" ip -4 route \ - | awk '/^default via /{print $5}' | head -1)" + | awk '/^default via /{print $5}' | head -1)" validate_dev "${from_qube}" "${untrusted_dev}" dev="${untrusted_dev}" unset from_ip untrusted_from_ip="$(run_qube "${from_qube}" ip -4 -o addr show dev \ - "${dev}" | awk '{print $4}' | cut -d "/" -f 1)" + "${dev}" | awk '{print $4}' | cut -d "/" -f 1)" validate_ipv4 "${from_qube}" "${untrusted_from_ip}" from_ip="${untrusted_from_ip}" @@ -220,7 +220,7 @@ get_lan(){ unset dev ## TODO: Handle multiple interfaces in upstream. untrusted_dev="$(run_qube "${qube}" ip -4 route \ - | awk '/^default via /{print $5}' | head -1)" + | awk '/^default via /{print $5}' | head -1)" validate_dev "${qube}" "${untrusted_dev}" dev="${untrusted_dev}" diff --git a/salt/dom0/files/bin/qvm-screenshot b/salt/dom0/files/bin/qvm-screenshot index 00c45ef..894fd0e 100755 --- a/salt/dom0/files/bin/qvm-screenshot +++ b/salt/dom0/files/bin/qvm-screenshot @@ -44,6 +44,7 @@ take_screenshot() { } print_help(){ + # editorconfig-checker-disable echo "Usage: ${0##*/} [OPTIONS] -h, --help print this help message and exit Capture mode: @@ -57,6 +58,7 @@ Development mode: -D, --dialog-cmd dialog tool: kdialog, zenity -S, --screenshot-cmd screenshot tool: maim, scrot, spectacle, xfce4-screenshooter" + # editorconfig-checker-enable exit 1 } @@ -271,8 +273,8 @@ if test "${exit_required}" = "1"; then fi qube_list="$(qvm-ls --no-spinner --raw-data --fields=NAME,CLASS | \ - awk -F "|" '$1 !~ /(^dvm-|-dvm$)/ && - $2 !~ /^(AdminVM|TemplateVM)$/{print $1}')" + awk -F "|" '$1 !~ /(^dvm-|-dvm$)/ && + $2 !~ /^(AdminVM|TemplateVM)$/{print $1}')" if test -z "${qube}"; then dialog_title="Select destination qube (Unix based):" diff --git a/salt/fetcher/README.md b/salt/fetcher/README.md index e171a48..7afb0ca 100644 --- a/salt/fetcher/README.md +++ b/salt/fetcher/README.md @@ -16,8 +16,8 @@ will be able to download from many protocol as long as the installed tools accepts them. Supported protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, - IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, - SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS, RSYNC, BitTorrent. +IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, +SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS, WSS, RSYNC, BitTorrent. ## Installation diff --git a/salt/signal/README.md b/salt/signal/README.md index 6575e4c..4d5f802 100644 --- a/salt/signal/README.md +++ b/salt/signal/README.md @@ -18,7 +18,7 @@ Install Signal Desktop and creates an app qube named "signal". ```sh sudo qubesctl top.enable signal -sudo qubesctl --targets=tpl-signal,signal state.appply +sudo qubesctl --targets=tpl-signal,signal state.apply sudo qubesctl top.disable signal sudo qubesctl state.apply signal.appmenus ``` diff --git a/scripts/shell-lint.sh b/scripts/shell-lint.sh index f9a52ba..f9b85ec 100755 --- a/scripts/shell-lint.sh +++ b/scripts/shell-lint.sh @@ -47,13 +47,16 @@ case "${find_tool}" in ;; find) files="$(find scripts/ salt/ -not \( -path "*/zsh" -prune \) -type f \ - -exec file {} \+ | awk -F ":" '/ shell script,/{ print $1 }')" + -exec file {} \+ | awk -F ":" '/ shell script,/{ print $1 }')" ## No Shebang sh_files="$(find salt/ -type f -name "rc.local")" ;; esac -files="$(echo "$files" | sort -u)" -sh_files="$(echo "$sh_files" | sort -u)" -test -z "${files}" || shellcheck ${files} -test -z "${sh_files}" || shellcheck -s sh ${sh_files} +echo "${files}" | sort -u | tr " " "\n" +exit + +#files="$(echo "$files" | sort -u)" +#sh_files="$(echo "$sh_files" | sort -u)" +#test -z "${files}" || shellcheck ${files} +#test -z "${sh_files}" || shellcheck -s sh ${sh_files} diff --git a/scripts/spec-build.sh b/scripts/spec-build.sh index 4804176..31fb425 100755 --- a/scripts/spec-build.sh +++ b/scripts/spec-build.sh @@ -81,7 +81,7 @@ spec_get="./scripts/spec-get.sh" if test -z "${1-}"; then # shellcheck disable=SC2046 set -- $(find salt/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ - | sort -d | tr "\n" " ") + | sort -d | tr "\n" " ") fi counter=0 for p in "$@"; do diff --git a/scripts/spec-gen.sh b/scripts/spec-gen.sh index 00dda53..086fdb5 100755 --- a/scripts/spec-gen.sh +++ b/scripts/spec-gen.sh @@ -161,7 +161,7 @@ fi if echo "${@}" | grep -qE "(^scripts/| scripts/|/template.spec)" || test -z "${1-}"; then # shellcheck disable=SC2046 set -- $(find salt/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ - | sort -d | tr "\n" " ") + | sort -d | tr "\n" " ") fi projects_seen="" diff --git a/scripts/spec-get.sh b/scripts/spec-get.sh index 26a40ef..ae64106 100755 --- a/scripts/spec-get.sh +++ b/scripts/spec-get.sh @@ -9,7 +9,7 @@ set -eu usage(){ names="$(find salt/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' \ - | sort -d | tr "\n" " ")" + | sort -d | tr "\n" " ")" echo "Usage: ${0##*/} " echo "Example: ${0##*/} qubes-builder description" echo "Names: ${names}" @@ -105,9 +105,10 @@ if test "${key}" = "description"; then fi if test "${key}" = "summary"; then - summary="$(sed -n "/^# ${name}$/,/^## Table of Contents$/{ - /./!d; /^#/d; /^SPDX/d; /^/d; s/\.$//; p}" \ - -- "${readme}")" + summary="$(sed -n -e \ + "/^# ${name}$/,/^## Table of Contents$/{ + /./!d; /^#/d; /^SPDX/d; /^/d; s/\.$//; p}" \ + -- "${readme}")" block_max_chars summary "${summary}" 70 fi diff --git a/scripts/unicode-prohibit.sh b/scripts/unicode-prohibit.sh index e238706..6b95097 100755 --- a/scripts/unicode-prohibit.sh +++ b/scripts/unicode-prohibit.sh @@ -22,7 +22,7 @@ fi files="$(echo "${files}" | sort -u)" # shellcheck disable=SC2086 unicode_match="$(grep -oPrHn --exclude-dir=.git --exclude-dir=LICENSES \ - -e "[^\x00-\x7F]" -- ${files} || true)" + -e "[^\x00-\x7F]" -- ${files} || true)" match_found="" if test -n "${unicode_match}"; then