Compare commits
2 Commits
16cbadd016
...
0fc1b3cba0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fc1b3cba0 | ||
|
|
3860c8a33d |
11
README.md
11
README.md
@@ -232,6 +232,13 @@ on the remote.
|
|||||||
# Push everything (dotfiles + scripts):
|
# Push everything (dotfiles + scripts):
|
||||||
dotfiles deploy-to user@server
|
dotfiles deploy-to user@server
|
||||||
|
|
||||||
|
# After file transfer, also run setup_enterprise_ai_bash.sh on the remote
|
||||||
|
# to create ~/workspace, ~/data, ~/models and write shell config:
|
||||||
|
dotfiles deploy-to user@server --run-setup
|
||||||
|
|
||||||
|
# Specify a machine profile for the setup script (default: work):
|
||||||
|
dotfiles deploy-to user@server --run-setup --profile work
|
||||||
|
|
||||||
# Scripts only (dotfiles_manager.sh, bootstrap.sh, setup script):
|
# Scripts only (dotfiles_manager.sh, bootstrap.sh, setup script):
|
||||||
dotfiles deploy-to user@server --scripts-only
|
dotfiles deploy-to user@server --scripts-only
|
||||||
|
|
||||||
@@ -251,6 +258,10 @@ Files are copied directly (not symlinked). Re-run `deploy-to` any time you
|
|||||||
want to push updates. `~/.ssh/` is skipped by default to avoid accidentally
|
want to push updates. `~/.ssh/` is skipped by default to avoid accidentally
|
||||||
pushing private keys or your personal known_hosts to a shared server.
|
pushing private keys or your personal known_hosts to a shared server.
|
||||||
|
|
||||||
|
> **First-time setup on a server?** Use `--run-setup` to create the full
|
||||||
|
> directory structure after file transfer, or answer `y` when prompted
|
||||||
|
> interactively at the end of a normal `deploy-to` run.
|
||||||
|
|
||||||
### Centrally managing `~/.bashrc.local` for servers
|
### Centrally managing `~/.bashrc.local` for servers
|
||||||
|
|
||||||
Work servers can't reach the Gitea repo, so their `~/.bashrc.local` is managed
|
Work servers can't reach the Gitea repo, so their `~/.bashrc.local` is managed
|
||||||
|
|||||||
@@ -883,20 +883,24 @@ cmd_remote_bootstrap() {
|
|||||||
# COMMAND: deploy-to (push dotfiles to a server that can't reach Gitea)
|
# COMMAND: deploy-to (push dotfiles to a server that can't reach Gitea)
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
cmd_deploy_to() {
|
cmd_deploy_to() {
|
||||||
[ $# -ge 1 ] || die "Usage: deploy-to <user@host> [--scripts-only] [--include-ssh] [--no-backup] [--dry-run]"
|
[ $# -ge 1 ] || die "Usage: deploy-to <user@host> [--scripts-only] [--include-ssh] [--no-backup] [--run-setup] [--profile work|personal] [--dry-run]"
|
||||||
|
|
||||||
local target="$1"; shift
|
local target="$1"; shift
|
||||||
local scripts_only=false
|
local scripts_only=false
|
||||||
local skip_ssh=true # default: skip .ssh/ — avoid pushing keys/config to servers
|
local skip_ssh=true # default: skip .ssh/ — avoid pushing keys/config to servers
|
||||||
local no_backup=false
|
local no_backup=false
|
||||||
|
local run_setup=false
|
||||||
|
local setup_profile="work" # default profile for servers
|
||||||
local dry_run=false
|
local dry_run=false
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--scripts-only) scripts_only=true; shift ;;
|
--scripts-only) scripts_only=true; shift ;;
|
||||||
--include-ssh) skip_ssh=false; shift ;;
|
--include-ssh) skip_ssh=false; shift ;;
|
||||||
--no-backup) no_backup=true; shift ;;
|
--no-backup) no_backup=true; shift ;;
|
||||||
--dry-run) dry_run=true; shift ;;
|
--run-setup) run_setup=true; shift ;;
|
||||||
|
--profile) setup_profile="${2:-work}"; shift 2 ;;
|
||||||
|
--dry-run) dry_run=true; shift ;;
|
||||||
*) die "Unknown option: $1" ;;
|
*) die "Unknown option: $1" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@@ -1076,6 +1080,26 @@ cmd_deploy_to() {
|
|||||||
info "Create one to manage ~/.bashrc.local centrally: dotfiles/hosts/${remote_short}.bashrc.local"
|
info "Create one to manage ~/.bashrc.local centrally: dotfiles/hosts/${remote_short}.bashrc.local"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ---- 6. Optionally run setup on the remote ----
|
||||||
|
if ! $dry_run; then
|
||||||
|
local do_setup=$run_setup
|
||||||
|
if ! $run_setup; then
|
||||||
|
echo
|
||||||
|
read -r -p "Run setup_enterprise_ai_bash.sh on $target now? Creates dirs, writes shell config. (y/n): " _ans
|
||||||
|
[[ "$_ans" == [yY] ]] && do_setup=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $do_setup; then
|
||||||
|
echo
|
||||||
|
info "Running setup on $target (profile=$setup_profile)..."
|
||||||
|
info "This will create the directory structure and write shell config."
|
||||||
|
echo
|
||||||
|
ssh -t "$target" \
|
||||||
|
"MACHINE_PROFILE=${setup_profile} DOTFILES_REMOTE=${DOTFILES_REMOTE} bash ~/scripts/setup_enterprise_ai_bash.sh"
|
||||||
|
success "Setup complete on $target."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
if $dry_run; then
|
if $dry_run; then
|
||||||
info "Dry run complete. Re-run without --dry-run to transfer files."
|
info "Dry run complete. Re-run without --dry-run to transfer files."
|
||||||
@@ -1083,6 +1107,7 @@ cmd_deploy_to() {
|
|||||||
bold "Deploy complete: $deployed file(s) deployed, $skipped skipped."
|
bold "Deploy complete: $deployed file(s) deployed, $skipped skipped."
|
||||||
info "Files were copied directly (no symlinks). Re-run deploy-to to push updates."
|
info "Files were copied directly (no symlinks). Re-run deploy-to to push updates."
|
||||||
$skip_ssh && info "~/.ssh/ was skipped. Use --include-ssh to also deploy ~/.ssh/config."
|
$skip_ssh && info "~/.ssh/ was skipped. Use --include-ssh to also deploy ~/.ssh/config."
|
||||||
|
! $run_setup && info "Tip: add --run-setup to also create directories and shell config on the remote."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,14 +1139,17 @@ ${BOLD}COMMANDS — SSH & Keys${RESET}
|
|||||||
${BOLD}COMMANDS — Multi-machine${RESET}
|
${BOLD}COMMANDS — Multi-machine${RESET}
|
||||||
remote-bootstrap <user@host> [--profile work|personal]
|
remote-bootstrap <user@host> [--profile work|personal]
|
||||||
Upload scripts and run full setup on a remote machine
|
Upload scripts and run full setup on a remote machine
|
||||||
deploy-to <user@host> [--scripts-only] [--include-ssh] [--no-backup] [--dry-run]
|
deploy-to <user@host> [--scripts-only] [--include-ssh] [--no-backup] [--run-setup] [--profile work|personal] [--dry-run]
|
||||||
SCP tracked dotfiles + scripts directly to a server.
|
SCP tracked dotfiles + scripts directly to a server.
|
||||||
Use when the server can't reach the Gitea repo.
|
Use when the server can't reach the Gitea repo.
|
||||||
Backs up existing remote files locally before overwriting.
|
Backs up existing remote files locally before overwriting.
|
||||||
--scripts-only Only push ~/scripts/, skip dotfiles
|
--scripts-only Only push ~/scripts/, skip dotfiles
|
||||||
--include-ssh Also deploy ~/.ssh/config (skipped by default)
|
--include-ssh Also deploy ~/.ssh/config (skipped by default)
|
||||||
--no-backup Skip the pre-deploy remote backup
|
--no-backup Skip the pre-deploy remote backup
|
||||||
--dry-run Preview what would be transferred
|
--run-setup Run setup_enterprise_ai_bash.sh on the remote
|
||||||
|
after deploy (creates dirs, shell config)
|
||||||
|
--profile work|personal Profile to pass to setup (default: work)
|
||||||
|
--dry-run Preview what would be transferred
|
||||||
|
|
||||||
${BOLD}QUICK START — this machine (work)${RESET}
|
${BOLD}QUICK START — this machine (work)${RESET}
|
||||||
./dotfiles_manager.sh init
|
./dotfiles_manager.sh init
|
||||||
|
|||||||
Reference in New Issue
Block a user