Skip to content

Commit bb8759e

Browse files
bakerboy448claude
andauthored
chore(style): bulk shfmt v3.13.1 reformat across all scripts (#39)
## Summary - Restores Pre-commit CI to green. Repo's main has been failing since 2026-04-18 because pre-commit-config pinned shfmt v3.13.1-1, but the repo files were formatted by an older shfmt version with different rules. - Pure formatting changes — no semantic effects. ## Changes - 4-space → 2-space indent - pipe-at-EOL → `\` continuation with pipe-at-BOL (`--binary-next-line` flag) - minor whitespace normalisation 12 `.sh` files touched; `shellcheck --severity=warning` clean across all. ## Test plan - [ ] Pre-commit CI passes (it's been red for 3 weeks; this should fix it) - [ ] shfmt --diff is empty repo-wide after merge - [ ] No behavioral changes (formatting only) ## Notes This unblocks #38 (qbm-qbit + notifiarr-branch-builder cherry-pick), which inherits the broken Pre-commit run from main. Co-authored-by: Claude <[email protected]>
1 parent 77a0845 commit bb8759e

12 files changed

Lines changed: 623 additions & 622 deletions

dupe.sh

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
77
ENV_PATH="$SCRIPT_DIR/.env"
88
if [ -f "$ENV_PATH" ]; then
9-
# shellcheck source=.env
10-
echo "Loading environment variables from $ENV_PATH file"
11-
# shellcheck disable=SC1090 # shellcheck sucks
12-
if source "$ENV_PATH"; then
13-
echo "Environment variables loaded successfully"
14-
else
15-
echo "Error loading environment variables" >&2
16-
exit 1
17-
fi
9+
# shellcheck source=.env
10+
echo "Loading environment variables from $ENV_PATH file"
11+
# shellcheck disable=SC1090 # shellcheck sucks
12+
if source "$ENV_PATH"; then
13+
echo "Environment variables loaded successfully"
14+
else
15+
echo "Error loading environment variables" >&2
16+
exit 1
17+
fi
1818
else
19-
echo ".env file not found in script directory ($ENV_PATH)"
19+
echo ".env file not found in script directory ($ENV_PATH)"
2020
fi
2121

2222
# Default Variables
@@ -30,52 +30,52 @@ JDUPES_INCLUDE_EXT=${JDUPES_INCLUDE_EXT:-"mp4,mkv,avi"}
3030
DEBUG=${DEBUG:-"false"}
3131

3232
find_duplicates() {
33-
local log_file="$JDUPES_OUTPUT_LOG"
34-
local start_time
35-
start_time=$(date +%s)
36-
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Duplicate search started" | tee -a "$log_file"
33+
local log_file="$JDUPES_OUTPUT_LOG"
34+
local start_time
35+
start_time=$(date +%s)
36+
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Duplicate search started" | tee -a "$log_file"
3737

38-
if [ "$DEBUG" == "true" ]; then
39-
echo "Running jdupes with:" | tee -a "$log_file"
40-
echo "$JDUPES_COMMAND $JDUPES_EXCLUDE_DIRS -X onlyext:$JDUPES_INCLUDE_EXT -r -M -y $JDUPES_HASH_DB $JDUPES_SOURCE_DIR $JDUPES_DESTINATION_DIR" | tee -a "$log_file"
41-
fi
38+
if [ "$DEBUG" == "true" ]; then
39+
echo "Running jdupes with:" | tee -a "$log_file"
40+
echo "$JDUPES_COMMAND $JDUPES_EXCLUDE_DIRS -X onlyext:$JDUPES_INCLUDE_EXT -r -M -y $JDUPES_HASH_DB $JDUPES_SOURCE_DIR $JDUPES_DESTINATION_DIR" | tee -a "$log_file"
41+
fi
4242

43-
local results
44-
# shellcheck disable=SC2086
45-
results=$("$JDUPES_COMMAND" $JDUPES_EXCLUDE_DIRS -X onlyext:"$JDUPES_INCLUDE_EXT" -r -M -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR")
43+
local results
44+
# shellcheck disable=SC2086
45+
results=$("$JDUPES_COMMAND" $JDUPES_EXCLUDE_DIRS -X onlyext:"$JDUPES_INCLUDE_EXT" -r -M -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR")
4646

47-
if [[ $results != *"No duplicates found."* ]]; then
48-
# shellcheck disable=SC2086
49-
"$JDUPES_COMMAND" $JDUPES_EXCLUDE_DIRS -X onlyext:"$JDUPES_INCLUDE_EXT" -r -L -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR" >>"$log_file"
50-
fi
47+
if [[ $results != *"No duplicates found."* ]]; then
48+
# shellcheck disable=SC2086
49+
"$JDUPES_COMMAND" $JDUPES_EXCLUDE_DIRS -X onlyext:"$JDUPES_INCLUDE_EXT" -r -L -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR" >>"$log_file"
50+
fi
5151

52-
if [ "$DEBUG" == "true" ]; then
53-
echo -e "jdupes output: ${results}" | tee -a "$log_file"
54-
fi
52+
if [ "$DEBUG" == "true" ]; then
53+
echo -e "jdupes output: ${results}" | tee -a "$log_file"
54+
fi
5555

56-
parse_jdupes_output "$results" "$log_file"
57-
local finish_time
58-
finish_time=$(date +%s)
59-
local run_time=$((finish_time - start_time))
60-
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Duplicate search completed in ${run_time}s" | tee -a "$log_file"
56+
parse_jdupes_output "$results" "$log_file"
57+
local finish_time
58+
finish_time=$(date +%s)
59+
local run_time=$((finish_time - start_time))
60+
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Duplicate search completed in ${run_time}s" | tee -a "$log_file"
6161
}
6262

6363
parse_jdupes_output() {
64-
local results="$1"
65-
local log_file="$2"
64+
local results="$1"
65+
local log_file="$2"
6666

67-
if [[ $results != *"No duplicates found."* ]]; then
68-
field_message="❌ Unlinked files discovered..."
69-
parsed_log=$(echo "$results" | awk -F/ '{print $NF}' | sort -u)
70-
else
71-
field_message="✅ No unlinked files discovered..."
72-
parsed_log="No hardlinks created"
73-
fi
67+
if [[ $results != *"No duplicates found."* ]]; then
68+
field_message="❌ Unlinked files discovered..."
69+
parsed_log=$(echo "$results" | awk -F/ '{print $NF}' | sort -u)
70+
else
71+
field_message="✅ No unlinked files discovered..."
72+
parsed_log="No hardlinks created"
73+
fi
7474

75-
if [ "$DEBUG" == "true" ]; then
76-
echo -e "$field_message" | tee -a "$log_file"
77-
echo -e "Parsed log: ${parsed_log}" | tee -a "$log_file"
78-
fi
75+
if [ "$DEBUG" == "true" ]; then
76+
echo -e "$field_message" | tee -a "$log_file"
77+
echo -e "Parsed log: ${parsed_log}" | tee -a "$log_file"
78+
fi
7979
}
8080

8181
find_duplicates

f2b-dump.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ temp_file=$(mktemp)
55

66
# Function to add content to the temporary file
77
add_content() {
8-
# shellcheck disable=SC2129
9-
echo -e "\n$1\n" >>"$temp_file"
10-
cat "$2" >>"$temp_file" 2>/dev/null
11-
echo -e "\n" >>"$temp_file"
8+
# shellcheck disable=SC2129
9+
echo -e "\n$1\n" >>"$temp_file"
10+
cat "$2" >>"$temp_file" 2>/dev/null
11+
echo -e "\n" >>"$temp_file"
1212
}
1313

1414
# List all active jails
@@ -18,8 +18,8 @@ fail2ban-client status >>"$temp_file"
1818
# Get status for each jail
1919
jails=$(fail2ban-client status | grep 'Jail list:' | sed -E 's/^[^:]+:\s+//;s/,//g')
2020
for jail in $jails; do
21-
echo -e "\nStatus of $jail jail:\n" >>"$temp_file"
22-
fail2ban-client status "$jail" >>"$temp_file"
21+
echo -e "\nStatus of $jail jail:\n" >>"$temp_file"
22+
fail2ban-client status "$jail" >>"$temp_file"
2323
done
2424

2525
# Global configurations
@@ -29,8 +29,8 @@ add_content "Custom Global Configuration (/etc/fail2ban/jail.local):" "/etc/fail
2929
# Custom jail configurations in jail.d/
3030
echo "Custom Jail Configurations in /etc/fail2ban/jail.d/:" >>"$temp_file"
3131
for config_file in /etc/fail2ban/jail.d/*; do
32-
[ -e "$config_file" ] || continue
33-
add_content "Custom Jail Configuration ($config_file):" "$config_file"
32+
[ -e "$config_file" ] || continue
33+
add_content "Custom Jail Configuration ($config_file):" "$config_file"
3434
done
3535

3636
# Upload to termbin

omegabrr_upgrade.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ service_name="omegabrr@bakerboy448"
55

66
# Function to handle errors and exit
77
handle_error() {
8-
echo "Error: $1" >&2
9-
exit 1
8+
echo "Error: $1" >&2
9+
exit 1
1010
}
1111

1212
# Get the old version of omegabrr
1313
old_version=$(omegabrr version)
1414

1515
# Fetch the URL of the latest release for linux_x86_64
16-
dlurl=$(curl -s https://api.github.com/repos/autobrr/omegabrr/releases/latest |
17-
grep -E 'browser_download_url.*linux_x86_64' | cut -d\" -f4)
16+
dlurl=$(curl -s https://api.github.com/repos/autobrr/omegabrr/releases/latest \
17+
| grep -E 'browser_download_url.*linux_x86_64' | cut -d\" -f4)
1818

1919
# Validate the download URL
2020
if [ -z "$dlurl" ]; then
21-
handle_error "Failed to fetch download URL."
21+
handle_error "Failed to fetch download URL."
2222
fi
2323

2424
# Download the latest release

pic-update.sh

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,48 @@ CURRENT_UID=$(id -u)
1515

1616
# Check if Plex-Image-Cleanup is installed and the current user owns it
1717
check_pic_installation() {
18-
if [ -d "$PIC_PATH" ]; then
19-
local pic_repo_owner
20-
pic_repo_owner=$(stat -c '%u' "$PIC_PATH")
21-
if [ "$pic_repo_owner" != "$CURRENT_UID" ]; then
22-
echo "You do not own the Plex-Image-Cleanup repo. Please run this script as the user that owns the repo [$pic_repo_owner]."
23-
exit 1
24-
fi
25-
else
26-
echo "Plex-Image-Cleanup folder does not exist. Please install Plex-Image-Cleanup before running this script."
27-
exit 1
18+
if [ -d "$PIC_PATH" ]; then
19+
local pic_repo_owner
20+
pic_repo_owner=$(stat -c '%u' "$PIC_PATH")
21+
if [ "$pic_repo_owner" != "$CURRENT_UID" ]; then
22+
echo "You do not own the Plex-Image-Cleanup repo. Please run this script as the user that owns the repo [$pic_repo_owner]."
23+
exit 1
2824
fi
25+
else
26+
echo "Plex-Image-Cleanup folder does not exist. Please install Plex-Image-Cleanup before running this script."
27+
exit 1
28+
fi
2929
}
3030

3131
# Update Plex-Image-Cleanup if necessary
3232
update_pic() {
33-
current_branch=$(git -C "$PIC_PATH" rev-parse --abbrev-ref HEAD)
34-
echo "Current Branch: $current_branch. Checking for updates..."
35-
git -C "$PIC_PATH" fetch
36-
if [ "$(git -C "$PIC_PATH" rev-parse HEAD)" = "$(git -C "$PIC_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
37-
current_version=$(cat "$PIC_VERSION_FILE")
38-
echo "=== Already up to date $current_version on $current_branch ==="
39-
exit 0
40-
fi
41-
git -C "$PIC_PATH" reset --hard "$PIC_UPSTREAM_GIT_REMOTE/$current_branch"
33+
current_branch=$(git -C "$PIC_PATH" rev-parse --abbrev-ref HEAD)
34+
echo "Current Branch: $current_branch. Checking for updates..."
35+
git -C "$PIC_PATH" fetch
36+
if [ "$(git -C "$PIC_PATH" rev-parse HEAD)" = "$(git -C "$PIC_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
37+
current_version=$(cat "$PIC_VERSION_FILE")
38+
echo "=== Already up to date $current_version on $current_branch ==="
39+
exit 0
40+
fi
41+
git -C "$PIC_PATH" reset --hard "$PIC_UPSTREAM_GIT_REMOTE/$current_branch"
4242
}
4343

4444
# Update venv if necessary
4545
update_venv() {
46-
current_requirements=$(sha1sum "$PIC_REQUIREMENTS_FILE" | awk '{print $1}')
47-
new_requirements=$(sha1sum "$PIC_REQUIREMENTS_FILE" | awk '{print $1}')
48-
if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
49-
echo "=== Requirements changed, updating venv ==="
50-
"$PIC_VENV_PATH/bin/python3" "$PIC_VENV_PATH/bin/pip" install -r "$PIC_REQUIREMENTS_FILE"
51-
fi
46+
current_requirements=$(sha1sum "$PIC_REQUIREMENTS_FILE" | awk '{print $1}')
47+
new_requirements=$(sha1sum "$PIC_REQUIREMENTS_FILE" | awk '{print $1}')
48+
if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
49+
echo "=== Requirements changed, updating venv ==="
50+
"$PIC_VENV_PATH/bin/python3" "$PIC_VENV_PATH/bin/pip" install -r "$PIC_REQUIREMENTS_FILE"
51+
fi
5252
}
5353

5454
# Restart the Plex-Image-Cleanup service
5555
restart_service() {
56-
echo "=== Restarting Plex-Image-Cleanup Service ==="
57-
sudo systemctl restart "$PIC_SERVICE_NAME"
58-
new_version=$(cat "$PIC_VERSION_FILE")
59-
echo "=== Updated to $new_version on $current_branch ==="
56+
echo "=== Restarting Plex-Image-Cleanup Service ==="
57+
sudo systemctl restart "$PIC_SERVICE_NAME"
58+
new_version=$(cat "$PIC_VERSION_FILE")
59+
echo "=== Updated to $new_version on $current_branch ==="
6060
}
6161

6262
# Main script execution

pmm-update.sh

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,47 +16,47 @@ CURRENT_UID=$(id -u)
1616

1717
# Check if PMM is installed and the current user owns it
1818
check_pmm_installation() {
19-
if [ -d "$PMM_PATH" ]; then
20-
pmm_repo_owner=$(stat -c '%u' "$PMM_PATH")
21-
if [ "$pmm_repo_owner" != "$CURRENT_UID" ]; then
22-
echo "You do not own the Plex Meta Manager repo. Please run this script as the user that owns the repo [$pmm_repo_owner]."
23-
exit 1
24-
fi
25-
else
26-
echo "Plex Meta Manager folder does not exist. Please install Plex Meta Manager before running this script."
27-
exit 1
19+
if [ -d "$PMM_PATH" ]; then
20+
pmm_repo_owner=$(stat -c '%u' "$PMM_PATH")
21+
if [ "$pmm_repo_owner" != "$CURRENT_UID" ]; then
22+
echo "You do not own the Plex Meta Manager repo. Please run this script as the user that owns the repo [$pmm_repo_owner]."
23+
exit 1
2824
fi
25+
else
26+
echo "Plex Meta Manager folder does not exist. Please install Plex Meta Manager before running this script."
27+
exit 1
28+
fi
2929
}
3030

3131
# Update PMM if necessary
3232
update_pmm() {
33-
current_branch=$(git -C "$PMM_PATH" rev-parse --abbrev-ref HEAD)
34-
echo "Current Branch: $current_branch. Checking for updates..."
35-
git -C "$PMM_PATH" fetch
36-
if [ "$(git -C "$PMM_PATH" rev-parse HEAD)" = "$(git -C "$PMM_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
37-
current_version=$(cat "$PMM_VERSION_FILE")
38-
echo "=== Already up to date $current_version on $current_branch ==="
39-
exit 0
40-
fi
41-
git -C "$PMM_PATH" reset --hard "$PMM_UPSTREAM_GIT_REMOTE/$current_branch"
33+
current_branch=$(git -C "$PMM_PATH" rev-parse --abbrev-ref HEAD)
34+
echo "Current Branch: $current_branch. Checking for updates..."
35+
git -C "$PMM_PATH" fetch
36+
if [ "$(git -C "$PMM_PATH" rev-parse HEAD)" = "$(git -C "$PMM_PATH" rev-parse @'{u}')" ] && [ "$force_update" != true ]; then
37+
current_version=$(cat "$PMM_VERSION_FILE")
38+
echo "=== Already up to date $current_version on $current_branch ==="
39+
exit 0
40+
fi
41+
git -C "$PMM_PATH" reset --hard "$PMM_UPSTREAM_GIT_REMOTE/$current_branch"
4242
}
4343

4444
# Update venv if necessary
4545
update_venv() {
46-
current_requirements=$(sha1sum "$PMM_REQUIREMENTS_FILE" | awk '{print $1}')
47-
new_requirements=$(sha1sum "$PMM_REQUIREMENTS_FILE" | awk '{print $1}')
48-
if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
49-
echo "=== Requirements changed, updating venv ==="
50-
"$PMM_VENV_PATH/bin/python3" "$PMM_VENV_PATH/bin/pip" install -r "$PMM_REQUIREMENTS_FILE"
51-
fi
46+
current_requirements=$(sha1sum "$PMM_REQUIREMENTS_FILE" | awk '{print $1}')
47+
new_requirements=$(sha1sum "$PMM_REQUIREMENTS_FILE" | awk '{print $1}')
48+
if [ "$current_requirements" != "$new_requirements" ] || [ "$force_update" = true ]; then
49+
echo "=== Requirements changed, updating venv ==="
50+
"$PMM_VENV_PATH/bin/python3" "$PMM_VENV_PATH/bin/pip" install -r "$PMM_REQUIREMENTS_FILE"
51+
fi
5252
}
5353

5454
# Restart the PMM service
5555
restart_service() {
56-
echo "=== Restarting PMM Service ==="
57-
sudo systemctl restart "$PMM_SERVICE_NAME"
58-
new_version=$(cat "$PMM_VERSION_FILE")
59-
echo "=== Updated to $new_version on $current_branch"
56+
echo "=== Restarting PMM Service ==="
57+
sudo systemctl restart "$PMM_SERVICE_NAME"
58+
new_version=$(cat "$PMM_VERSION_FILE")
59+
echo "=== Updated to $new_version on $current_branch"
6060
}
6161

6262
# Main script execution

qbm-api-trigger.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ API_URL="http://127.0.0.1:4269/api/run-command"
2323
COMMANDS='["tag_update", "share_limits", "rem_unregistered", "recheck"]'
2424

2525
if [[ $# -lt 1 || -z "$1" ]]; then
26-
echo "Usage: $0 <torrent_hash>" >&2
27-
exit 1
26+
echo "Usage: $0 <torrent_hash>" >&2
27+
exit 1
2828
fi
2929

3030
TORRENT_HASH="$1"
@@ -34,15 +34,15 @@ LOG_FILE="${SCRIPT_DIR}/run_qbit_manage_commands.log"
3434
JSON="{\"commands\":${COMMANDS},\"hashes\":[\"${TORRENT_HASH}\"]}"
3535

3636
{
37-
echo "Sending API call for hash: ${TORRENT_HASH}"
38-
echo "Payload: ${JSON}"
37+
echo "Sending API call for hash: ${TORRENT_HASH}"
38+
echo "Payload: ${JSON}"
3939
} | tee -a "${LOG_FILE}"
4040

4141
if curl -fsSL -X POST \
42-
-H "Content-Type: application/json" \
43-
-d "${JSON}" \
44-
"${API_URL}" | tee -a "${LOG_FILE}"; then
45-
echo "Success" | tee -a "${LOG_FILE}"
42+
-H "Content-Type: application/json" \
43+
-d "${JSON}" \
44+
"${API_URL}" | tee -a "${LOG_FILE}"; then
45+
echo "Success" | tee -a "${LOG_FILE}"
4646
else
47-
echo "Error: qBit Manage API call failed for hash ${TORRENT_HASH}" | tee -a "${LOG_FILE}"
47+
echo "Error: qBit Manage API call failed for hash ${TORRENT_HASH}" | tee -a "${LOG_FILE}"
4848
fi

0 commit comments

Comments
 (0)