This commit is contained in:
lrgex
2023-11-14 14:55:58 +03:00
parent 7cc547d2cd
commit ec782bab61
4 changed files with 78 additions and 8 deletions

View File

@@ -37,9 +37,21 @@ for package in "${packages_array[@]}"; do
echo "Installing Moonraker with Kiauh..."
su lrgex -c 'expect ./moonraker.exp'
fi
if [ "${package}" = "fluidd" ] && [ ! -d "/home/lrgex/fluidd" ]; then
if [ "${package}" = "fluidd" ] && [ ! -d "/home/lrgex/fluidd" ] && [ ! -d "/home/lrgex/mainsail" ]; then
echo "Installing Fluidd with Kiauh..."
su lrgex -c 'expect ./fluidd.exp'
elif [ -d "/home/lrgex/mainsail" ]; then
echo "Mainsail detected, skipping Fluidd installation."
echo "If you want to install Fluidd, please re run the container without the Mainsail package. .e.g [-e PACKAGES=klipper,moonraker,fluidd]]"
sleep 5
fi
if [ "${package}" = "mainsail" ] && [ ! -d "/home/lrgex/mainsail" ] && [ ! -d "/home/lrgex/fluidd" ]; then
echo "Installing Mainsail with Kiauh..."
su lrgex -c 'expect ./mainsail.exp'
elif [ -d "/home/lrgex/fluidd" ]; then
echo "Fluidd detected, skipping Mainsail installation."
echo "If you want to install Mainsail, please re run the container without the Fluidd package. .e.g [-e PACKAGES=klipper,moonraker,mainsail]"
sleep 5
fi
done

45
scripts/mainsail.exp Normal file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/expect
# expect used tcl syntax which is very indetaion and spaces sensitive keep that in mind
# Set timeout
set timeout 60
# Start your process
spawn /opt/lrgex/kiauh/kiauh.sh
# Initialize a variable to control the menu interaction
set menu 1
# Single expect block with multiple patterns
expect {
"*Main Menu*" {
# using condition here to make a break for the loop created by exp_continue as i need to use the pattern 2 times one for pressing 1 and one for pressing q
if {$menu} {
send "1\r"
exp_continue
} else {
send "q\r"
exp_continue
}
}
"*Installation Menu*" {
if {$menu} {
send "3\r"
exp_continue
} else {
send "b\r"
exp_continue
}
}
"*Download the recommended macros? (Y/n):*" {
send "y\r"
set menu 0
exp_continue
}
timeout {
puts "Operation timed out"
exit 1
}
}