Skip to content

Commit 9d8f07d

Browse files
authored
Merge pull request #2582 from hoffie/autobuild/shfmt
Scripts: Apply a consistent coding style
2 parents 0bb1fba + 66bdcf2 commit 9d8f07d

File tree

12 files changed

+163
-160
lines changed

12 files changed

+163
-160
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# See https://editorconfig.org/
2+
# This file is used by editors, but also by automation such as `shfmt`.
23

34
# This is the top-most .editorconfig file
45
root = true
@@ -16,5 +17,13 @@ indent_size = 4
1617
indent_style = space
1718
indent_size = 2
1819

20+
[*.sh]
21+
shell_variant = bash
22+
binary_next_line = false
23+
switch_case_indent = true
24+
space_redirects = true
25+
keep_padding = true
26+
function_next_line = false
27+
1928
[libs/**]
2029
ignore = true

.github/autobuild/android.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,5 @@ case "${1:-}" in
109109
*)
110110
echo "Unknown stage '${1:-}'"
111111
exit 1
112+
;;
112113
esac

.github/autobuild/ios.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ case "${1:-}" in
5656
*)
5757
echo "Unknown stage '${1:-}'"
5858
exit 1
59+
;;
5960
esac

.github/autobuild/linux_deb.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ case "${TARGET_ARCH}" in
1717
*)
1818
echo "Unsupported TARGET_ARCH ${TARGET_ARCH}"
1919
exit 1
20+
;;
2021
esac
2122

2223
setup() {
@@ -33,7 +34,7 @@ setup() {
3334

3435
setup_cross_compilation_apt_sources() {
3536
if [[ "${TARGET_ARCH}" == amd64 ]]; then
36-
return
37+
return
3738
fi
3839
sudo dpkg --add-architecture "${TARGET_ARCH}"
3940
sed -rne "s|^deb.*/ ([^ -]+(-updates)?) main.*|deb [arch=${TARGET_ARCH}] http://ports.ubuntu.com/ubuntu-ports \1 main universe multiverse restricted|p" /etc/apt/sources.list | sudo dd of=/etc/apt/sources.list.d/"${TARGET_ARCH}".list
@@ -88,4 +89,5 @@ case "${1:-}" in
8889
*)
8990
echo "Unknown stage '${1:-}'"
9091
exit 1
92+
;;
9193
esac

.github/autobuild/mac.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,5 @@ case "${1:-}" in
8383
*)
8484
echo "Unknown stage '${1:-}'"
8585
exit 1
86+
;;
8687
esac

distributions/raspijamulus.sh

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ readonly NCORES
99

1010
# install required packages
1111
readonly pkgs=(alsamixergui build-essential qtbase5-dev qttools5-dev-tools libasound2-dev cmake libglib2.0-dev)
12-
if ! dpkg -s "${pkgs[@]}" >/dev/null 2>&1; then
13-
read -p "Do you want to install missing packages? " -n 1 -r
14-
echo
15-
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
16-
sudo apt-get install "${pkgs[@]}" -y
17-
# Raspbian 10 needs qt5-default; Raspbian 11 doesn't need or provide it
18-
if ! qtchooser -list-versions | grep -q default; then
19-
sudo apt-get install qt5-default -y
12+
if ! dpkg -s "${pkgs[@]}" > /dev/null 2>&1; then
13+
read -p "Do you want to install missing packages? " -n 1 -r
14+
echo
15+
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
16+
sudo apt-get install "${pkgs[@]}" -y
17+
# Raspbian 10 needs qt5-default; Raspbian 11 doesn't need or provide it
18+
if ! qtchooser -list-versions | grep -q default; then
19+
sudo apt-get install qt5-default -y
20+
fi
2021
fi
21-
fi
2222
fi
2323

