Bottles icon indicating copy to clipboard operation
Bottles copied to clipboard

Competent build script

Open loopyd opened this issue 3 months ago • 1 comments

Description

Increase the reliability of the build script. The goal of this commit is easier builds in the shell using org.flatpak.Builder, either on a host or in a container.

Code Clean-Up

  • [x] Focus on improving build.sh.
  • [x] The script has been moved from sh to bash shebang.
  • [x] Script now includes clear documentation with shdoc annotations.
  • [x] Formatting has been cleaned up and standardized with shellcheck

Stability improvements

  • [x] Moved from a temporary solution to a more permanent one that can have you kicking off the build anywhere.
  • [x] Including an error trap and proper exiting the script for syntax errors.
  • [x] A exec_flatpak function that automatically performs actions based upon if running in a container or not.
  • [x] Cleaner build output with formatting and message levels.
  • [x] Sanity checking for the existence of needed commands.

CLI Improvements

  • [x] Command-line parser for build.sh
  • [x] Help pages for the script (via: <action> -h|--help)
  • [x] Flatpak-style argument pass-through with -a|--arg for the run action.
  • [x] Addition of optionally running the script with the -u|--user flag passed through to flatpak to avoid making changes to the system.
  • [x] Support for the -c|--command flag, which allows access to bottles-cli.

Community TODOs:

  • [ ] Sandboxing via --sandbox flag.
  • [ ] Passthrough of environment variables and other lesser-used flatpak arguments (see: flatpak --help for further details), that may be useful to bottles users.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • [x] Test A - On the Host System: Ran on my host machine (Linux Mint Virginia) and got a working build of Bottles flatpak master (Development Build)
  • [x] Test B - In a Docker Container: Ran in a ubuntu:jammy docker container and got a working build of Bottles flatpak master (Development Build)
  • [x] Test C - Command-Line Argument Invocations: Variants of command-line options tested: ./build.sh build -r -u -c bottles-cli -a --help, ./build.sh run -r -u -c bottles, ./build.sh, ./build.sh -h and other common invocations users may have interest in.
  • [x] Test D - User and Non-User: Build success with the -u|--user flag, and without the -u|--user flag working, on systems that are configured to support flatpak running as root (not recommended).

loopyd avatar Mar 28 '24 02:03 loopyd