Compare commits
4 Commits
791165b415
...
fa06fbb9dd
Author | SHA1 | Date | |
---|---|---|---|
fa06fbb9dd | |||
4f0e173ce2 | |||
aebb5eab85 | |||
e298ee43c2 |
@ -159,11 +159,14 @@ update)
|
|||||||
case "${args[0]}" in
|
case "${args[0]}" in
|
||||||
containerfile) update 0 Containerfile . 500 ;;
|
containerfile) update 0 Containerfile . 500 ;;
|
||||||
access) update 2 access.yml . 400 ;;
|
access) update 2 access.yml . 400 ;;
|
||||||
authorized_keys) update 2 authorized_keys . 400 ;;
|
authorized_keys) update 2 authorized_keys .ssh 400 ;;
|
||||||
ssh_router) update 1 ssh_router.sh .local/bin 500 ;;
|
ssh_router) update 1 ssh_router.sh .local/bin 500 ;;
|
||||||
gitops_router) update 1 gitops_router.sh .local/bin 500 ;;
|
gitops_router) update 1 gitops_router.sh .local/bin 500 ;;
|
||||||
validate_command) update 1 validate_command_access.sh .local/bin 500 ;;
|
validate_command) update 1 validate_command_access.sh .local/bin 500 ;;
|
||||||
home_tar) podman cp "$PERSON":/app/workspaces/home.tar.gz "$HOME"/ ;;
|
home_tar)
|
||||||
|
podman cp "$PERSON":/app/workspaces/home.tar.gz "$HOME"/
|
||||||
|
chmod 600 "$HOME"/home.tar.gz
|
||||||
|
;;
|
||||||
gitconfig) update 0 gitconfig.template . 500 ;;
|
gitconfig) update 0 gitconfig.template . 500 ;;
|
||||||
*) log ERROR "update: invalid arg '${args[0]}'" ;;
|
*) log ERROR "update: invalid arg '${args[0]}'" ;;
|
||||||
esac
|
esac
|
||||||
|
@ -98,8 +98,8 @@ generate_gitconfig() {
|
|||||||
local userdir="$HOME/secrets/$ws"
|
local userdir="$HOME/secrets/$ws"
|
||||||
local name email
|
local name email
|
||||||
|
|
||||||
name=$(yq ".\"$ws\".name" "$access" 2>/dev/null || echo)
|
name=$(yq -r ".\"$ws\".name" "$access" 2>/dev/null || echo)
|
||||||
email=$(yq ".\"$ws\".email" "$access" 2>/dev/null || echo)
|
email=$(yq -r ".\"$ws\".email" "$access" 2>/dev/null || echo)
|
||||||
|
|
||||||
if [[ -z "$name" || -z "$email" ]]; then
|
if [[ -z "$name" || -z "$email" ]]; then
|
||||||
log ERROR "Missing name/email for '$ws' in $access"
|
log ERROR "Missing name/email for '$ws' in $access"
|
||||||
@ -178,16 +178,21 @@ case "$MODE" in
|
|||||||
rw)
|
rw)
|
||||||
start_container_if_needed
|
start_container_if_needed
|
||||||
|
|
||||||
# Ensure tmux session exists
|
log INFO "$PERSON attaching to workspace '$WORKSPACE'"
|
||||||
if ! podman exec -it --user "$DEV_USER" "$WORKSPACE" tmux has-session -t "$TMUX_SESSION" 2>/dev/null; then
|
|
||||||
|
# Try to attach to session; if it fails, create and attach
|
||||||
|
if ! podman exec -it -e TERM="$TERM" --user "$DEV_USER" "$WORKSPACE" \
|
||||||
|
tmux attach -t "$TMUX_SESSION"; then
|
||||||
|
log WARN "tmux session not found, creating new session"
|
||||||
podman exec -it --user "$DEV_USER" "$WORKSPACE" \
|
podman exec -it --user "$DEV_USER" "$WORKSPACE" \
|
||||||
tmux new-session -d -s "$TMUX_SESSION"
|
tmux new-session -d -s "$TMUX_SESSION" 2>/dev/null || true
|
||||||
|
podman exec -it -e TERM="$TERM" --user "$DEV_USER" "$WORKSPACE" \
|
||||||
|
tmux attach -t "$TMUX_SESSION"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log INFO "$PERSON attaching to workspace '$WORKSPACE'"
|
|
||||||
podman exec -it -e TERM="$TERM" --user "$DEV_USER" "$WORKSPACE" \
|
|
||||||
tmux attach -t "$TMUX_SESSION"
|
|
||||||
log INFO "$PERSON detached from '$WORKSPACE'"
|
log INFO "$PERSON detached from '$WORKSPACE'"
|
||||||
|
|
||||||
check_devuser_attached
|
check_devuser_attached
|
||||||
;;
|
;;
|
||||||
ro)
|
ro)
|
||||||
|
Reference in New Issue
Block a user