Skip to content

Commit

Permalink
tool: split out commands into separate functions, add help
Browse files Browse the repository at this point in the history
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
  • Loading branch information
bboozzoo committed Jun 7, 2024
1 parent 60b6677 commit ffd2365
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions tool
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,32 @@ enabled=0
EOF
}

#HELP: shell
#HELP: Open a shell in build environment
shell_in_container() {
exec /bin/bash
}

#HELP: pack
#HELP: Pack the repository tree
pack() {
case "$TARGET" in
amazonlinux:2)
tarball_name="amazon-linux-2-repo.tar.xz"
;;
amazonlinux:2023)
tarball_name="amazon-linux-2023-repo.tar.xz"
;;
*)
echo "unsupported target $TARGET"
exit 1
;;
esac
tar -cJv repo > "$tarball_name"
}



cmd="$1"
shift
case "$cmd" in
Expand Down Expand Up @@ -130,19 +156,7 @@ case "$cmd" in
echo "repo directory does not exist, run 'createrepo' first"
exit 1
fi
case "$TARGET" in
amazonlinux:2)
tarball_name="amazon-linux-2-repo.tar.xz"
;;
amazonlinux:2023)
tarball_name="amazon-linux-2023-repo.tar.xz"
;;
*)
echo "unsupported target $TARGET"
exit 1
;;
esac
tar -cJv repo > "$tarball_name"
pack
;;
help|-h|--help|*)
grep -E '^#HELP: ' "$0" | sed -e 's/#HELP: //'
Expand Down

0 comments on commit ffd2365

Please sign in to comment.