Modified auto-fix script to make both 64bit pi machines, and ubuntu 24+ machines start Qortal with a crontab entry instead of a desktop autostart entry due to issues with the icon on 24+ and need for machines to start Qortal prior to login on pi machines.

This commit is contained in:
crowetic 2025-05-07 10:36:42 -07:00
parent 074acb2d48
commit 46da1d3b29

View File

@ -14,6 +14,7 @@ NC='\033[0m' # No Color
RASPI_32_DETECTED=false RASPI_32_DETECTED=false
RASPI_64_DETECTED=false RASPI_64_DETECTED=false
UPDATED_SETTINGS=false UPDATED_SETTINGS=false
NEW_UBUNTU_VERSION=false
# Function to update the script initially if needed # Function to update the script initially if needed
initial_update() { initial_update() {
@ -83,7 +84,16 @@ check_for_raspi() {
check_memory check_memory
fi fi
else else
echo "${YELLOW}Not a Raspberry Pi machine, continuing...${NC}\n" echo "${YELLOW}Not a Raspberry Pi machine, checking for Ubuntu 24+...${NC}\n"
if command -v lsb_release >/dev/null 2>&1; then
UBUNTU_VER=$(lsb_release -rs | cut -d. -f1)
else
UBUNTU_VER=$(grep -oP '^VERSION_ID="\K[0-9]+' /etc/os-release)
fi
if [ "$UBUNTU_VER" -ge 24 ]; then
echo "${GREEN} NEWER Ubuntu Version Found, using crontab-based Qortal start ${NC}\n"
NEW_UBUNTU_VERSION=true
fi
check_memory check_memory
fi fi
} }
@ -174,7 +184,7 @@ check_hash_update_qortal() {
check_for_GUI() { check_for_GUI() {
if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$DISPLAY" ] || [ -n "$WAYLAND_DISPLAY" ]; then
echo "${CYAN}Machine has GUI, setting up auto-fix-visible for GUI-based machines...${NC}\n" echo "${CYAN}Machine has GUI, setting up auto-fix-visible for GUI-based machines...${NC}\n"
if [ "${RASPI_32_DETECTED}" = true ] || [ "${RASPI_64_DETECTED}" = true ]; then if [ "${RASPI_32_DETECTED}" = true ] || [ "${RASPI_64_DETECTED}" = true ] || [ "${NEW_UBUNTU_VERSION}" = true ]; then
echo "${YELLOW}Pi machine with GUI, skipping autostart GUI setup, setting cron jobs instead...${NC}\n" echo "${YELLOW}Pi machine with GUI, skipping autostart GUI setup, setting cron jobs instead...${NC}\n"
setup_raspi_cron setup_raspi_cron
else else
@ -205,17 +215,18 @@ setup_raspi_cron() {
mkdir -p "${HOME}/backups/cron-backups" mkdir -p "${HOME}/backups/cron-backups"
crontab -l > "${HOME}/backups/cron-backups/crontab-backup-$(date +%Y%m%d%H%M%S)" crontab -l > "${HOME}/backups/cron-backups/crontab-backup-$(date +%Y%m%d%H%M%S)"
echo "${YELLOW}Checking if autostart desktop shortcut exists to avoid double-launch...${NC}\n" echo "${YELLOW}Checking if autostart desktop shortcut exists to avoid double-launch...${NC}\n"
if find "${HOME}/.config/autostart" -maxdepth 1 -name "start-qortal*.desktop" | grep -q .; then if find "${HOME}/.config/autostart" -maxdepth 1 -name "start-qortal*.desktop" | grep -q .; then
echo -e "${RED}Autostart desktop entry found! Using GUI-safe auto-fix cron only.${NC}\n" echo -e "${RED}Autostart desktop entry found! Removing that and replacing with cron entry${NC}\n"
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/auto-fix-GUI-cron rm "${HOME}/.conf/autostart/start-qortal*.desktop"
crontab auto-fix-GUI-cron # curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/main/auto-fix-GUI-cron
rm -f auto-fix-GUI-cron # crontab auto-fix-GUI-cron
# rm -f auto-fix-GUI-cron
curl -L -O https://raw.githubusercontent.com/crowetic/QORTector-scripts/refs/heads/main/auto-fix-cron
crontab auto-fix-cron
rm -f auto-fix-cron
check_height check_height
return
fi fi
echo "${BLUE}No autostart entries found. Setting up full headless cron...${NC}\n" echo "${BLUE}No autostart entries found. Setting up full headless cron...${NC}\n"