@@ -17,6 +17,7 @@ default_args() {
|
||||
"--userns=keep-id" # Map host user.
|
||||
"-v" "$name:/home/user:copy" # Persistent home volume.
|
||||
"-v" "dnf-cache:/var/cache/libdnf5" # Cache dnf metadata.
|
||||
"-v" "$HOME/dev:/home/user/dev" # dev folder
|
||||
)
|
||||
|
||||
# Unix sockets require SELinux label disable.
|
||||
@@ -38,6 +39,7 @@ param_args() {
|
||||
-gpu) run_opts+=("--device" "/dev/dri") ;;
|
||||
-kvm) run_opts+=("--device" "/dev/kvm") ;;
|
||||
-usb) run_opts+=("--device" "/dev/bus/usb") ;;
|
||||
-audio) run_opts+=("--device" "/dev/snd") ;;
|
||||
-host-spawn) run_opts+=("-v" "/run/user/$UID/bus:/tmp/bus" "-e" "HOST_HOME=$HOME") ;;
|
||||
-container-sock) run_opts+=("-v" "$XDG_RUNTIME_DIR/podman/podman.sock:/var/run/docker.sock") ;;
|
||||
-x11) run_opts+=("-v" "/tmp/.X11-unix:/tmp/.X11-unix" "-v" "$XAUTHORITY:/run/user/1000/.Xauthority:ro" "-e" "DISPLAY=$DISPLAY" "-e" "XAUTHORITY=/run/user/1000/.Xauthority") ;;
|
||||
@@ -50,19 +52,8 @@ param_args() {
|
||||
|
||||
main() {
|
||||
local state_file="$HOME/.local/share/devc-previous-container"
|
||||
local image="devc"
|
||||
|
||||
# Resolve container name (CLI arg > Last used > Error).
|
||||
if [[ $image && $image != -* ]]; then
|
||||
shift
|
||||
[[ $image != *:* ]] && image+=":main"
|
||||
echo "$image" >"$state_file"
|
||||
elif [[ -f $state_file ]]; then
|
||||
image=$(<$state_file)
|
||||
else
|
||||
die "no container name specified"
|
||||
fi
|
||||
local name="${image%:*}"
|
||||
local image="devc:main"
|
||||
local name="devc"
|
||||
|
||||
# Start/Restart if not running or if arguments change configuration.
|
||||
if [[ -z "$(podman ps -q -f name="^$name$" -f status=running)" ]] || (($# > 0)); then
|
||||
|
||||
Reference in New Issue
Block a user