mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-25 16:53:36 +05:00
Compare commits
21 Commits
v6.0.0-alp
...
d9dbff1740
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9dbff1740 | ||
|
|
b99e6612e2 | ||
|
|
cf4e915430 | ||
|
|
c901cd1fdf | ||
|
|
da3c37a872 | ||
|
|
8f436646cd | ||
|
|
6c81ba2232 | ||
|
|
a777461296 | ||
|
|
2c045bb647 | ||
|
|
a21e059328 | ||
|
|
6853e97fb8 | ||
|
|
837488e4dd | ||
|
|
68cc03f3d0 | ||
|
|
606686b33c | ||
|
|
fc494e21da | ||
|
|
41fccb88fd | ||
|
|
66975cd913 | ||
|
|
89ad92468d | ||
|
|
ef44ba8253 | ||
|
|
d41865e693 | ||
|
|
ba594355ba |
@@ -11,5 +11,5 @@ end_of_line = lf
|
||||
[*.py]
|
||||
max_line_length = 88
|
||||
|
||||
[*.sh]
|
||||
indent_size = 2
|
||||
[*.{sh,yml,yaml}]
|
||||
indent_size = 2
|
||||
33
.github/workflows/release-ff-and-tag.yml
vendored
Normal file
33
.github/workflows/release-ff-and-tag.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Release - Fast-Forward and Tag
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag_name:
|
||||
description: 'Provide a tag name (e.g. v1.0.0)'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
ff-and-tag:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: 'master'
|
||||
- name: Merge Fast Forward
|
||||
uses: MaximeHeckel/github-action-merge-fast-forward@v1.1.0
|
||||
with:
|
||||
branchtomerge: origin/develop
|
||||
branch: master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Create and Push Tag
|
||||
run: |
|
||||
git tag ${{ inputs.tag_name }}
|
||||
git push origin ${{ inputs.tag_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
3
.vs/ProjectSettings.json
Normal file
3
.vs/ProjectSettings.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"CurrentProjectSetting": null
|
||||
}
|
||||
11
.vs/VSWorkspaceState.json
Normal file
11
.vs/VSWorkspaceState.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ExpandedNodes": [
|
||||
"",
|
||||
"\\kiauh",
|
||||
"\\kiauh\\components\\droidklipp",
|
||||
"\\kiauh\\core",
|
||||
"\\kiauh\\core\\menus"
|
||||
],
|
||||
"SelectedNode": "\\kiauh\\core\\menus\\main_menu.py",
|
||||
"PreviewInSolutionExplorer": false
|
||||
}
|
||||
BIN
.vs/kiauhPlusDroidKlipp/v16/.suo
Normal file
BIN
.vs/kiauhPlusDroidKlipp/v16/.suo
Normal file
Binary file not shown.
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
@@ -71,14 +71,14 @@ sudo apt-get update && sudo apt-get install git -y
|
||||
Once git is installed, use the following command to download KIAUH into your home-directory:
|
||||
|
||||
```shell
|
||||
cd ~ && git clone https://github.com/dw-0/kiauh.git
|
||||
cd ~ && git clone https://github.com/CodeMasterCody3D/kiauhPlusDroidKlipp.git
|
||||
```
|
||||
|
||||
* **Step 3:** \
|
||||
Finally, start KIAUH by running the next command:
|
||||
|
||||
```shell
|
||||
./kiauh/kiauh.sh
|
||||
./kiauhPlusDroidKlipp/kiauh.sh
|
||||
```
|
||||
|
||||
* **Step 4:** \
|
||||
|
||||
47
kiauh/components/droidklipp/droidklipp.py
Normal file
47
kiauh/components/droidklipp/droidklipp.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
def install_droidklipp():
|
||||
try:
|
||||
print("Are you sure you want to install DroidKlipp? (Y/N)")
|
||||
user_confirmation = input().strip().lower()
|
||||
|
||||
if user_confirmation != 'y':
|
||||
print("DroidKlipp installation aborted.")
|
||||
return
|
||||
|
||||
print("Installing DroidKlipp...")
|
||||
subprocess.run(['sudo', 'apt', 'install', '-y', 'adb', 'tmux'], check=True)
|
||||
|
||||
# Define the DroidKlipp repository URL and directory
|
||||
droidklipp_repo_url = "https://github.com/CodeMasterCody3D/DroidKlipp.git"
|
||||
droidklipp_dir = os.path.expanduser('~/DroidKlipp')
|
||||
|
||||
# Check if DroidKlipp directory exists, if not create it
|
||||
if not os.path.isdir(droidklipp_dir):
|
||||
print("DroidKlipp folder not found, creating directory...")
|
||||
os.makedirs(droidklipp_dir)
|
||||
|
||||
# Clone the repository if not already cloned
|
||||
if not os.path.isdir(os.path.join(droidklipp_dir, '.git')):
|
||||
print("Cloning the DroidKlipp repository...")
|
||||
subprocess.run(['git', 'clone', droidklipp_repo_url, droidklipp_dir], check=True)
|
||||
else:
|
||||
print("DroidKlipp repository already exists.")
|
||||
|
||||
# Change to the DroidKlipp directory
|
||||
os.chdir(droidklipp_dir)
|
||||
|
||||
# Set executable permissions for the installation script
|
||||
subprocess.run(['sudo', 'chmod', '+x', 'droidklipp.sh'], check=True)
|
||||
|
||||
# Run the installation script
|
||||
subprocess.run(['./droidklipp.sh'], check=True)
|
||||
|
||||
print("DroidKlipp installation complete!")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error during installation: {e}")
|
||||
except Exception as e:
|
||||
print(f"Unexpected error: {e}")
|
||||
|
||||
# Ensure you call this with proper confirmation before installation
|
||||
@@ -43,7 +43,11 @@ from utils.common import check_install_dependencies, get_install_status
|
||||
from utils.fs_utils import check_file_exist
|
||||
from utils.input_utils import get_confirm, get_number_input, get_string_input
|
||||
from utils.instance_utils import get_instances
|
||||
from utils.sys_utils import cmd_sysctl_service, parse_packages_from_file
|
||||
from utils.sys_utils import (
|
||||
cmd_sysctl_service,
|
||||
install_python_packages,
|
||||
parse_packages_from_file,
|
||||
)
|
||||
|
||||
|
||||
def get_klipper_status() -> ComponentStatus:
|
||||
@@ -211,3 +215,42 @@ def install_klipper_packages() -> None:
|
||||
packages.append("dbus")
|
||||
|
||||
check_install_dependencies({*packages})
|
||||
|
||||
|
||||
def install_input_shaper_deps() -> None:
|
||||
if not KLIPPER_ENV_DIR.exists():
|
||||
Logger.print_warn("Required Klipper python environment not found!")
|
||||
return
|
||||
|
||||
Logger.print_dialog(
|
||||
DialogType.CUSTOM,
|
||||
[
|
||||
"Resonance measurements and shaper auto-calibration require additional "
|
||||
"software dependencies which are not installed by default. "
|
||||
"If you agree, the following additional system packages will be installed:",
|
||||
"● python3-numpy",
|
||||
"● python3-matplotlib",
|
||||
"● libatlas-base-dev",
|
||||
"● libopenblas-dev",
|
||||
"\n\n",
|
||||
"Also, the following Python package will be installed:",
|
||||
"● numpy",
|
||||
],
|
||||
custom_title="Install Input Shaper Dependencies",
|
||||
)
|
||||
if not get_confirm(
|
||||
"Do you want to install the required packages?", default_choice=False
|
||||
):
|
||||
return
|
||||
|
||||
apt_deps = (
|
||||
"python3-numpy",
|
||||
"python3-matplotlib",
|
||||
"libatlas-base-dev",
|
||||
"libopenblas-dev",
|
||||
)
|
||||
check_install_dependencies({*apt_deps})
|
||||
|
||||
py_deps = ("numpy",)
|
||||
|
||||
install_python_packages(KLIPPER_ENV_DIR, {*py_deps})
|
||||
|
||||
@@ -13,6 +13,7 @@ from typing import Type
|
||||
|
||||
from components.klipper import KLIPPER_DIR
|
||||
from components.klipper.klipper import Klipper
|
||||
from components.klipper.klipper_utils import install_input_shaper_deps
|
||||
from components.klipper_firmware.menus.klipper_build_menu import (
|
||||
KlipperBuildFirmwareMenu,
|
||||
KlipperKConfigMenu,
|
||||
@@ -50,9 +51,10 @@ class AdvancedMenu(BaseMenu):
|
||||
"2": Option(method=self.flash),
|
||||
"3": Option(method=self.build_flash),
|
||||
"4": Option(method=self.get_id),
|
||||
"5": Option(method=self.klipper_rollback),
|
||||
"6": Option(method=self.moonraker_rollback),
|
||||
"7": Option(method=self.change_hostname),
|
||||
"5": Option(method=self.input_shaper),
|
||||
"6": Option(method=self.klipper_rollback),
|
||||
"7": Option(method=self.moonraker_rollback),
|
||||
"8": Option(method=self.change_hostname),
|
||||
}
|
||||
|
||||
def print_menu(self) -> None:
|
||||
@@ -60,11 +62,13 @@ class AdvancedMenu(BaseMenu):
|
||||
"""
|
||||
╟───────────────────────────┬───────────────────────────╢
|
||||
║ Klipper Firmware: │ Repository Rollback: ║
|
||||
║ 1) [Build] │ 5) [Klipper] ║
|
||||
║ 2) [Flash] │ 6) [Moonraker] ║
|
||||
║ 1) [Build] │ 6) [Klipper] ║
|
||||
║ 2) [Flash] │ 7) [Moonraker] ║
|
||||
║ 3) [Build + Flash] │ ║
|
||||
║ 4) [Get MCU ID] │ System: ║
|
||||
║ │ 7) [Change hostname] ║
|
||||
║ │ 8) [Change hostname] ║
|
||||
║ Extra Dependencies: │ ║
|
||||
║ 5) [Input Shaper] │ ║
|
||||
╟───────────────────────────┴───────────────────────────╢
|
||||
"""
|
||||
)[1:]
|
||||
@@ -97,3 +101,6 @@ class AdvancedMenu(BaseMenu):
|
||||
|
||||
def change_hostname(self, **kwargs) -> None:
|
||||
change_system_hostname()
|
||||
|
||||
def input_shaper(self, **kwargs) -> None:
|
||||
install_input_shaper_deps()
|
||||
|
||||
@@ -11,6 +11,7 @@ from __future__ import annotations
|
||||
import textwrap
|
||||
from typing import Type
|
||||
|
||||
from components.droidklipp.droidklipp import install_droidklipp
|
||||
from components.crowsnest.crowsnest import install_crowsnest
|
||||
from components.klipper.services.klipper_setup_service import KlipperSetupService
|
||||
from components.klipperscreen.klipperscreen import install_klipperscreen
|
||||
@@ -40,7 +41,6 @@ class InstallMenu(BaseMenu):
|
||||
|
||||
def set_previous_menu(self, previous_menu: Type[BaseMenu] | None) -> None:
|
||||
from core.menus.main_menu import MainMenu
|
||||
|
||||
self.previous_menu = previous_menu if previous_menu is not None else MainMenu
|
||||
|
||||
def set_options(self) -> None:
|
||||
@@ -52,7 +52,9 @@ class InstallMenu(BaseMenu):
|
||||
"5": Option(method=self.install_mainsail_config),
|
||||
"6": Option(method=self.install_fluidd_config),
|
||||
"7": Option(method=self.install_klipperscreen),
|
||||
"8": Option(method=self.install_crowsnest),
|
||||
"8": Option(method=self.install_droidklipp), # Add DroidKlipp option
|
||||
"9": Option(method=self.install_crowsnest),
|
||||
|
||||
}
|
||||
|
||||
def print_menu(self) -> None:
|
||||
@@ -61,15 +63,17 @@ class InstallMenu(BaseMenu):
|
||||
╟───────────────────────────┬───────────────────────────╢
|
||||
║ Firmware & API: │ Touchscreen GUI: ║
|
||||
║ 1) [Klipper] │ 7) [KlipperScreen] ║
|
||||
║ 2) [Moonraker] │ ║
|
||||
║ 2) [Moonraker] │ 8) [DroidKlipp] ║
|
||||
║ │ ║
|
||||
║ │ Webcam Streamer: ║
|
||||
║ Webinterface: │ 8) [Crowsnest] ║
|
||||
║ Webinterface: │ 9) [Crowsnest] ║
|
||||
║ 3) [Mainsail] │ ║
|
||||
║ 4) [Fluidd] │ ║
|
||||
║ │ ║
|
||||
║ Client-Config: │ ║
|
||||
║ 5) [Mainsail-Config] │ ║
|
||||
║ 6) [Fluidd-Config] │ ║
|
||||
║ │ ║
|
||||
╟───────────────────────────┴───────────────────────────╢
|
||||
"""
|
||||
)[1:]
|
||||
@@ -106,3 +110,6 @@ class InstallMenu(BaseMenu):
|
||||
|
||||
def install_crowsnest(self, **kwargs) -> None:
|
||||
install_crowsnest()
|
||||
|
||||
def install_droidklipp(self, **kwargs) -> None:
|
||||
install_droidklipp()
|
||||
|
||||
@@ -12,6 +12,7 @@ import sys
|
||||
import textwrap
|
||||
from typing import Callable, Type
|
||||
|
||||
from components.droidklipp.droidklipp import install_droidklipp
|
||||
from components.crowsnest.crowsnest import get_crowsnest_status
|
||||
from components.klipper.klipper_utils import get_klipper_status
|
||||
from components.klipperscreen.klipperscreen import get_klipperscreen_status
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from components.droidklipp.droidklipp import install_droidklipp
|
||||
|
||||
import re
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
@@ -26,9 +26,10 @@ def git_clone_wrapper(
|
||||
) -> None:
|
||||
"""
|
||||
Clones a repository from the given URL and checks out the specified branch if given.
|
||||
The clone will be performed with the '--filter=blob:none' flag to perform a blobless clone.
|
||||
|
||||
:param repo: The URL of the repository to clone.
|
||||
:param branch: The branch to check out. If None, the default branch will be checked out.
|
||||
:param branch: The branch to check out. If None, master or main, no checkout will be performed.
|
||||
:param target_dir: The directory where the repository will be cloned.
|
||||
:param force: Force the cloning of the repository even if it already exists.
|
||||
:return: None
|
||||
@@ -43,8 +44,11 @@ def git_clone_wrapper(
|
||||
return
|
||||
shutil.rmtree(target_dir)
|
||||
|
||||
git_cmd_clone(repo, target_dir)
|
||||
git_cmd_checkout(branch, target_dir)
|
||||
git_cmd_clone(repo, target_dir, blobless=True)
|
||||
|
||||
if branch not in ("master", "main"):
|
||||
git_cmd_checkout(branch, target_dir)
|
||||
|
||||
except CalledProcessError:
|
||||
log = "An unexpected error occured during cloning of the repository."
|
||||
Logger.print_error(log)
|
||||
@@ -255,11 +259,23 @@ def get_remote_commit(repo: Path) -> str | None:
|
||||
return None
|
||||
|
||||
|
||||
def git_cmd_clone(repo: str, target_dir: Path) -> None:
|
||||
try:
|
||||
command = ["git", "clone", repo, target_dir.as_posix()]
|
||||
run(command, check=True)
|
||||
def git_cmd_clone(repo: str, target_dir: Path, blobless: bool = False) -> None:
|
||||
"""
|
||||
Clones a repository with optional blobless clone.
|
||||
|
||||
:param repo: URL of the repository to clone.
|
||||
:param target_dir: Path where the repository will be cloned.
|
||||
:param blobless: If True, perform a blobless clone by adding the '--filter=blob:none' flag.
|
||||
"""
|
||||
try:
|
||||
command = ["git", "clone"]
|
||||
|
||||
if blobless:
|
||||
command.append("--filter=blob:none")
|
||||
|
||||
command += [repo, target_dir.as_posix()]
|
||||
|
||||
run(command, check=True)
|
||||
Logger.print_ok("Clone successful!")
|
||||
except CalledProcessError as e:
|
||||
error = e.stderr.decode() if e.stderr else "Unknown error"
|
||||
|
||||
@@ -197,6 +197,38 @@ def install_python_requirements(target: Path, requirements: Path) -> None:
|
||||
raise VenvCreationFailedException(log)
|
||||
|
||||
|
||||
def install_python_packages(target: Path, packages: List[str]) -> None:
|
||||
"""
|
||||
Installs the python packages based on a provided packages list |
|
||||
:param target: Path of the virtualenv
|
||||
:param packages: str list of required packages
|
||||
:return: None
|
||||
"""
|
||||
try:
|
||||
# always update pip before installing requirements
|
||||
update_python_pip(target)
|
||||
|
||||
Logger.print_status("Installing Python requirements ...")
|
||||
command = [
|
||||
target.joinpath("bin/pip").as_posix(),
|
||||
"install",
|
||||
]
|
||||
for pkg in packages:
|
||||
command.append(pkg)
|
||||
result = run(command, stderr=PIPE, text=True)
|
||||
|
||||
if result.returncode != 0 or result.stderr:
|
||||
Logger.print_error(f"{result.stderr}", False)
|
||||
raise VenvCreationFailedException("Installing Python requirements failed!")
|
||||
|
||||
Logger.print_ok("Installing Python requirements successful!")
|
||||
|
||||
except Exception as e:
|
||||
log = f"Error installing Python requirements: {e}"
|
||||
Logger.print_error(log)
|
||||
raise VenvCreationFailedException(log)
|
||||
|
||||
|
||||
def update_system_package_lists(silent: bool, rls_info_change=False) -> None:
|
||||
"""
|
||||
Updates the systems package list |
|
||||
|
||||
Reference in New Issue
Block a user