From 77cb1f013aeac7321f334d5245852e151c2e7969 Mon Sep 17 00:00:00 2001 From: Sebastian Cabrera Date: Thu, 14 May 2026 15:48:35 -0400 Subject: [PATCH] fix shell hinting --- scripts/adduser.sh | 2 +- scripts/dock.sh | 2 +- scripts/movefiles.sh | 20 ++++++++++---------- scripts/rclone-sync.sh | 2 +- scripts/toggle-metal-hud.sh | 2 +- scripts/update-forgejo.sh | 27 +++++++++++++++++++++++++++ 6 files changed, 41 insertions(+), 14 deletions(-) create mode 100644 scripts/update-forgejo.sh diff --git a/scripts/adduser.sh b/scripts/adduser.sh index e76d582..0ebc319 100755 --- a/scripts/adduser.sh +++ b/scripts/adduser.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash PASSWD_FILE="/etc/squid/passwd" diff --git a/scripts/dock.sh b/scripts/dock.sh index 9babdd6..0d0ec42 100755 --- a/scripts/dock.sh +++ b/scripts/dock.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # Function to check dock size check_dock() { diff --git a/scripts/movefiles.sh b/scripts/movefiles.sh index 15b3221..c7bf7ec 100755 --- a/scripts/movefiles.sh +++ b/scripts/movefiles.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Default values VERBOSE=false @@ -61,42 +61,42 @@ moved_count=0 # Function to process files process_files() { local find_cmd="find \"$SOURCE_DIR\" -maxdepth 1 -type f -iname \"*$SEARCH_WORD*\"" - + # Exclude .part files and macOS resource fork files by default if [ "$INCLUDE_PART" = false ]; then find_cmd="$find_cmd -not -name \"*.part\"" fi find_cmd="$find_cmd -not -name \"._*\"" - + # First, show what would be moved echo "The following files would be moved:" eval "$find_cmd" - + # Count files that would be moved local file_count=$(eval "$find_cmd" | wc -l) - + if [ "$file_count" -eq 0 ]; then echo "No matching files found." exit 0 fi - + # Show what actions will be taken echo if [ ! -d "$DEST_DIR" ]; then echo "The destination directory '$DEST_DIR' will be created." fi echo "Files will be moved to: '$DEST_DIR'" - + # Prompt for confirmation echo -n "Do you want to proceed? (y/n): " read -r response - + if [[ "$response" =~ ^[Yy]$ ]]; then # Create destination directory if needed if [ ! -d "$DEST_DIR" ]; then mkdir -p "$DEST_DIR" fi - + while IFS= read -r file; do if [ "$VERBOSE" = true ]; then echo "Moving: $file" @@ -107,7 +107,7 @@ process_files() { echo "Error: Failed to move '$file'" >&2 fi done < <(eval "$find_cmd") - + echo "Operation completed. $moved_count file(s) moved to '$DEST_DIR'" else echo "Operation cancelled." diff --git a/scripts/rclone-sync.sh b/scripts/rclone-sync.sh index 23e6d83..1247651 100755 --- a/scripts/rclone-sync.sh +++ b/scripts/rclone-sync.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Set timezone to US Eastern (handles both EST and EDT correctly) export TZ="America/New_York" diff --git a/scripts/toggle-metal-hud.sh b/scripts/toggle-metal-hud.sh index bf5098d..ba8cc32 100755 --- a/scripts/toggle-metal-hud.sh +++ b/scripts/toggle-metal-hud.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check if the Metal HUD is currently enabled MTL_STATUS=$(/bin/launchctl getenv MTL_HUD_ENABLED 2>/dev/null) diff --git a/scripts/update-forgejo.sh b/scripts/update-forgejo.sh new file mode 100644 index 0000000..62a457b --- /dev/null +++ b/scripts/update-forgejo.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +if [ -z "$1" ]; then + echo "Usage: $0 " + echo "Example: $0 11.0.10" + exit 1 +fi + +VERSION="$1" + +case "$(uname -m)" in + x86_64) ARCH="amd64" ;; + aarch64) ARCH="arm64" ;; + armv7l) ARCH="arm-6" ;; + *) + echo "Unsupported architecture: $(uname -m)" + exit 1 + ;; +esac + +BINARY="forgejo-${VERSION}-linux-${ARCH}" + +wget "https://codeberg.org/forgejo/forgejo/releases/download/v${VERSION}/${BINARY}" +chmod +x "$BINARY" +systemctl stop forgejo +cp "$BINARY" /usr/local/bin/forgejo +systemctl start forgejo