Refactor: Inventree (uses now ubuntu 24.04) (#9752)

This commit is contained in:
CanbiZ 2025-12-07 21:48:00 +01:00 committed by GitHub
parent 9e8ab9de01
commit 531ecad4c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 20 deletions

View File

@ -10,8 +10,8 @@ var_tags="${var_tags:-inventory}"
var_cpu="${var_cpu:-2}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}" var_ram="${var_ram:-2048}"
var_disk="${var_disk:-6}" var_disk="${var_disk:-6}"
var_os="${var_os:-debian}" var_os="${var_os:-ubuntu}"
var_version="${var_version:-13}" var_version="${var_version:-24.04}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"
@ -28,10 +28,16 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_info "Updating $APP"
if ! grep -qE "^ID=(ubuntu)$" /etc/os-release; then
msg_error "Unsupported OS. InvenTree requires Ubuntu (20.04/22.04/24.04)."
exit
fi
msg_info "Updating InvenTree"
$STD apt update $STD apt update
$STD apt install --only-upgrade inventree -y $STD apt install --only-upgrade inventree -y
msg_ok "Updated $APP" msg_ok "Updated InvenTree"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
exit exit
} }

View File

@ -22,8 +22,8 @@
"cpu": 2, "cpu": 2,
"ram": 2048, "ram": 2048,
"hdd": 6, "hdd": 6,
"os": "debian", "os": "ubuntu",
"version": "13" "version": "24.04"
} }
} }
], ],

View File

@ -13,23 +13,27 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies"
temp_file=$(mktemp)
curl -fsSL "http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb" -o "$temp_file"
$STD dpkg -i $temp_file
rm -f $temp_file
msg_ok "Installed Dependencies"
msg_info "Setting up InvenTree Repository" msg_info "Setting up InvenTree Repository"
mkdir -p /etc/apt/keyrings setup_deb822_repo \
curl -fsSL https://dl.packager.io/srv/inventree/InvenTree/key | gpg --dearmor -o /etc/apt/keyrings/inventree.gpg "inventree" \
echo "deb [signed-by=/etc/apt/keyrings/inventree.gpg] https://dl.packager.io/srv/deb/inventree/InvenTree/stable/ubuntu 20.04 main" >/etc/apt/sources.list.d/inventree.list "https://dl.packager.io/srv/inventree/InvenTree/key" \
"https://dl.packager.io/srv/deb/inventree/InvenTree/stable/$(get_os_info id)" \
"$(get_os_info version)" \
"main"
msg_ok "Set up InvenTree Repository" msg_ok "Set up InvenTree Repository"
msg_info "Setup ${APPLICATION} (Patience)" msg_info "Installing InvenTree (Patience)"
$STD apt-get update export SETUP_NO_CALLS=true
$STD apt-get install -y inventree $STD apt install -y inventree
msg_ok "Setup ${APPLICATION}" msg_ok "Installed InvenTree"
msg_info "Configuring InvenTree"
LOCAL_IP="$(hostname -I | awk '{print $1}')"
if [[ -f /etc/inventree/config.yaml ]]; then
sed -i "s|site_url:.*|site_url: http://${LOCAL_IP}|" /etc/inventree/config.yaml
fi
$STD inventree run invoke update
msg_ok "Configured InvenTree"
motd_ssh motd_ssh
customize customize