Browse Source

MT#62763 Fix shellcheck issues

Warned-by: shellcheck
Change-Id: I42a0a4cc60007686b220940c0ddb7dbd0a13038f
pull/2018/head
Guillem Jover 2 months ago
parent
commit
d3457c1cfc
10 changed files with 27 additions and 6 deletions
  1. +3
    -0
      .shellcheckrc
  2. +1
    -0
      debian/ngcp-rtpengine-daemon.postinst
  3. +2
    -0
      debian/ngcp-rtpengine-recording-nfs-setup
  4. +6
    -4
      el/build-with-mock.sh
  5. +2
    -0
      el/rtpengine-recording.init
  6. +3
    -0
      el/rtpengine.init
  7. +2
    -0
      pkg/deb/backports/bullseye
  8. +4
    -0
      pkg/deb/backports/focal
  9. +2
    -0
      pkg/deb/backports/jammy
  10. +2
    -2
      pkg/deb/generator.sh

+ 3
- 0
.shellcheckrc View File

@ -0,0 +1,3 @@
external-sources=true
# Used for jdg-tap integration.
source-path=source

+ 1
- 0
debian/ngcp-rtpengine-daemon.postinst View File

@ -15,6 +15,7 @@ if [ "$VIRT" = "yes" ]; then
echo "Container environment detected. Skip kernel module check"
else
if [ -f $default ]; then
# shellcheck source=debian/ngcp-rtpengine-daemon.default
. $default || true
fi


+ 2
- 0
debian/ngcp-rtpengine-recording-nfs-setup View File

@ -6,10 +6,12 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEFAULTS=/etc/default/ngcp-rtpengine-recording-daemon
DESC="RTP engine recording NFS share"
# shellcheck disable=SC1091
. /lib/lsb/init-functions
# Load startup options if available
if [ -f "$DEFAULTS" ]; then
# shellcheck source=debian/ngcp-rtpengine-recording-daemon.default
. "$DEFAULTS" || true
fi


+ 6
- 4
el/build-with-mock.sh View File

