Skip to content

Commit

Permalink
Add linter and prepare pulling
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Oct 29, 2024
1 parent ac652a3 commit cd71f72
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 8 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SPDX-FileCopyrightText: Stefan Tatschner
#
# SPDX-License-Identifier: CC0-1.0

name: linters

on:
push:
branches:
- master
pull_request:
paths:
- '.github/**'
- 'devpod.sh'

jobs:
linters:
runs-on: ubuntu-latest
container: debian:trixie

steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update -y
apt-get install -y shellcheck shfmt just
- name: Run shellcheck
run: |
just shellcheck
2 changes: 2 additions & 0 deletions debian/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
evince \
fd-find \
fish \
fzf \
gh \
git \
git-delta \
Expand All @@ -41,6 +42,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
python3-poetry \
ripgrep \
rustup \
screen \
shellcheck \
shfmt \
socat \
Expand Down
65 changes: 57 additions & 8 deletions devpod
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,54 @@ search_and_source_config() {
}

show_help() {
echo "usage: $(basename "$BASH_ARGV0") [-c CONTAINER] CMD"
echo ""
echo " -g mount stuff to allow wayland GUI applications"
echo " -s mount stuff to allow ssh config and agent from host"
echo " -c CONTAINER container to use, default is debian"
echo "usage: $(basename "$BASH_ARGV0")"
}

main() {
cmd_pull() {
local distro="debian"

while getopts "hd:" opt; do
case "$opt" in
h)
show_help
exit 1
;;
d)
distro="$OPTARG"
;;
*)
show_help
exit 1
;;
esac
done

# TODO: Add more containers upstream.
case "$distro" in
debian)
podman pull "ghcr.io/rumpelsepp/devpod:master"
;;
*)
show_help
exit 1
;;
esac
}

cmd_run() {
configured_args=()
CONTAINER_HOME="/home/dev"

search_and_source_config

local container="devpod-debian"
local container="ghcr.io/rumpelsepp/devpod:master"
local allow_gui="0"
local allow_ssh="0"

while getopts "h?gsc:" opt; do
case "$opt" in
c)
container="devpod-$1"
container="$OPTARG"
;;
g)
allow_gui="1"
Expand Down Expand Up @@ -141,4 +168,26 @@ main() {
podman run "${args[@]}" "${configured_args[@]}" "$container" "${cmd[@]}"
}

main() {
if [[ "$#" == 0 ]]; then
show_help
exit 1
fi

case "$1" in
pull)
shift
cmd_pull "$@"
;;
run)
shift
cmd_run "$@"
;;
*)
show_help
exit 1
;;
esac
}

main "$@"
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ build-arch:

build-debian:
cd debian && just build

lint: shellcheck

shellcheck:
shellcheck devpod

0 comments on commit cd71f72

Please sign in to comment.