mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
commit
1e25e36ce6
195 files changed
+152301
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOGFILE="$HOME/dsstore_cleanup.log"
|
||||
|
||||
echo "=============================" | tee -a "$LOGFILE"
|
||||
echo "Starting cleanup: $(date)" | tee -a "$LOGFILE"
|
||||
|
||||
# Supported Apple settings
|
||||
echo "[1] Disable .DS_Store on network volumes..."
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
|
||||
echo "[2] Disable .DS_Store on USB/removable volumes..."
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
|
||||
# Global Git ignore
|
||||
echo "[3] Adding .DS_Store to global git ignore..."
|
||||
touch ~/.gitignore_global
|
||||
grep -qxF ".DS_Store" ~/.gitignore_global || echo ".DS_Store" >> ~/.gitignore_global
|
||||
git config --global core.excludesfile ~/.gitignore_global
|
||||
|
||||
# Delete existing files on all mounted volumes
|
||||
echo "[4] Removing .DS_Store files from all local volumes..."
|
||||
sudo find /Volumes /System/Volumes/Data "$HOME" \
|
||||
-name ".DS_Store" -print -delete 2>/dev/null | tee -a "$LOGFILE"
|
||||
|
||||
echo "[5] Restarting Finder..."
|
||||
killall Finder 2>/dev/null
|
||||
|
||||
echo "Finished: $(date)" | tee -a "$LOGFILE"
|
||||
echo "============================="
|
||||
@@ -0,0 +1,44 @@
|
||||
<<<<<<< HEAD
|
||||
# mac-scripts
|
||||
|
||||
## Purpose
|
||||
This directory contains files related to **mac scripts**.
|
||||
|
||||
## Contents
|
||||
- `not working- download-sync.sh`
|
||||
- `rsync basic.sh`
|
||||
- `disable_DS_store.sh`
|
||||
|
||||
## Usage
|
||||
- Review each script or configuration file before running
|
||||
- Some scripts may require **root or sudo**
|
||||
- Paths and variables may need adjustment for your environment
|
||||
|
||||
## Notes
|
||||
- This folder is part of the **public-setupfiles** repository
|
||||
- Files are provided as-is for reference or automation
|
||||
|
||||
## Safety
|
||||
Always back up data before running scripts that modify system state.
|
||||
=======
|
||||
# mac-scripts
|
||||
|
||||
## Overview
|
||||
This directory is part of the **public-setupfiles** repository.
|
||||
It contains scripts, configuration files, or resources related to **mac-scripts**.
|
||||
|
||||
## Usage
|
||||
- Review scripts before execution
|
||||
- Some files may require **root or sudo privileges**
|
||||
- Paths, variables, or credentials may need customization
|
||||
|
||||
## Logging & Output
|
||||
Scripts may generate logs or output files in the same directory or system locations.
|
||||
|
||||
## Safety Notes
|
||||
- Always back up important data before running scripts
|
||||
- Test in a non-production environment when possible
|
||||
- Use at your own risk
|
||||
|
||||
---
|
||||
>>>>>>> main
|
||||
@@ -0,0 +1,40 @@
|
||||
# brewscripts
|
||||
|
||||
<<<<<<< HEAD
|
||||
## Purpose
|
||||
This directory contains files related to **brewscripts**.
|
||||
|
||||
## Contents
|
||||
- `update-brew-packages.sh`
|
||||
|
||||
## Usage
|
||||
- Review each script or configuration file before running
|
||||
- Some scripts may require **root or sudo**
|
||||
- Paths and variables may need adjustment for your environment
|
||||
|
||||
## Notes
|
||||
- This folder is part of the **public-setupfiles** repository
|
||||
- Files are provided as-is for reference or automation
|
||||
|
||||
## Safety
|
||||
Always back up data before running scripts that modify system state.
|
||||
=======
|
||||
## Overview
|
||||
This directory is part of the **public-setupfiles** repository.
|
||||
It contains scripts, configuration files, or resources related to **brewscripts**.
|
||||
|
||||
## Usage
|
||||
- Review scripts before execution
|
||||
- Some files may require **root or sudo privileges**
|
||||
- Paths, variables, or credentials may need customization
|
||||
|
||||
## Logging & Output
|
||||
Scripts may generate logs or output files in the same directory or system locations.
|
||||
|
||||
## Safety Notes
|
||||
- Always back up important data before running scripts
|
||||
- Test in a non-production environment when possible
|
||||
- Use at your own risk
|
||||
|
||||
---
|
||||
>>>>>>> main
|
||||
@@ -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. 👍"
|
||||
@@ -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."
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/bin/zsh
|
||||
|
||||
echo "=== Updating Homebrew ==="
|
||||
brew update && brew upgrade
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
if [ -n "$(brew list --cask 2>/dev/null)" ]; then
|
||||
echo "=== Updating Homebrew Casks ==="
|
||||
brew upgrade --cask
|
||||
fi
|
||||
echo "=== Cleaning up Homebrew ==="
|
||||
brew cleanup
|
||||
fi
|
||||
|
||||
echo "=== Updating npm (if available) ==="
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
npm install -g npm@latest
|
||||
else
|
||||
echo "npm not found, skipping."
|
||||
fi
|
||||
|
||||
echo "=== Updating pip (if available) ==="
|
||||
if command -v pip3 >/dev/null 2>&1; then
|
||||
pip3 install --upgrade pip
|
||||
else
|
||||
echo "pip3 not found, skipping."
|
||||
fi
|
||||
|
||||
echo "=== Updating pip packages ==="
|
||||
pip3 list --outdated --format=freeze 2>/dev/null | grep -v '^##' | cut -d '=' -f 1 | while read package; do
|
||||
echo "Updating $package..."
|
||||
pip3 install --upgrade "$package"
|
||||
done
|
||||
|
||||
echo "=== Checking for macOS updates ==="
|
||||
echo "If any macOS updates are available, you may need to install them via System Settings > General > Software Update."
|
||||
softwareupdate -l 2>/dev/null
|
||||
|
||||
echo "=== Update complete! ==="
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/zsh
|
||||
|
||||
echo "=== Updating macOS Software ==="
|
||||
softwareupdate -i -a
|
||||
|
||||
echo "=== Updating Homebrew ==="
|
||||
brew update && brew upgrade
|
||||
if [ -n "$(brew list --cask 2>/dev/null)" ]; then
|
||||
echo "=== Updating Casks ==="
|
||||
brew upgrade --cask
|
||||
fi
|
||||
brew cleanup
|
||||
|
||||
echo "=== Updating npm (if available) ==="
|
||||
if command -v npm >/dev/null 2>&1; then
|
||||
npm install -g npm@latest
|
||||
else
|
||||
echo "npm not found, skipping."
|
||||
fi
|
||||
|
||||
echo "=== Updating pip3 packages ==="
|
||||
if command -v pip3 >/dev/null 2>&1; then
|
||||
# Upgrade pip itself first
|
||||
pip3 install --upgrade pip
|
||||
# Then list and upgrade all outdated packages
|
||||
pip3 list --outdated --format=freeze 2>/dev/null | grep -v '^#' | cut -d '=' -f 1 | while read pkg; do
|
||||
echo "Updating $pkg..."
|
||||
pip3 install --upgrade "$pkg"
|
||||
done
|
||||
else
|
||||
echo "pip3 not found, skipping."
|
||||
fi
|
||||
|
||||
echo "=== System Update Complete ==="
|
||||
Reference in new issue
Block a user