Skip to content

Commit 64d215f

Browse files
chore(deps): update pre-commit hook scop/pre-commit-shfmt to v3.12.0-1 (#307)
* chore(deps): update pre-commit hook scop/pre-commit-shfmt to v3.12.0-1 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent c2ca1f3 commit 64d215f

15 files changed

Lines changed: 397 additions & 397 deletions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ repos:
5353
hooks:
5454
- id: actionlint
5555
- repo: https://github.com/scop/pre-commit-shfmt
56-
rev: v3.11.0-1
56+
rev: v3.12.0-1
5757
hooks:
5858
- id: shfmt
5959
- repo: https://github.com/adamchainz/blacken-docs

bootstrap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@ echo "Weblate domain:"
44
read -r domain
55
cloud_domain="${domain%.weblate.cloud}"
66
if [ "$cloud_domain" = "$domain" ]; then
7-
echo "Cloud domain (without .weblate.cloud):"
8-
read -r cloud_domain
7+
echo "Cloud domain (without .weblate.cloud):"
8+
read -r cloud_domain
99
fi
1010
echo "Weblate title:"
1111
read -r title
1212
if [ -f ~/.config/weblate-bootstrap/sentry_dsn ]; then
13-
sentry=$(cat ~/.config/weblate-bootstrap/sentry_dsn)
13+
sentry=$(cat ~/.config/weblate-bootstrap/sentry_dsn)
1414
else
15-
echo "Sentry DSN:"
16-
read -r sentry
15+
echo "Sentry DSN:"
16+
read -r sentry
1717
fi
1818
if [ -f ~/.config/weblate-bootstrap/sentry_token ]; then
19-
sentry_token=$(cat ~/.config/weblate-bootstrap/sentry_token)
19+
sentry_token=$(cat ~/.config/weblate-bootstrap/sentry_token)
2020
else
21-
echo "Sentry Token:"
22-
read -r sentry_token
21+
echo "Sentry Token:"
22+
read -r sentry_token
2323
fi
2424
if [ -f ~/.config/weblate-bootstrap/graylog_token ]; then
25-
graylog_token=$(cat ~/.config/weblate-bootstrap/graylog_token)
25+
graylog_token=$(cat ~/.config/weblate-bootstrap/graylog_token)
2626
else
27-
echo "Graylog Token:"
28-
read -r graylog_token
27+
echo "Graylog Token:"
28+
read -r graylog_token
2929
fi
3030

3131
smtp_pass=$(openssl rand -hex 32)
3232

33-
cat > "${1:-/etc/weblate-bootstrap}" << EOT
33+
cat >"${1:-/etc/weblate-bootstrap}" <<EOT
3434
WEBLATE_DOMAIN="$domain"
3535
WEBLATE_CLOUD_DOMAIN="$cloud_domain"
3636
WEBLATE_TITLE="$title"

configure-system

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apt update
77
apt install -y fail2ban vim
88
apt purge -y vim-tiny cryptsetup-initramfs
99

10-
cat > /etc/fail2ban/jail.d/sshd.conf << EOT
10+
cat >/etc/fail2ban/jail.d/sshd.conf <<EOT
1111
[sshd]
1212
mode = aggressive
1313
EOT

create-monitor-user

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ KEY="$(sed -n '/^env.KEY/ s/^env.KEY \(.*\)/\1/p' /etc/munin/plugin-conf.d/webla
44
SERVER="$(sed -n '/^env.SERVER/ s/^env.SERVER \(.*\)/\1/p' /etc/munin/plugin-conf.d/weblate_servers)"
55

66
if [ -z "$SERVER" ]; then
7-
echo "Missing server configuration!"
8-
exit 1
7+
echo "Missing server configuration!"
8+
exit 1
99
fi
1010

1111
if [ -n "$KEY" ]; then
12-
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null; then
13-
echo "Key not working, recreating"
14-
KEY=""
15-
fi
12+
if ! curl -f -s -H "Authorization: Token $KEY" "${SERVER}api/metrics/" -o /dev/null; then
13+
echo "Key not working, recreating"
14+
KEY=""
15+
fi
1616
fi
1717

1818
if [ -z "$KEY" ]; then
1919

20-
echo "Generating new key"
21-
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ]; then
22-
cd /home/weblate/weblate || exit 1
23-
KEY="$(sudo -u weblate docker compose exec --user weblate weblate weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
24-
else
25-
KEY="$(sudo -u weblate /home/weblate/weblate-env/bin/weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
26-
fi
20+
echo "Generating new key"
21+
if [ -f "/home/weblate/weblate/docker-compose.override.yml" ]; then
22+
cd /home/weblate/weblate || exit 1
23+
KEY="$(sudo -u weblate docker compose exec --user weblate weblate weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
24+
else
25+
KEY="$(sudo -u weblate /home/weblate/weblate-env/bin/weblate shell --no-imports -c 'from weblate.auth.models import User; user = User.objects.get_or_create(username="monitor")[0]; print(user.auth_token.key)')"
26+
fi
2727

