Skip to content

Commit d4f79be

Browse files
authored
[feature] Allow root installation for SAF K1 environment (#613)
Updates the installer to support SAF K1 environments by permitting root execution when K1 OS is detected.
1 parent 7213ad7 commit d4f79be

5 files changed

Lines changed: 20 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2026-01-22]
9+
### Changed:
10+
- The install-afc.sh script will now allow users to install as root if it detects the user is running a SAF K1 environment.
11+
812
## [2026-01-15]
913
### Added:
1014
- The afc-debug.sh script will now upload the AFC statistics from moonraker for easier troubleshooting.

include/check_commands.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ check_root() {
2424
# If the script is run as root, it prints an error message and exits with status 1.
2525
# This is to ensure the script is run by a normal user for security reasons.
2626

27+
check_for_k1
28+
# On K1 OS, allow running as root but warn the user instead of exiting.
29+
if [ "$is_k1_os" == "True" ] && [ "$EUID" -eq 0 ]; then
30+
print_msg WARNING "K1 OS detected, skipping root user check."
31+
return
32+
fi
2733
if [ "$EUID" -eq 0 ]; then
2834
print_msg ERROR " Do not run as root, use a normal user"
2935
exit 1

include/constants.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ installation_options=("BoxTurtle (4-Lane)" "BoxTurtle (8-Lane)" "NightOwl" "HTLF
3737
invalid_name="False"
3838
minimum_python_major="3"
3939
minimum_python_minor="8"
40+
is_k1_os="False"
4041

4142
# AFC default configs
4243
park_macro="True"

include/utils.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,4 +219,10 @@ del_var_file() {
219219
fi
220220
fi
221221
export unit_message
222+
}
223+
224+
check_for_k1() {
225+
if grep -Fqs "ID=buildroot" /etc/os-release; then
226+
is_k1_os="True"
227+
fi
222228
}

install-afc.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,12 @@ main() {
6060
moonraker_config_file="${printer_config_dir}/moonraker.conf"
6161
afc_path="$HOME/AFC-Klipper-Add-On"
6262

63-
6463
# Make sure necessary directories exist
65-
echo "Ensuring we are not running as root.."
64+
echo "Ensuring we are not running as root (except on K1 OS)..."
6665
check_root
67-
echo "Ensuring no conflicting software is present.."
66+
echo "Ensuring no conflicting software is present..."
6867
check_for_hh
69-
echo "Checking to ensure crudini and jq are present.."
68+
echo "Checking to ensure crudini and jq are present..."
7069
check_for_prereqs
7170
if [ "$test_mode" == "False" ]; then
7271
check_python_version

0 commit comments

Comments
 (0)