mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
Reorganize repository structure and refresh READMEs
This commit is contained in:
1 parent
2270530d9e
commit
a8b7ccbf2a
170 files changed
+616
-1391
No files matched your search
@@ -0,0 +1,16 @@
|
||||
# mac-scripts
|
||||
|
||||
## Overview
|
||||
macOS utility scripts for Finder behavior, rsync tasks, package maintenance, and related automation.
|
||||
|
||||
## Contents
|
||||
- `brewscripts`
|
||||
- `disable_DS_store.sh`
|
||||
- `not working- download-sync.sh`
|
||||
- `rsync basic.sh`
|
||||
|
||||
## Usage
|
||||
Use the script that matches the macOS task you want to automate.
|
||||
|
||||
## Notes
|
||||
macOS path, permission, and launch behavior can differ from Linux, so test each workflow locally first.
|
||||
@@ -0,0 +1,13 @@
|
||||
# brewscripts
|
||||
|
||||
## Overview
|
||||
Homebrew maintenance helpers used from within the macOS scripts area.
|
||||
|
||||
## Contents
|
||||
- `update-brew-packages.sh`
|
||||
|
||||
## Usage
|
||||
Use these scripts when updating or maintaining Homebrew packages on macOS.
|
||||
|
||||
## Notes
|
||||
Make sure Homebrew is installed and available in the expected shell environment first.
|
||||
@@ -0,0 +1,141 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
|
||||
# ---------- helpers ----------
|
||||
cecho() { printf "%b%s%b\n" "\033[1;36m" "$1" "\033[0m"; } # cyan bold
|
||||
wecho() { printf "%b%s%b\n" "\033[1;33m" "$1" "\033[0m"; } # yellow bold
|
||||
eecho() { printf "%b%s%b\n" "\033[1;31m" "$1" "\033[0m"; } # red bold
|
||||
gecho() { printf "%b%s%b\n" "\033[1;32m" "$1" "\033[0m"; } # green bold
|
||||
|
||||
# ---------- checks ----------
|
||||
if ! command -v brew >/dev/null 2>&1; then
|
||||
eecho "Homebrew not found. Install from https://brew.sh and re-run."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---------- gather installed casks ----------
|
||||
cecho "Collecting installed casks..."
|
||||
mapfile -t INSTALLED_CASKS < <(brew list --cask 2>/dev/null || true)
|
||||
|
||||
if [[ ${#INSTALLED_CASKS[@]} -eq 0 ]]; then
|
||||
wecho "No casks installed. Nothing to do."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ---------- detect deprecated/disabled ----------
|
||||
cecho "Checking cask status (deprecated/disabled/discontinued)..."
|
||||
DEPRECATED=()
|
||||
for c in "${INSTALLED_CASKS[@]}"; do
|
||||
# Brew prints status text in `brew info --cask`
|
||||
INFO="$(brew info --cask "$c" 2>/dev/null || true)"
|
||||
if echo "$INFO" | grep -qiE 'deprecated|disabled|discontinued'; then
|
||||
DEPRECATED+=("$c")
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#DEPRECATED[@]} -eq 0 ]]; then
|
||||
gecho "No deprecated or disabled casks detected. ✅"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
wecho "Deprecated/disabled casks detected:"
|
||||
for c in "${DEPRECATED[@]}"; do echo " - $c"; done
|
||||
echo
|
||||
|
||||
# ---------- confirm removal ----------
|
||||
read -r -p "Proceed to uninstall ALL of the above casks? [y/N] " ans
|
||||
if [[ ! "$ans" =~ ^[Yy]$ ]]; then
|
||||
wecho "Aborting uninstall by user choice."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ---------- uninstall ----------
|
||||
REMOVED=()
|
||||
FAILED=()
|
||||
for c in "${DEPRECATED[@]}"; do
|
||||
cecho "Uninstalling $c ..."
|
||||
if brew uninstall --cask "$c"; then
|
||||
REMOVED+=("$c")
|
||||
else
|
||||
FAILED+=("$c")
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
gecho "Uninstall complete."
|
||||
if [[ ${#REMOVED[@]} -gt 0 ]]; then
|
||||
gecho "Successfully removed:"
|
||||
for c in "${REMOVED[@]}"; do echo " - $c"; done
|
||||
fi
|
||||
if [[ ${#FAILED[@]} -gt 0 ]]; then
|
||||
eecho "Failed to remove:"
|
||||
for c in "${FAILED[@]}"; do echo " - $c"; done
|
||||
fi
|
||||
echo
|
||||
|
||||
# ---------- cleanup & autoremove ----------
|
||||
cecho "Running cleanup..."
|
||||
brew cleanup -s
|
||||
brew autoremove || true
|
||||
gecho "Cleanup done."
|
||||
echo
|
||||
|
||||
# ---------- offer optional replacements ----------
|
||||
# We’ll offer common replacements for known casks you had:
|
||||
OFFER_GSTREAMER=false
|
||||
OFFER_PWSH=false
|
||||
|
||||
for c in "${REMOVED[@]}"; do
|
||||
case "$c" in
|
||||
gstreamer-runtime|gstreamer-development)
|
||||
OFFER_GSTREAMER=true
|
||||
;;
|
||||
powershell)
|
||||
OFFER_PWSH=true
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
OPTIONS=()
|
||||
[[ "$OFFER_GSTREAMER" == true ]] && OPTIONS+=("1) Install GStreamer via Homebrew (formula: gstreamer)")
|
||||
[[ "$OFFER_GSTREAMER" == true ]] && OPTIONS+=("2) Open official GStreamer downloads page in browser")
|
||||
[[ "$OFFER_PWSH" == true ]] && OPTIONS+=("3) Install PowerShell via Homebrew cask (stable)")
|
||||
[[ "$OFFER_PWSH" == true ]] && OPTIONS+=("4) Open official PowerShell releases in browser")
|
||||
|
||||
if [[ ${#OPTIONS[@]} -gt 0 ]]; then
|
||||
cecho "Optional replacements (enter numbers separated by spaces, or press Enter to skip):"
|
||||
for opt in "${OPTIONS[@]}"; do echo " $opt"; done
|
||||
read -r -p "Choice(s): " choices
|
||||
echo
|
||||
|
||||
for choice in $choices; do
|
||||
case "$choice" in
|
||||
1)
|
||||
cecho "Installing GStreamer (formula)..."
|
||||
brew install gstreamer || eecho "Failed to install gstreamer."
|
||||
;;
|
||||
2)
|
||||
cecho "Opening GStreamer downloads page..."
|
||||
# Official downloads
|
||||
open "https://gstreamer.freedesktop.org/download/"
|
||||
;;
|
||||
3)
|
||||
cecho "Installing PowerShell (cask)..."
|
||||
# Homebrew core cask usually handles latest stable
|
||||
brew install --cask powershell || eecho "Failed to install PowerShell."
|
||||
;;
|
||||
4)
|
||||
cecho "Opening PowerShell releases page..."
|
||||
open "https://github.com/PowerShell/PowerShell/releases"
|
||||
;;
|
||||
*)
|
||||
wecho "Unknown option: $choice (skipped)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
else
|
||||
wecho "No known replacements to offer for removed casks."
|
||||
fi
|
||||
|
||||
gecho "All set. 👍"
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Disabling creation of .DS_Store on network drives..."
|
||||
|
||||
# Disable writing .DS_Store files on network volumes
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
|
||||
sudo defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
|
||||
|
||||
echo "Deleting existing .DS_Store files in home directory..."
|
||||
sudo find ~ -name ".DS_Store" -delete
|
||||
|
||||
echo "Done. A reboot is required for changes to take effect."
|
||||
@@ -0,0 +1 @@
|
||||
rsync -r -v /Users/traver/Downloads/ traver@10.0.85.10:'/srv/dev-disk-by-uuid-c725afdf-5b01-4c4b-9e26-16d7abfced6b/public/downloads/Mac Downloads/Apps'
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SMB share credentials
|
||||
NAS_USERNAME="your_username"
|
||||
NAS_PASSWORD="your_password"
|
||||
NAS_ADDRESS="nas"
|
||||
NAS_SHARE="mymedia"
|
||||
|
||||
# Local folders to sync
|
||||
LOCAL_FOLDERS=(
|
||||
"/path/to/your/folder1"
|
||||
"/path/to/your/folder2"
|
||||
)
|
||||
|
||||
# Mount point for the SMB share
|
||||
MOUNT_POINT="/Volumes/mymedia"
|
||||
|
||||
# Ensure the mount point exists
|
||||
if [ ! -d "$MOUNT_POINT" ]; then
|
||||
mkdir -p "$MOUNT_POINT"
|
||||
fi
|
||||
|
||||
# Mount the SMB share
|
||||
echo "Mounting SMB share..."
|
||||
mount -t smbfs "//$NAS_USERNAME:$NAS_PASSWORD@$NAS_ADDRESS/$NAS_SHARE" "$MOUNT_POINT"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to mount SMB share. Please check your credentials and network connection."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "SMB share mounted successfully at $MOUNT_POINT."
|
||||
|
||||
# Sync local folders to the SMB share
|
||||
for LOCAL_FOLDER in "${LOCAL_FOLDERS[@]}"; do
|
||||
BASENAME=$(basename "$LOCAL_FOLDER")
|
||||
DESTINATION="$MOUNT_POINT/$BASENAME"
|
||||
|
||||
echo "Syncing $LOCAL_FOLDER to $DESTINATION..."
|
||||
rsync -avh --progress "$LOCAL_FOLDER/" "$DESTINATION/"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to sync $LOCAL_FOLDER."
|
||||
else
|
||||
echo "Successfully synced $LOCAL_FOLDER."
|
||||
fi
|
||||
done
|
||||
|
||||
# Unmount the SMB share
|
||||
echo "Unmounting SMB share..."
|
||||
umount "$MOUNT_POINT"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to unmount SMB share. Please unmount it manually."
|
||||
else
|
||||
echo "SMB share unmounted successfully."
|
||||
fi
|
||||
|
||||
echo "Sync operation completed."
|
||||
Reference in new issue
Block a user