2424
# Opus audio codec, custom compilation with custom modes and fixed point support
2525
if [ -d "${OPUS}" ]; then
26-
echo "The Opus directory is present, we assume it is compiled and ready to use. If not, delete the opus directory and call this script again."
26+
echo "The Opus directory is present, we assume it is compiled and ready to use. If not, delete the opus directory and call this script again."
2727
else
28-
wget https://archive.mozilla.org/pub/opus/"${OPUS}.tar.gz"
29-
tar -xzf "${OPUS}.tar.gz"
30-
rm "${OPUS}.tar.gz"
31-
cd "${OPUS}" || exit 1
32-
if [ "${OPUS}" == "opus-1.3.1" ]; then
33-
echo "@@ -117,13 +117,19 @@ void validate_celt_decoder(CELTDecoder *st)
28+
wget https://archive.mozilla.org/pub/opus/"${OPUS}.tar.gz"
29+
tar -xzf "${OPUS}.tar.gz"
30+
rm "${OPUS}.tar.gz"
31+
cd "${OPUS}" || exit 1
32+
if [ "${OPUS}" == "opus-1.3.1" ]; then
33+
echo "@@ -117,13 +117,19 @@ void validate_celt_decoder(CELTDecoder *st)
3434
#ifndef CUSTOM_MODES
3535
celt_assert(st->mode == opus_custom_mode_create(48000, 960, NULL));
3636
celt_assert(st->overlap == 120);
@@ -51,37 +51,37 @@ else
5151
#ifdef OPUS_ARCHMASK
5252
celt_assert(st->arch >= 0);
5353
celt_assert(st->arch <= OPUS_ARCHMASK);" >> opus_patch_file.diff
54-
patch celt/celt_decoder.c opus_patch_file.diff
55-
fi
56-
./configure --enable-custom-modes --enable-fixed-point
57-
make "-j${NCORES}"
58-
mkdir include/opus
59-
cp include/*.h include/opus
60-
cd ..
54+
patch celt/celt_decoder.c opus_patch_file.diff
55+
fi
56+
./configure --enable-custom-modes --enable-fixed-point
57+
make "-j${NCORES}"
58+
mkdir include/opus
59+
cp include/*.h include/opus
60+
cd ..
6161
fi
6262

6363
# Jack audio without DBUS support
6464
if [ -d "jack2" ]; then
65-
echo "The Jack2 directory is present, we assume it is compiled and ready to use. If not, delete the jack2 directory and call this script again."
65+
echo "The Jack2 directory is present, we assume it is compiled and ready to use. If not, delete the jack2 directory and call this script again."
6666
else
67-
git clone https://github.com/jackaudio/jack2.git
68-
cd jack2 || exit 1
69-
git checkout v1.9.20
70-
./waf configure --alsa --prefix=/usr/local "--libdir=$(pwd)/build"
71-
./waf "-j${NCORES}"
72-
mkdir build/jack
73-
cp build/*.so build/jack
74-
cp build/common/*.so build/jack
75-
cp build/example-clients/*.so build/jack
76-
cd ..
67+
git clone https://github.com/jackaudio/jack2.git
68+
cd jack2 || exit 1
69+
git checkout v1.9.20
70+
./waf configure --alsa --prefix=/usr/local "--libdir=$(pwd)/build"
71+
./waf "-j${NCORES}"
72+
mkdir build/jack
73+
cp build/*.so build/jack
74+
cp build/common/*.so build/jack
75+
cp build/example-clients/*.so build/jack
76+
cd ..
7777

78-
# give audio group rights to do realtime
79-
if grep -Fq "@audio" /etc/security/limits.conf; then
80-
echo "audio group already has realtime rights"
81-
else
82-
sudo sh -c 'echo "@audio - rtprio 95" >> /etc/security/limits.conf'
83-
sudo sh -c 'echo "@audio - memlock unlimited" >> /etc/security/limits.conf'
84-
fi
78+
# give audio group rights to do realtime
79+
if grep -Fq "@audio" /etc/security/limits.conf; then
80+
echo "audio group already has realtime rights"
81+
else
82+
sudo sh -c 'echo "@audio - rtprio 95" >> /etc/security/limits.conf'
83+
sudo sh -c 'echo "@audio - memlock unlimited" >> /etc/security/limits.conf'
84+
fi
8585
fi
8686

8787
# compile Jamulus with external Opus library
@@ -90,21 +90,21 @@ qmake "CONFIG+=opus_shared_lib raspijamulus headless" "INCLUDEPATH+=distribution
9090
make "-j${NCORES}"
9191

9292
# get first USB audio sound card device
93-
ADEVICE=$(aplay -l|grep "USB Audio"|tail -1|cut -d' ' -f3)
93+
ADEVICE=$(aplay -l | grep "USB Audio" | tail -1 | cut -d' ' -f3)
9494
echo "Using USB audio device: ${ADEVICE}"
9595

9696
# write Jamulus ini file for setting the client name and buffer settings, if there is
9797
# just one CPU core, we assume that we are running on a Raspberry Pi Zero
9898
JAMULUSINIFILE="Jamulus.ini"
99-
NAME64=$(echo "Raspi $(hostname)"|cut -c -16|tr -d $'\n'|base64)
99+
NAME64=$(echo "Raspi $(hostname)" | cut -c -16 | tr -d $'\n' | base64)
100100
if [ "$NCORES" -gt "1" ]; then
101-
echo -e "<client>\n <name_base64>${NAME64}</name_base64>" > ${JAMULUSINIFILE}
102-
echo -e " <autojitbuf>1</autojitbuf>\n <jitbuf>3</jitbuf>\n <jitbufserver>3</jitbufserver>" >> ${JAMULUSINIFILE}
103-
echo -e " <audiochannels>2</audiochannels>\n <audioquality>1</audioquality>\n</client>" >> ${JAMULUSINIFILE}
101+
echo -e "<client>\n <name_base64>${NAME64}</name_base64>" > ${JAMULUSINIFILE}
102+
echo -e " <autojitbuf>1</autojitbuf>\n <jitbuf>3</jitbuf>\n <jitbufserver>3</jitbufserver>" >> ${JAMULUSINIFILE}
103+
echo -e " <audiochannels>2</audiochannels>\n <audioquality>1</audioquality>\n</client>" >> ${JAMULUSINIFILE}
104104
else
105-
echo -e "<client>\n <name_base64>${NAME64}</name_base64>" > ${JAMULUSINIFILE}
106-
echo -e " <autojitbuf>1</autojitbuf>\n <jitbuf>3</jitbuf>\n <jitbufserver>3</jitbufserver>" >> ${JAMULUSINIFILE}
107-
echo -e " <audiochannels>0</audiochannels>\n <audioquality>1</audioquality>\n</client>" >> ${JAMULUSINIFILE}
105+
echo -e "<client>\n <name_base64>${NAME64}</name_base64>" > ${JAMULUSINIFILE}
106+
echo -e " <autojitbuf>1</autojitbuf>\n <jitbuf>3</jitbuf>\n <jitbufserver>3</jitbufserver>" >> ${JAMULUSINIFILE}
107+
echo -e " <audiochannels>0</audiochannels>\n <audioquality>1</audioquality>\n</client>" >> ${JAMULUSINIFILE}
108108
fi
109109

110110
# taken from "Raspberry Pi and realtime, low-latency audio" homepage at wiki.linuxaudio.org

linux/deploy_deb.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export DEBFULLNAME=GitHubActions [email protected]
1616
echo -n generating changelog
1717
rm -f debian/changelog
1818
dch --create --package jamulus --empty --newversion "${VERSION}" ''
19-
perl .github/actions_scripts/getChangelog.pl ChangeLog "${VERSION}" --line-per-entry | while read -r entry
20-
do
19+
perl .github/actions_scripts/getChangelog.pl ChangeLog "${VERSION}" --line-per-entry | while read -r entry; do
2120
echo -n .
2221
dch "$entry"
2322
done

mac/deploy_mac.sh

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,15 @@ while getopts 'hs:' flag; do
2626
esac
2727
done
2828

29-
cleanup()
30-
{
29+
cleanup() {
3130
# Clean up previous deployments
3231
rm -rf "${build_path}"
3332
rm -rf "${deploy_path}"
3433
mkdir -p "${build_path}"
3534
mkdir -p "${deploy_path}"
3635
}
3736

38-
39-
build_app()
40-
{
37+
build_app() {
4138
local client_or_server="${1}"
4239

4340
# Build Jamulus
@@ -71,11 +68,11 @@ build_app()
7168
*)
7269
echo "build_app: invalid parameter '${client_or_server}'"
7370
exit 1
71+
;;
7472
esac
7573
}
7674

77-
build_installer_image()
78-
{
75+
build_installer_image() {
7976
local client_target_name="${1}"
8077
local server_target_name="${2}"
8178

@@ -90,18 +87,18 @@ build_installer_image()
9087
# Build installer image
9188

9289
create-dmg \
93-
--volname "${client_target_name} Installer" \
94-
--background "${resources_path}/installerbackground.png" \
95-
--window-pos 200 400 \
96-
--window-size 900 320 \
97-
--app-drop-link 820 210 \
98-
--text-size 12 \
99-
--icon-size 72 \
100-
--icon "${client_target_name}.app" 630 210 \
101-
--icon "${server_target_name}.app" 530 210 \
102-
--eula "${root_path}/COPYING" \
103-
"${deploy_path}/${client_target_name}-${app_version}-installer-mac.dmg" \
104-
"${deploy_path}/"
90+
--volname "${client_target_name} Installer" \
91+
--background "${resources_path}/installerbackground.png" \
92+
--window-pos 200 400 \
93+
--window-size 900 320 \
94+
--app-drop-link 820 210 \
95+
--text-size 12 \
96+
--icon-size 72 \
97+
--icon "${client_target_name}.app" 630 210 \
98+
--icon "${server_target_name}.app" 530 210 \
99+
--eula "${root_path}/COPYING" \
100+
"${deploy_path}/${client_target_name}-${app_version}-installer-mac.dmg" \
101+
"${deploy_path}/"
105102
}
106103

107104
brew_install_pinned() {

0 commit comments

Comments
 (0)