From a735f7e4cc8f83ca79e1e393d4392558765b6bb8 Mon Sep 17 00:00:00 2001 From: zeevdiukman Date: Thu, 18 Dec 2025 10:42:04 +0200 Subject: [PATCH] 0 --- howdy.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ irfix.sh | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100755 howdy.sh create mode 100755 irfix.sh diff --git a/howdy.sh b/howdy.sh new file mode 100755 index 0000000..e801b91 --- /dev/null +++ b/howdy.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# --- 1. Safety Check: Ensure NOT running as root --- +if [ "$EUID" -eq 0 ]; then + echo -e "\033[0;31mERROR: Do not run this script as root (sudo).\033[0m" + echo "The build process uses 'fakeroot' which conflicts with actual root privileges." + echo "Please run as a normal user: ./install_howdy_safe.sh" + exit 1 +fi + +# --- Configuration --- +PKG_DLIB="python-dlib" +PKG_HOWDY="howdy-git" +AUR_HELPER="yay" + +# --- Colors --- +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +echo -e "${GREEN}=== Howdy 3 Installer (Fakeroot/Non-Root Safe Mode) ===${NC}" + +# --- 2. Install Dependencies (Requires sudo here only) --- +echo -e "${YELLOW}[1/5] Requesting sudo for dependency installation...${NC}" +sudo pacman -Sy --needed base-devel git v4l-utils python-pip || exit 1 + +# --- 3. Install AUR Helper (if missing) --- +if ! command -v $AUR_HELPER &> /dev/null; then + echo -e "${YELLOW}[2/5] Installing yay...${NC}" + rm -rf /tmp/yay-bin + git clone https://aur.archlinux.org/yay-bin.git /tmp/yay-bin + cd /tmp/yay-bin + # makepkg handles fakeroot automatically here + makepkg -si --noconfirm + cd ~ +fi + +# --- 4. Build python-dlib (No CUDA, using proper fakeroot) --- +echo -e "${YELLOW}[3/5] Building python-dlib (CPU Only)...${NC}" +rm -rf /tmp/$PKG_DLIB +git clone https://aur.archlinux.org/$PKG_DLIB.git /tmp/$PKG_DLIB +cd /tmp/$PKG_DLIB + +# Patch for No-CUDA +sed -i 's/_build_cuda=1/_build_cuda=0/g' PKGBUILD +if ! grep -q "_build_cuda=0" PKGBUILD; then + sed -i '2i_build_cuda=0' PKGBUILD +fi + +# MAKEPKG MAGIC: +# -s: Sync deps (uses sudo internally just for installs) +# -i: Install (uses sudo internally just for installs) +# The build itself happens in a fakeroot environment automatically. +makepkg -si --noconfirm + +# --- 5. Install Howdy --- +echo -e "${YELLOW}[4/5] Installing Howdy...${NC}" +$AUR_HELPER -S --needed $PKG_HOWDY + +# --- 6. Final Config --- +echo -e "${YELLOW}[5/5] Setup Complete.${NC}" +echo "Run 'sudo howdy config' and 'sudo howdy add' to finish." +echo "Don't forget to edit /etc/pam.d/sudo with: auth sufficient pam_howdy.so" \ No newline at end of file diff --git a/irfix.sh b/irfix.sh new file mode 100755 index 0000000..3b5eac3 --- /dev/null +++ b/irfix.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# --- Configuration --- +AUR_HELPER="yay" +PKG_NAME="linux-enable-ir-emitter" + +# --- Colors --- +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "${GREEN}=== IR Emitter Enabler for Arch Linux ===${NC}" + +# 1. Check/Install dependencies +echo -e "${YELLOW}[1/3] Installing linux-enable-ir-emitter from AUR...${NC}" +if ! command -v $AUR_HELPER &> /dev/null; then + echo -e "${RED}Error: AUR helper '$AUR_HELPER' not found. Please install yay or paru.${NC}" + exit 1 +fi + +$AUR_HELPER -S --needed $PKG_NAME + +# 2. Run the Configuration Wizard +echo -e "${YELLOW}[2/3] Starting configuration wizard...${NC}" +echo -e "${GREEN}INSTRUCTIONS:${NC}" +echo "1. The tool will ask to find your IR camera." +echo "2. It will try different 'patterns' to turn on the light." +echo "3. You must LOOK AT YOUR CAMERA while it tests." +echo "4. When you see the red light flash (or purple on your screen), answer 'Yes'." +echo "" +read -p "Press Enter to start the wizard..." + +# We run the configure command. It requires root permissions for hardware access. +sudo linux-enable-ir-emitter configure + +# 3. Final Test +echo -e "${YELLOW}[3/3] Testing Howdy...${NC}" +read -p "If the wizard was successful, press Enter to test Howdy now..." +sudo howdy test \ No newline at end of file