feat(functions): Add a function to start and log into the devenv container
This commit is contained in:
18
functions.d/devenv
Normal file
18
functions.d/devenv
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
function devenv() {
|
||||
|
||||
local status
|
||||
|
||||
# Get LXC container status
|
||||
status=$(lxc info devenv | yq .Status)
|
||||
|
||||
# Start container if not running
|
||||
if [ "${status}" != "RUNNING" ]; then lxc start devenv; fi
|
||||
|
||||
# Rename tmux window if inside tmux
|
||||
if [ -n "$TMUX" ]; then tmux rename-window "devenv"; fi
|
||||
|
||||
# Login as user xavier
|
||||
lxc exec devenv -- login -f xavier
|
||||
}
|
Reference in New Issue
Block a user