Check shell scripts for POSIX sh compliance

The hook functions and script might be executeted by busybox. Mark those
files as POSIX sh for shellcheck.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
This commit is contained in:
Benjamin Drung 2024-07-29 10:37:21 +02:00
parent 6fc11ff9e3
commit 8510fabcde
6 changed files with 10 additions and 1 deletions

View File

@ -5,3 +5,8 @@ disable=SC1090
# SC1091: Not following <file>
# https://www.shellcheck.net/wiki/SC1091
disable=SC1091
# SC3043: In POSIX sh, local is undefined
# https://www.shellcheck.net/wiki/SC3043
# ...but dash and BusyBox ash support it.
disable=SC3043

2
debian/salsa-ci.yml vendored
View File

@ -20,5 +20,5 @@ shellcheck:
- apt-get update
- apt-get install -y shellcheck
- |
shellcheck -s dash hook-functions $(find hooks scripts -type f) $({ find . -maxdepth 1 -type f -executable; find debian -maxdepth 1 -type f; find docs kernel -type f; } | xargs grep -l '^#!/bin/sh')
shellcheck hook-functions $(find hooks scripts -type f) $({ find . -maxdepth 1 -type f -executable; find debian -maxdepth 1 -type f; find docs kernel -type f; } | xargs grep -l '^#!/bin/sh')
needs: []

View File

@ -1,4 +1,5 @@
# -*- shell-script -*-
# shellcheck shell=sh
catenate_cpiogz() {
# Sanity check

View File

@ -1,4 +1,5 @@
# -*- shell-script -*-
# shellcheck shell=sh
_log_msg()
{

View File

@ -1,4 +1,5 @@
# Local filesystem mounting -*- shell-script -*-
# shellcheck shell=sh
local_top()
{

View File

@ -1,4 +1,5 @@
# NFS filesystem mounting -*- shell-script -*-
# shellcheck shell=sh
# FIXME This needs error checking