2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 18:15:40 +00:00

Installer fixes (#3962)

* Switch variable to make it easier to debug
Fixes #3933

* rename output file

* add setting to directly generate refs

* use prod mode

* fix check

* add debug flags

* remove debug marker

* pre-safe keys

* update installer ref

* split installer steps

* split steps further

* try static adding

* remove split key add

* try dry rn again

* do not dry run keys

* fix debian 11 detection

* add ci to let install run through

* remove flags

* remove dryrun

* run on master

* query api on test

* fix missing env

* use matmair for tests

* use specific version

* remove old python first

* check python version

* add more version checks

* multiline marker for action

* add option to select python env

* set python version before running installer

* cleanup script

* use inline apt for python install

* package 3.9 by default

* remove custom python install

* add some sleeps

* fix package names

* reduce double depb definition

* set python version

* remove 3.9 requirement

* do invoke and wheel install in the right context

* fix typing for 3.8

* use var for config file if it exsists

* fix discovery

* use raw output for jq

* remove tests

* revert change in tasks.py
This commit is contained in:
Matthias Mair
2022-11-20 09:29:12 +01:00
committed by GitHub
parent 798e95910c
commit a2abdc297b
8 changed files with 101 additions and 450 deletions

View File

@ -2,16 +2,12 @@
# This script was generated by bashly 0.8.9 (https://bashly.dannyb.co)
# Modifying it manually is not recommended
# :wrapper.bash3_bouncer
if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
printf "bash version 4 or higher is required\n" >&2
exit 1
fi
# :command.master_script
# :command.root_command
root_command() {
# src/root_command.sh
# Settings
source_url=${args[source]}
publisher=${args[publisher]}
@ -59,25 +55,26 @@ root_command() {
# Check if os and version is supported
get_distribution
echo "### Detected distribution: $OS $VER"
NOT_SUPPORTED=false
SUPPORTED=true
case "$OS" in
Ubuntu)
if [[ $VER != "20.04" ]]; then
NOT_SUPPORTED=true
SUPPORTED=false
fi
;;
Debian | Raspbian)
"Debian GNU/Linux" | Raspbian)
if [[ $VER != "11" ]]; then
NOT_SUPPORTED=true
SUPPORTED=false
fi
OS=Debian
;;
*)
echo "### Distribution not supported"
NOT_SUPPORTED=true
SUPPORTED=false
;;
esac
if [[ $NOT_SUPPORTED ]]; then
if [[ $SUPPORTED != "true" ]]; then
echo "This OS is currently not supported"
echo "please install manually using https://inventree.readthedocs.io/en/stable/start/install/"
echo "or check https://github.com/inventree/InvenTree/issues/3836 for packaging for your OS."
@ -96,11 +93,10 @@ root_command() {
fi
done
echo "### Adding key and package source"
# Add key
do_call "wget -qO- https://dl.packager.io/srv/$publisher/InvenTree/key | sudo apt-key add -"
# Add packagelist
do_call "sudo wget -O /etc/apt/sources.list.d/inventree.list https://dl.packager.io/srv/$publisher/InvenTree/$source_url/installer/${lsb_dist}/${dist_version}.repo"
echo "### Getting and adding key"
wget -qO- https://dl.packager.io/srv/$publisher/InvenTree/key | sudo apt-key add -
echo "### Adding package source"
do_call "sudo wget -O /etc/apt/sources.list.d/inventree.list https://dl.packager.io/srv/$publisher/InvenTree/$source_url/installer/${OS,,}/${VER}.repo"
echo "### Updateing package lists"
do_call "sudo apt-get update"
@ -118,34 +114,30 @@ root_command() {
}
# :command.version_command
version_command() {
echo "$version"
}
# :command.usage
install_usage() {
install.sh_usage() {
if [[ -n $long_usage ]]; then
printf "install - Interactive installer for InvenTree\n"
printf "install.sh - Interactive installer for InvenTree\n"
echo
else
printf "install - Interactive installer for InvenTree\n"
printf "install.sh - Interactive installer for InvenTree\n"
echo
fi
printf "Usage:\n"
printf " install [SOURCE] [PUBLISHER] [OPTIONS]\n"
printf " install --help | -h\n"
printf " install --version | -v\n"
printf " install.sh [SOURCE] [PUBLISHER] [OPTIONS]\n"
printf " install.sh --help | -h\n"
printf " install.sh --version | -v\n"
echo
# :command.long_usage
if [[ -n $long_usage ]]; then
printf "Options:\n"
# :command.usage_fixed_flags
echo " --help, -h"
printf " Show this help\n"
echo
@ -153,34 +145,27 @@ install_usage() {
printf " Show version number\n"
echo
# :command.usage_flags
# :flag.usage
echo " --no-call, -n"
printf " Do not call outside APIs (only functionally needed)\n"
echo
# :flag.usage
echo " --dry-run, -d"
printf " Dry run (do not install anything)\n"
echo
# :command.usage_args
printf "Arguments:\n"
# :argument.usage
echo " SOURCE"
printf " Package source that should be used\n"
printf " Allowed: stable, master, main\n"
printf " Default: stable\n"
echo
# :argument.usage
echo " PUBLISHER"
printf " Publisher that should be used\n"
printf " Default: inventree\n"
echo
# :command.usage_examples
printf "Examples:\n"
printf " install\n"
printf " install master --no-call\n"
@ -190,7 +175,6 @@ install_usage() {
fi
}
# :command.normalize_input
normalize_input() {
local arg flags
@ -214,7 +198,7 @@ normalize_input() {
shift
done
}
# :command.inspect_args
inspect_args() {
readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
if (( ${#args[@]} )); then
@ -234,11 +218,8 @@ inspect_args() {
fi
}
# :command.command_functions
# :command.parse_requirements
parse_requirements() {
# :command.fixed_flags_filter
case "${1:-}" in
--version | -v )
version_command
@ -247,31 +228,26 @@ parse_requirements() {
--help | -h )
long_usage=yes
install_usage
install.sh_usage
exit
;;
esac
# :command.command_filter
action="root"
# :command.parse_requirements_while
while [[ $# -gt 0 ]]; do
key="$1"
case "$key" in
# :flag.case
--no-call | -n )
# :flag.case_no_arg
args[--no-call]=1
shift
;;
# :flag.case
--dry-run | -d )
# :flag.case_no_arg
args[--dry-run]=1
shift
;;
@ -282,8 +258,7 @@ parse_requirements() {
;;
* )
# :command.parse_requirements_case
# :command.parse_requirements_case_simple
if [[ -z ${args[source]+x} ]]; then
args[source]=$1
@ -302,11 +277,9 @@ parse_requirements() {
esac
done
# :command.default_assignments
[[ -n ${args[source]:-} ]] || args[source]="stable"
[[ -n ${args[publisher]:-} ]] || args[publisher]="inventree"
# :command.whitelist_filter
if [[ ! ${args[source]} =~ ^(stable|master|main)$ ]]; then
printf "%s\n" "source must be one of: stable, master, main" >&2
exit 1
@ -314,17 +287,14 @@ parse_requirements() {
}
# :command.initialize
initialize() {
version="2.0"
long_usage=''
set -e
# src/initialize.sh
}
# :command.run
run() {
declare -A args=()
declare -a other_args=()