@ -8,7 +8,7 @@
set -e
if [[ -z $1 || -z $2 ]]; then
echo $0: Require package version and git commit
echo "$0: Require package version and git commit"
echo "Usage: build-with-mock.sh <version> <commit>"
exit 1
fi
@ -18,10 +18,12 @@ GIT_COMMIT=$2
mkdir -p rpmbuild/{SOURCES,SPECS}
git archive --format=tar --prefix=ngcp-rtpengine-${RTPENGINE_VERSION}/ $2 | gzip -c > rpmbuild/SOURCES/ngcp-rtpengine-${RTPENGINE_VERSION}.tar.gz
git archive --format=tar --prefix="ngcp-rtpengine-${RTPENGINE_VERSION}/" \
"${GIT_COMMIT}" \
| gzip -c >"rpmbuild/SOURCES/ngcp-rtpengine-${RTPENGINE_VERSION}.tar.gz"
sed /^Version/s"/^Version:.*/Version: ${RTPENGINE_VERSION}/" el/rtpengine.spec > rpmbuild/SPECS/rtpengine.spec
sed /^Version/s"/^Version:.*/Version: ${RTPENGINE_VERSION}/" el/rtpengine.spec \
>rpmbuild/SPECS/rtpengine.spec
rm -f rpmbuild/SRPMS/*.src.rpm
rpmbuild --define "_topdir $PWD/rpmbuild" -bs rpmbuild/SPECS/rtpengine.spec


+ 2
- 0
el/rtpengine-recording.init View File

@ -17,10 +17,12 @@
### END INIT INFO
# Source function library.
# shellcheck disable=SC1091
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/rtpengine-recording ]
then
# shellcheck source=./rtpengine-recording.sysconfig
. /etc/sysconfig/rtpengine-recording
else
echo "Error: /etc/sysconfig/rtpengine-recording not present" >&2


+ 3
- 0
el/rtpengine.init View File

@ -17,12 +17,14 @@
### END INIT INFO
# Source function library.
# shellcheck disable=SC1091
. /etc/rc.d/init.d/functions
# defaults
if [ -f /etc/sysconfig/rtpengine ]
then
# shellcheck source=./rtpengine.sysconfig
. /etc/sysconfig/rtpengine
else
echo "Error: /etc/sysconfig/rtpengine not present" >&2
@ -122,6 +124,7 @@ stop() {
RETVAL=$?
echo
if [ -f "$cachefile" ];then
# shellcheck disable=SC1090
. "$cachefile"
echo "Unloading module for in-kernel packet forwarding"
echo "del $TABLE" > /proc/rtpengine/control


+ 2
- 0
pkg/deb/backports/bullseye View File

@ -27,6 +27,7 @@ sed -i '/^override_dh_dkms/d' "${DIST}"/rules
sed -i '/dh_dkms /d' "${DIST}"/rules
sed -i '/^export DEB_VERSION_UPSTREAM/d' "${DIST}"/rules
sed -i '/^export DEB_SOURCE/d' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^include /usr/share/dpkg/pkg-info.mk;include /usr/share/dpkg/pkg-info.mk\
## kernel package specific stuff\
# Name of the dkms package\
@ -37,6 +38,7 @@ sname:=rtpengine\
sversion:=$(DEB_VERSION_UPSTREAM)\
## end of kernel package specific stuff\
;' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^execute_before_dh_auto_install-indep:;execute_before_dh_auto_install-indep:\
\t# Create the directories to install the source into\
\tdh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)\


+ 4
- 0
pkg/deb/backports/focal View File

@ -24,8 +24,10 @@ sed -i -e 's/^execute_before_dh_auto_install-indep:/override_dh_auto_install-ind
sed -i -e '/^\tgzip -9 < README.md/a\\n\tdh_auto_install' ${DIST}/rules
# fix links
# shellcheck disable=SC2016
sed -i -e 's#${env:deb_systemdsystemunitdir}#/lib/systemd/system/#g' \
${DIST}/rtpengine-recording-daemon.links
# shellcheck disable=SC2016
sed -i -e 's#${env:deb_systemdsystemunitdir}#/lib/systemd/system/#g' \
${DIST}/rtpengine-daemon.links
@ -49,6 +51,7 @@ sed -i '/^override_dh_dkms/d' "${DIST}"/rules
sed -i '/dh_dkms /d' "${DIST}"/rules
sed -i '/^export DEB_VERSION_UPSTREAM/d' "${DIST}"/rules
sed -i '/^export DEB_SOURCE/d' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^include /usr/share/dpkg/pkg-info.mk;include /usr/share/dpkg/pkg-info.mk\
## kernel package specific stuff\
# Name of the dkms package\
@ -59,6 +62,7 @@ sname:=rtpengine\
sversion:=$(DEB_VERSION_UPSTREAM)\
## end of kernel package specific stuff\
;' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^override_dh_auto_install-indep:;override_dh_auto_install-indep:\
\t# Create the directories to install the source into\
\tdh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)\


+ 2
- 0
pkg/deb/backports/jammy View File

@ -27,6 +27,7 @@ sed -i '/^override_dh_dkms/d' "${DIST}"/rules
sed -i '/dh_dkms /d' "${DIST}"/rules
sed -i '/^export DEB_VERSION_UPSTREAM/d' "${DIST}"/rules
sed -i '/^export DEB_SOURCE/d' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^include /usr/share/dpkg/pkg-info.mk;include /usr/share/dpkg/pkg-info.mk\
## kernel package specific stuff\
# Name of the dkms package\
@ -37,6 +38,7 @@ sname:=rtpengine\
sversion:=$(DEB_VERSION_UPSTREAM)\
## end of kernel package specific stuff\
;' "${DIST}"/rules
# shellcheck disable=SC2016
sed -i 's;^execute_before_dh_auto_install-indep:;execute_before_dh_auto_install-indep:\
\t# Create the directories to install the source into\
\tdh_installdirs -p$(pdkms) usr/src/$(sname)-$(sversion)\


+ 2
- 2
pkg/deb/generator.sh View File

@ -21,7 +21,7 @@ find debian -maxdepth 2 -type f -exec \
## remove same file on links
while read -r file; do
file_new=$(echo "${file}" | sed -e 's/ngcp-//g')
file_new=${file//ngcp-/}
while read -r line; do
sed -i -e "s#${line}\$#HH#g" "${file}"
done < <(awk '{print $1}' "${file}")
@ -46,7 +46,7 @@ done < <(grep '^Package:' debian/control | grep -v ' rtpengine-daemon$')
echo "- Rename files"
while read -r file; do
file_new=$(echo "${file}" | sed -e 's/ngcp-//g')
file_new=${file//ngcp-/}
mv "${file}" "${file_new}"
done < <(find debian -maxdepth 1 -type f -name 'ngcp-rtpengine*')


Loading…
Cancel
Save