chore: clean up dotfiles and add gitignore whitelist
Switch to whitelist-based .gitignore to only track essential configs: nvim, yazi, kitty, zsh, ideavim, karabiner, tmux, scripts, starship. Remove history, compiled files, and plugin dirs from tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +1,47 @@
|
||||
#!/bin/zsh
|
||||
set -euo pipefail
|
||||
|
||||
# Auto-remount TN shares when network changes.
|
||||
# Credentials should be stored in macOS Keychain (connect once via Finder, remember password).
|
||||
|
||||
# User Configuration
|
||||
USER="AK127132" # Insert Your AK Number
|
||||
PASSWORD="enzfcj4bhg!mwr8BUH" # Insert your password
|
||||
SERVER="140.78.8.107"
|
||||
SHARE1="TNGROUP/tn-group/ipec"
|
||||
SHARE2="TNHOME/home/AK127132"
|
||||
|
||||
# Mount TNGROUP
|
||||
echo "Mounting TNGROUP..."
|
||||
osascript -e "try" -e "mount volume \"smb://$USER:$PASSWORD@$SERVER/$SHARE1\"" -e "end try"
|
||||
# Use URL-encoded path segments for spaces if needed.
|
||||
SHARE1_URL="smb://$SERVER/TNGROUP/tn-group/ipec"
|
||||
SHARE2_URL="smb://$SERVER/TNHOME/home/AK127132"
|
||||
|
||||
# Mount TNHOME
|
||||
echo "Mounting TNHOME..."
|
||||
osascript -e "try" -e "mount volume \"smb://$USER:$PASSWORD@$SERVER/$SHARE2\"" -e "end try"
|
||||
# Expected mount points under /Volumes (adjust if your Finder mount names differ)
|
||||
MOUNT1="/Volumes/ipec"
|
||||
MOUNT2="/Volumes/AK127132"
|
||||
|
||||
echo "Mounting complete."
|
||||
log() {
|
||||
echo "[tnmount] $*"
|
||||
}
|
||||
|
||||
is_mounted() {
|
||||
local mountpoint="$1"
|
||||
mount | grep -q " on ${mountpoint} "
|
||||
}
|
||||
|
||||
mount_if_missing() {
|
||||
local mountpoint="$1"
|
||||
local url="$2"
|
||||
|
||||
if is_mounted "$mountpoint"; then
|
||||
log "Already mounted: $mountpoint"
|
||||
else
|
||||
log "Mounting: $url"
|
||||
open "$url"
|
||||
fi
|
||||
}
|
||||
|
||||
# Skip when server is unreachable (offsite/no VPN), try again on next interval.
|
||||
if ! nc -zw2 "$SERVER" 445 >/dev/null 2>&1; then
|
||||
log "Server $SERVER:445 not reachable; skipping"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mount_if_missing "$MOUNT1" "$SHARE1_URL"
|
||||
mount_if_missing "$MOUNT2" "$SHARE2_URL"
|
||||
|
||||
log "Done"
|
||||
|
||||
Reference in New Issue
Block a user