28-
sed -i "s/^env.KEY .*/env.KEY $KEY/" /etc/munin/plugin-conf.d/weblate_servers
28+
sed -i "s/^env.KEY .*/env.KEY $KEY/" /etc/munin/plugin-conf.d/weblate_servers
2929
fi

install-docker

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
apt-get update
66

77
apt-get install -y \
8-
ca-certificates \
9-
curl \
10-
gnupg \
11-
apparmor \
12-
lsb-release
8+
ca-certificates \
9+
curl \
10+
gnupg \
11+
apparmor \
12+
lsb-release
1313

1414
# Keyring
1515
# shellcheck disable=SC2174
@@ -18,14 +18,14 @@ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o
1818

1919
# APT source
2020
echo \
21-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') \
22-
$(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list
21+
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') \
22+
$(lsb_release -cs) stable" >/etc/apt/sources.list.d/docker.list
2323

2424
# Install Docker
2525
apt-get update
2626
apt-get install -y \
27-
docker-ce \
28-
docker-ce-cli \
29-
containerd.io \
30-
docker-buildx-plugin \
31-
docker-compose-plugin
27+
docker-ce \
28+
docker-ce-cli \
29+
containerd.io \
30+
docker-buildx-plugin \
31+
docker-compose-plugin

install-exim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ set -e
88
apt install -y exim4
99

1010
sed -i \
11-
-e "s#dc_eximconfig_configtype=.*#dc_eximconfig_configtype='satellite'#" \
12-
-e "s#dc_local_interfaces=.*#dc_local_interfaces='127.0.0.1'#" \
13-
-e "s#dc_readhost=.*#dc_readhost='$WEBLATE_DOMAIN'#" \
14-
-e "s#dc_smarthost=.*#dc_smarthost='172.16.0.84'#" \
15-
-e "s#dc_hide_mailname=.*#dc_hide_mailname='true'#" \
16-
/etc/exim4/update-exim4.conf.conf
11+
-e "s#dc_eximconfig_configtype=.*#dc_eximconfig_configtype='satellite'#" \
12+
-e "s#dc_local_interfaces=.*#dc_local_interfaces='127.0.0.1'#" \
13+
-e "s#dc_readhost=.*#dc_readhost='$WEBLATE_DOMAIN'#" \
14+
-e "s#dc_smarthost=.*#dc_smarthost='172.16.0.84'#" \
15+
-e "s#dc_hide_mailname=.*#dc_hide_mailname='true'#" \
16+
/etc/exim4/update-exim4.conf.conf
1717

1818
#cat >> /etc/exim4/passwd.client <<EOT
1919
#mail.cihar.com:$WEBLATE_DOMAIN:$EXIM_PASS

install-graylog

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
set -e
44

55
if [ -n "$1" ]; then
6-
WEBLATE_GRAYLOG_TOKEN="$1"
6+
WEBLATE_GRAYLOG_TOKEN="$1"
77
else
8-
# shellcheck disable=SC1091
9-
. /etc/weblate-bootstrap
8+
# shellcheck disable=SC1091
9+
. /etc/weblate-bootstrap
1010
fi
1111

1212
# Install package

install-mail-delivery

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -e
44

55
if [ -z "$1" ] || [ "$1" = "--help" ]; then
6-
echo "Usage: install-mail-delivery HOSTNAME"
7-
exit 1
6+
echo "Usage: install-mail-delivery HOSTNAME"
7+
exit 1
88
fi
99

1010
ssh "$1" apt update
@@ -20,7 +20,7 @@ scp ~/Nextcloud/Weblate/Servers/Mail/DKIM/dkim.private.key "$1":/etc/exim4/dkim.
2020
ssh "$1" chgrp Debian-exim /etc/exim4/dkim.private.key
2121
ssh "$1" chmod 640 /etc/exim4/dkim.private.key
2222

23-
ssh "$1" tee /etc/exim4/update-exim4.conf.conf << EOT
23+
ssh "$1" tee /etc/exim4/update-exim4.conf.conf <<EOT
2424
dc_eximconfig_configtype='internet'
2525
dc_other_hostnames=''
2626
dc_local_interfaces=''
@@ -36,7 +36,7 @@ dc_mailname_in_oh='true'
3636
dc_localdelivery='mail_spool'
3737
EOT
3838

39-
ssh "$1" tee /etc/exim4/conf.d/main/00_local_settings << EOT
39+
ssh "$1" tee /etc/exim4/conf.d/main/00_local_settings <<EOT
4040
daemon_smtp_ports = 25 : 587
4141
REMOTE_SMTP_HELO_DATA = md.weblate.org
4242
MAIN_HARDCODE_PRIMARY_HOSTNAME = md.weblate.org
@@ -55,7 +55,7 @@ ssh "$1" systemctl restart exim4
5555
ssh "$1" ./scripts/install-graylog "'$(cat ~/.config/weblate-bootstrap/graylog_token)'"
5656

5757
# shellcheck disable=SC2087
58-
ssh "$1" mail -r "noreply@weblate.org" -s "Test" -- "michal@weblate.org" << EOT
58+
ssh "$1" mail -r "noreply@weblate.org" -s "Test" -- "michal@weblate.org" <<EOT
5959
E-mail delivery from $1.
6060
6161
--

install-munin

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ export PATH
1111

1212
# Munin
1313
mkdir -p /etc/munin/plugin-conf.d/
14-
cat > /etc/munin/plugin-conf.d/postgres << EOT
14+
cat >/etc/munin/plugin-conf.d/postgres <<EOT
1515
[postgres_*]
1616
user weblate
1717
env.PGHOST 127.0.0.1
1818
env.PGUSER weblate
1919
env.PGPASSWORD weblate
2020
EOT
21-
cat > /etc/munin/plugin-conf.d/redis << EOT
21+
cat >/etc/munin/plugin-conf.d/redis <<EOT
2222
[redis]
2323
env.host1 127.0.0.1
2424
env.port1 6379
@@ -31,7 +31,7 @@ wget https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/r
3131
wget https://raw.githubusercontent.com/WeblateOrg/munin/master/weblate
3232
wget https://raw.githubusercontent.com/WeblateOrg/munin/master/ksm
3333
chmod +x redis weblate ksm
34-
cat > /etc/munin/plugin-conf.d/weblate_servers << EOT
34+
cat >/etc/munin/plugin-conf.d/weblate_servers <<EOT
3535
[weblate]
3636
env.SERVER https://$WEBLATE_DOMAIN/
3737
env.KEY

install-remote

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
set -e
55

66
if [ ! -f .venv/bin/activate ]; then
7-
echo "Missing virtual environment!"
8-
exit 2
7+
echo "Missing virtual environment!"
8+
exit 2
99
fi
1010

1111
if [ -z "$1" ] || [ "$1" = "--help" ]; then
12-
echo "Usage: install-remote HOSTNAME [VERSION]"
13-
exit 1
12+
echo "Usage: install-remote HOSTNAME [VERSION]"
13+
exit 1
1414
fi
1515

1616
SERVER_NAME="$1"
@@ -24,7 +24,7 @@ TMPFILE=$(mktemp --tmpdir weblate-log.XXXXXXXXXX)
2424

2525
# Gather basic configuration
2626
bootstrap "$BOOTSTRAP" "$2"
27-
cat >> "$BOOTSTRAP" << EOT
27+
cat >>"$BOOTSTRAP" <<EOT
2828
WEBLATE_PASSWORD="$(apg -a 0 -M sncl -n 1 -x 10 -m 20)"
2929
EOT
3030

@@ -42,14 +42,14 @@ pip install -r requirements.txt
4242
# debian-12 arm64: 114690389
4343
# debian-12 amd64: 114690387
4444
hcloud server create \
45-
--image 114690389 \
46-
--location fsn1 \
47-
--name "$SERVER_NAME" \
48-
--network 19990 \
49-
--firewall 13110 \
50-
--ssh-key 1056953 \
51-
--ssh-key 1494306 \
52-
--type cax11 | tee "$TMPFILE"
45+
--image 114690389 \
46+
--location fsn1 \
47+
--name "$SERVER_NAME" \
48+
--network 19990 \
49+
--firewall 13110 \
50+
--ssh-key 1056953 \
51+
--ssh-key 1494306 \
52+
--type cax11 | tee "$TMPFILE"
5353

5454
IPADDRESS=$(sed -n 's/IPv4: \(.*\)/\1/p' "$TMPFILE")
5555
IP6ADDRESS=$(sed -n 's/IPv6: \(.*\)/\1/p' "$TMPFILE")
@@ -65,8 +65,8 @@ echo "Created server with address $IPADDRESS, please ensure $WEBLATE_DOMAIN poin
6565
read -r dummy
6666

6767
s() {
68-
# shellcheck disable=SC2029
69-
ssh "root@$IPADDRESS" "$@"
68+
# shellcheck disable=SC2029
69+
ssh "root@$IPADDRESS" "$@"
7070
}
7171

7272
# Configure mail sending

0 commit comments

Comments
 (0)