mirror of
https://github.com/inventree/InvenTree.git
synced 2025-11-13 19:36:46 +00:00
refactor(backend): switch to empty buildpack for package, extend supported OS versions (#10705) (#10712)
* bump vers
* fix ssl?
Added build dependencies for libbz2, libffi, and libssl.
* try empty buildpack
* clean up
* fix ref
* remove things we now do not need anymore
* add 22.04 as a target
* cleanup installer
* add changelog entry
* add dotenv
* update skript
* make task more robust for package usage
* ensure we have a site-url set
* fix style
* fix syntax
(cherry picked from commit f47a1a4675)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# This script was generated by bashly 1.1.1 (https://bashly.dannyb.co)
|
||||
# This script was generated by bashly 1.3.3 (https://bashly.dev)
|
||||
# Modifying it manually is not recommended
|
||||
|
||||
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
|
||||
printf "bash version 4 or higher is required\n" >&2
|
||||
if ((BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 2))); then
|
||||
printf "bash version 4.2 or higher is required\n" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -56,17 +56,16 @@ root_command() {
|
||||
get_distribution
|
||||
echo "### Detected distribution: $OS $VER"
|
||||
SUPPORTED=true # is this OS supported?
|
||||
NEEDS_LIBSSL1_1=false # does this OS need libssl1.1?
|
||||
|
||||
DIST_OS=${OS,,}
|
||||
DIST_VER=$VER
|
||||
|
||||
case "$OS" in
|
||||
Ubuntu)
|
||||
if [[ $VER == "24.04" ]]; then
|
||||
SUPPORTED=true
|
||||
if [[ $VER == "22.04" ]]; then
|
||||
SUPPORTED=true
|
||||
NEEDS_LIBSSL1_1=true
|
||||
DIST_VER="20.04"
|
||||
elif [[ $VER == "20.04" ]]; then
|
||||
SUPPORTED=true
|
||||
else
|
||||
@@ -75,7 +74,6 @@ root_command() {
|
||||
;;
|
||||
"Debian GNU/Linux" | "debian gnu/linux" | Raspbian)
|
||||
if [[ $VER == "12" ]]; then
|
||||
DIST_VER="11"
|
||||
SUPPORTED=true
|
||||
elif [[ $VER == "11" ]]; then
|
||||
SUPPORTED=true
|
||||
@@ -111,15 +109,6 @@ root_command() {
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $NEEDS_LIBSSL1_1 == "true" ]]; then
|
||||
echo "### Installing libssl1.1"
|
||||
|
||||
echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
|
||||
do_call "sudo apt-get update"
|
||||
do_call "sudo apt-get install libssl1.1"
|
||||
sudo rm /etc/apt/sources.list.d/focal-security.list
|
||||
fi
|
||||
|
||||
echo "### Getting and adding key"
|
||||
curl -fsSL https://dl.packager.io/srv/$publisher/InvenTree/key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/pkgr-inventree.gpg > /dev/null
|
||||
echo "### Adding package source"
|
||||
@@ -146,15 +135,7 @@ version_command() {
|
||||
}
|
||||
|
||||
install.sh_usage() {
|
||||
if [[ -n $long_usage ]]; then
|
||||
printf "install.sh - Interactive installer for InvenTree\n"
|
||||
echo
|
||||
|
||||
else
|
||||
printf "install.sh - Interactive installer for InvenTree\n"
|
||||
echo
|
||||
|
||||
fi
|
||||
printf "install.sh - Interactive installer for InvenTree\n\n"
|
||||
|
||||
printf "%s\n" "Usage:"
|
||||
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
|
||||
@@ -162,7 +143,7 @@ install.sh_usage() {
|
||||
printf " install.sh --version | -v\n"
|
||||
echo
|
||||
|
||||
if [[ -n $long_usage ]]; then
|
||||
if [[ -n "$long_usage" ]]; then
|
||||
printf "%s\n" "Options:"
|
||||
|
||||
printf " %s\n" "--no-call, -n"
|
||||
@@ -184,13 +165,13 @@ install.sh_usage() {
|
||||
|
||||
printf " %s\n" "SOURCE"
|
||||
printf " Package source that should be used\n"
|
||||
printf " Allowed: stable, master, main\n"
|
||||
printf " Default: stable\n"
|
||||
printf " %s\n" "Allowed: stable, master, main"
|
||||
printf " %s\n" "Default: stable"
|
||||
echo
|
||||
|
||||
printf " %s\n" "PUBLISHER"
|
||||
printf " Publisher that should be used\n"
|
||||
printf " Default: inventree\n"
|
||||
printf " %s\n" "Default: inventree"
|
||||
echo
|
||||
|
||||
printf "%s\n" "Examples:"
|
||||
@@ -203,11 +184,14 @@ install.sh_usage() {
|
||||
}
|
||||
|
||||
normalize_input() {
|
||||
local arg flags
|
||||
local arg passthru flags
|
||||
passthru=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
arg="$1"
|
||||
if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
||||
if [[ $passthru == true ]]; then
|
||||
input+=("$arg")
|
||||
elif [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
|
||||
input+=("${BASH_REMATCH[1]}")
|
||||
input+=("${BASH_REMATCH[2]}")
|
||||
elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
|
||||
@@ -218,6 +202,9 @@ normalize_input() {
|
||||
for ((i = 0; i < ${#flags}; i++)); do
|
||||
input+=("-${flags:i:1}")
|
||||
done
|
||||
elif [[ "$arg" == "--" ]]; then
|
||||
passthru=true
|
||||
input+=("$arg")
|
||||
else
|
||||
input+=("$arg")
|
||||
fi
|
||||
@@ -226,37 +213,11 @@ normalize_input() {
|
||||
done
|
||||
}
|
||||
|
||||
inspect_args() {
|
||||
if ((${#args[@]})); then
|
||||
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
|
||||
echo args:
|
||||
for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
|
||||
else
|
||||
echo args: none
|
||||
fi
|
||||
|
||||
if ((${#other_args[@]})); then
|
||||
echo
|
||||
echo other_args:
|
||||
echo "- \${other_args[*]} = ${other_args[*]}"
|
||||
for i in "${!other_args[@]}"; do
|
||||
echo "- \${other_args[$i]} = ${other_args[$i]}"
|
||||
done
|
||||
fi
|
||||
|
||||
if ((${#deps[@]})); then
|
||||
readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
|
||||
echo
|
||||
echo deps:
|
||||
for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
parse_requirements() {
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "${1:-}" in
|
||||
key="$1"
|
||||
case "$key" in
|
||||
--version | -v)
|
||||
version_command
|
||||
exit
|
||||
@@ -301,11 +262,10 @@ parse_requirements() {
|
||||
*)
|
||||
|
||||
if [[ -z ${args['source']+x} ]]; then
|
||||
|
||||
args['source']=$1
|
||||
shift
|
||||
elif [[ -z ${args['publisher']+x} ]]; then
|
||||
|
||||
elif [[ -z ${args['publisher']+x} ]]; then
|
||||
args['publisher']=$1
|
||||
shift
|
||||
else
|
||||
@@ -321,7 +281,7 @@ parse_requirements() {
|
||||
[[ -n ${args['source']:-} ]] || args['source']="stable"
|
||||
[[ -n ${args['publisher']:-} ]] || args['publisher']="inventree"
|
||||
|
||||
if [[ -n ${args['source']} ]] && [[ ! ${args['source']} =~ ^(stable|master|main)$ ]]; then
|
||||
if [[ -n ${args['source']:-} ]] && [[ ! ${args['source']:-} =~ ^(stable|master|main)$ ]]; then
|
||||
printf "%s\n" "source must be one of: stable, master, main" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -329,18 +289,19 @@ parse_requirements() {
|
||||
}
|
||||
|
||||
initialize() {
|
||||
version="2.0"
|
||||
long_usage=''
|
||||
declare -g version="2.0"
|
||||
set -e
|
||||
|
||||
|
||||
}
|
||||
|
||||
run() {
|
||||
declare -A args=()
|
||||
declare -A deps=()
|
||||
declare -a other_args=()
|
||||
declare -a input=()
|
||||
|
||||
declare -g long_usage=''
|
||||
declare -g -A args=()
|
||||
declare -g -A deps=()
|
||||
declare -g -a env_var_names=()
|
||||
declare -g -a input=()
|
||||
|
||||
normalize_input "$@"
|
||||
parse_requirements "${input[@]}"
|
||||
|
||||
@@ -349,5 +310,6 @@ run() {
|
||||
esac
|
||||
}
|
||||
|
||||
command_line_args=("$@")
|
||||
initialize
|
||||
run "$@"
|
||||
run "${command_line_args[@]}"
|
||||
|
||||
Reference in New Issue
Block a user