refactor(klipper.sh): show python3 in main menu
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -436,7 +436,7 @@ function update_klipper(){
|
|||||||
#================================================#
|
#================================================#
|
||||||
|
|
||||||
function get_klipper_status(){
|
function get_klipper_status(){
|
||||||
local sf_count status
|
local sf_count status py_ver
|
||||||
sf_count="$(klipper_systemd | wc -w)"
|
sf_count="$(klipper_systemd | wc -w)"
|
||||||
### detect an existing "legacy" klipper init.d installation
|
### detect an existing "legacy" klipper init.d installation
|
||||||
if [ "$(klipper_systemd | wc -w)" -eq 0 ] \
|
if [ "$(klipper_systemd | wc -w)" -eq 0 ] \
|
||||||
@@ -444,6 +444,8 @@ function get_klipper_status(){
|
|||||||
sf_count=1
|
sf_count=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
py_ver=$(get_klipper_python_ver)
|
||||||
|
|
||||||
### remove the "SERVICE" entry from the data array if a klipper service is installed
|
### remove the "SERVICE" entry from the data array if a klipper service is installed
|
||||||
local data_arr=(SERVICE "${KLIPPER_DIR}" "${KLIPPY_ENV}")
|
local data_arr=(SERVICE "${KLIPPER_DIR}" "${KLIPPY_ENV}")
|
||||||
[ "${sf_count}" -gt 0 ] && unset "data_arr[0]"
|
[ "${sf_count}" -gt 0 ] && unset "data_arr[0]"
|
||||||
@@ -455,7 +457,11 @@ function get_klipper_status(){
|
|||||||
done
|
done
|
||||||
|
|
||||||
if (( filecount == ${#data_arr[*]})); then
|
if (( filecount == ${#data_arr[*]})); then
|
||||||
status="Installed: ${sf_count}"
|
if (( py_ver == 3 )); then
|
||||||
|
status="Installed: ${sf_count}(py${py_ver})"
|
||||||
|
else
|
||||||
|
status="Installed: ${sf_count}"
|
||||||
|
fi
|
||||||
elif ((filecount == 0)); then
|
elif ((filecount == 0)); then
|
||||||
status="Not installed!"
|
status="Not installed!"
|
||||||
else
|
else
|
||||||
@@ -515,6 +521,8 @@ function get_klipper_cfg_dir() {
|
|||||||
|
|
||||||
### returns the major python version the klippy-env was created with
|
### returns the major python version the klippy-env was created with
|
||||||
function get_klipper_python_ver() {
|
function get_klipper_python_ver() {
|
||||||
|
! [[ -d ${KLIPPY_ENV} ]] && return
|
||||||
|
|
||||||
local version
|
local version
|
||||||
version=$("${KLIPPY_ENV}"/bin/python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1)
|
version=$("${KLIPPY_ENV}"/bin/python --version 2>&1 | cut -d" " -f2 | cut -d"." -f1)
|
||||||
echo "${version}"
|
echo "${version}"
|
||||||
|
|||||||
Reference in New Issue
Block a user