Improve deployment organization and bashrc structure

Script Organization:
- Deploy scripts to ~/scripts/ instead of ~/ directly
- Create proper symlinks ~/bin/script -> ~/scripts/script
- Libraries go to ~/scripts/lib_scriptname/ for better organization

Bashrc Improvements:
- Add modular .bashrc with .bash_env, .bash_aliases, .bash_paths
- Include HISTTIMEFORMAT and enhanced history settings
- Smart PATH detection - only adds ~/bin if not already present
- Proper bash completion and dircolors setup
- Maintains all original functionality from complex version

Deployment now creates clean, organized structure on target servers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
h0tznpl0tz
2025-09-11 16:25:37 +02:00
co-authored by Claude
parent 034018de87
commit 06647a1bf1
+40 -12
View File
@@ -101,15 +101,16 @@ deploy_script() {
return 0 return 0
fi fi
# Deployment ausführen # Deployment ausführen - ordentlich in ~/scripts/
scp "$original_script" "$ssh_target:$script_name" ssh "$ssh_target" "mkdir -p ~/scripts ~/bin"
ssh "$ssh_target" "chmod +x $script_name && mkdir -p ~/bin && ln -sf ~/$script_name ~/bin/$script_name" scp "$original_script" "$ssh_target:scripts/$script_name"
ssh "$ssh_target" "chmod +x ~/scripts/$script_name && ln -sf ~/scripts/$script_name ~/bin/$script_name"
# Lib-Dependencies falls vorhanden # Lib-Dependencies falls vorhanden
if [[ -d "$script_dir/lib" ]]; then if [[ -d "$script_dir/lib" ]]; then
echo " Deploying lib dependencies..." echo " Deploying lib dependencies..."
scp -r "$script_dir/lib" "$ssh_target:lib_$script_name" scp -r "$script_dir/lib" "$ssh_target:scripts/lib_$script_name"
ssh "$ssh_target" "sed -i 's|\$SCRIPT_DIR/lib/|~/lib_$script_name/|g' $script_name" ssh "$ssh_target" "sed -i 's|\$SCRIPT_DIR/lib/|~/scripts/lib_$script_name/|g' ~/scripts/$script_name"
fi fi
echo " ✓ $script_name deployed successfully" echo " ✓ $script_name deployed successfully"
@@ -127,25 +128,52 @@ deploy_bashrc() {
return 0 return 0
fi fi
# Erstelle einfache .bashrc mit PATH-Setup # Erstelle modulare .bashrc + config files
ssh "$ssh_target" 'cat > .bashrc << "EOF" ssh "$ssh_target" 'cat > .bashrc << "EOF"
# .bashrc - Einfache Bash-Konfiguration für easyname Support # .bashrc - Optimierte Bash-Konfiguration für easyname Support
# History ##### History #####
HISTCONTROL=ignoredups:erasedups HISTCONTROL=ignoredups:erasedups
HISTSIZE=50000 HISTSIZE=50000
HISTFILESIZE=100000 HISTFILESIZE=100000
HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S "
shopt -s histappend shopt -s histappend
shopt -s cmdhist
# PATH Setup ##### Prompt #####
[[ -d "$HOME/bin" && ":$PATH:" != *":$HOME/bin:"* ]] && PATH="$HOME/bin:$PATH" if [[ "$TERM" != "dumb" ]]; then
PS1="\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\\$ "
fi
# Prompt ##### Modular configs #####
[[ "$TERM" != "dumb" ]] && PS1="\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\\$ " [[ -f ~/.bash_aliases ]] && source ~/.bash_aliases
[[ -f ~/.bash_env ]] && source ~/.bash_env
[[ -f ~/.bash_paths ]] && source ~/.bash_paths
##### Standard settings #####
if [[ -f /etc/bash_completion ]]; then
source /etc/bash_completion
fi
if [[ -x /usr/bin/dircolors ]]; then
eval "$(dircolors -b)"
fi
# Built with the help of Claude Code # Built with the help of Claude Code
EOF' EOF'
# Erstelle modulare Config-Files mit PATH-Check
ssh "$ssh_target" 'echo "# Add your custom aliases here" > .bash_aliases'
ssh "$ssh_target" 'echo "# Add your PATH extensions here" > .bash_paths'
# Prüfe ob ~/bin bereits in PATH ist, wenn nicht -> zu .bash_env hinzufügen
ssh "$ssh_target" 'if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "# Add ~/bin to PATH for deployed scripts" > .bash_env
echo "export PATH=\"\$HOME/bin:\$PATH\"" >> .bash_env
else
echo "# Add your environment variables here" > .bash_env
fi'
echo " ✓ bashrc deployed successfully" echo " ✓ bashrc deployed successfully"
} }