feat: make main script more automatic

This commit is contained in:
Krzysztof Rudnicki 2025-08-01 13:14:34 +02:00
parent 219c76d6bb
commit e53501d217
6 changed files with 229 additions and 41 deletions

View File

@ -191,22 +191,22 @@ fi
cp mpv.conf "$HOME/.config/mpv/mpv.conf" cp mpv.conf "$HOME/.config/mpv/mpv.conf"
if [ ! -d "$HOME/.oh-my-zsh" ]; then if [ ! -d "$HOME/.oh-my-zsh" ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else else
echo "Oh My Zsh is already installed" echo "Oh My Zsh is already installed"
fi fi
cd ~/linux-configuration cd ~/linux-configuration
hosts/install.sh sudo hosts/install.sh
i3-configuration/install.sh i3-configuration/install.sh
scripts/install_pacman_wrapper.sh scripts/install_pacman_wrapper.sh
scripts/nvidia_troubleshoots.sh scripts/nvidia_troubleshoot.sh
scripts/setup_activitywatch.sh sudo scripts/setup_activitywatch.sh
scripts/setup_media_organizer.sh sudo scripts/setup_media_organizer.sh
scripts/setup_pc_startup_monitor.sh sudo scripts/setup_pc_startup_monitor.sh
scripts/setup_periodic_system.sh yes | sudo scripts/setup_periodic_system.sh
scripts/setup_thorium_startup.sh sudo scripts/setup_thorium_startup.sh
protonup yes | protonup
yes | sudo pacman -Syuu yes | sudo pacman -Syuu
#cd unreal-engine #cd unreal-engine

View File

@ -74,27 +74,47 @@ asciidoctor
man-db man-db
# git for large files like LLM # git for large files like LLM
git-lfs git-lfs
# # hell for servers
nodejs nodejs
# hell for desktop
electron electron
# better npm
yarn yarn
# for compatibility of some packages
openssl-1.1 openssl-1.1
# needed for some packages
tk tk
# needed for some packages jpeg
jasper jasper
# opencv dependency
libdc1394 libdc1394
# needed for a lot of packages
cblas cblas
# Parsing Expression Grammar Template Library consider removing
pegtl pegtl
# needed for a lot of packages
hdf5 hdf5
# needed for a lot of packages
proj proj
# needed for a lot of packages
gcc-fortran gcc-fortran
# needed for a lot of packages
python-nose python-nose
# needed for a lot of packages
python-pyproject-metadata python-pyproject-metadata
# needed for a lot of packages
meson-python meson-python
# needed for a lot of packages
lapack lapack
# needed for a lot of packages
python-numpy python-numpy
# needed for a lot of packages
openmpi openmpi
# needed for a lot of packages
boost boost
# needed for some packages
suitesparse suitesparse
# needed for some packages
vtk vtk
junit junit
java-hamcrest java-hamcrest

View File

@ -5,6 +5,31 @@
set -e # Exit on any error set -e # Exit on any error
# Default to non-interactive mode
INTERACTIVE_MODE=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--interactive)
INTERACTIVE_MODE=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -i, --interactive Enable interactive prompts (default: auto-yes)"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use -h or --help for usage information"
exit 1
;;
esac
done
# Function to check and request sudo privileges # Function to check and request sudo privileges
check_sudo() { check_sudo() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
@ -14,7 +39,7 @@ check_sudo() {
fi fi
} }
# Check for sudo privileges first # Check for sudo privileges after argument parsing
check_sudo "$@" check_sudo "$@"
echo "NVIDIA Comprehensive Troubleshooter & GSP Disabler" echo "NVIDIA Comprehensive Troubleshooter & GSP Disabler"
@ -22,6 +47,11 @@ echo "=================================================="
echo "Current Date: $(date)" echo "Current Date: $(date)"
echo "User: $USER" echo "User: $USER"
echo "Original user: ${SUDO_USER:-$USER}" echo "Original user: ${SUDO_USER:-$USER}"
if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Mode: Interactive (prompts enabled)"
else
echo "Mode: Automatic (auto-yes, use --interactive for prompts)"
fi
# Check if nvidia module is loaded # Check if nvidia module is loaded
if ! lsmod | grep -q nvidia; then if ! lsmod | grep -q nvidia; then
@ -40,7 +70,7 @@ mkdir -p "$MODPROBE_DIR"
# Create the configuration file # Create the configuration file
cat > "$CONFIG_FILE" << EOF cat > "$CONFIG_FILE" << EOF
# Disable NVIDIA GSP firmware to prevent Vulkan failures and crashes # Disable NVIDIA GSP firmware to prevent Vulkan failures and crashes
# Created by disable-gsp-firmware.sh on $(date) # Created by nvidia_troubleshoot.sh on $(date)
options nvidia NVreg_EnableGpuFirmware=0 options nvidia NVreg_EnableGpuFirmware=0
EOF EOF
@ -75,7 +105,7 @@ configure_xorg() {
# Create NVIDIA-specific configuration # Create NVIDIA-specific configuration
cat > "$NVIDIA_CONF" << EOF cat > "$NVIDIA_CONF" << EOF
# NVIDIA configuration with RenderAccel disabled # NVIDIA configuration with RenderAccel disabled
# Created by disable-gsp-firmware.sh on $(date) # Created by nvidia_troubleshoot.sh on $(date)
Section "Device" Section "Device"
Identifier "NVIDIA Card" Identifier "NVIDIA Card"
Driver "nvidia" Driver "nvidia"
@ -99,7 +129,7 @@ configure_gcc_workaround() {
if ! grep -q "IGNORE_CC_MISMATCH" "$PROFILE_FILE"; then if ! grep -q "IGNORE_CC_MISMATCH" "$PROFILE_FILE"; then
echo "" >> "$PROFILE_FILE" echo "" >> "$PROFILE_FILE"
echo "# NVIDIA GCC version mismatch workaround" >> "$PROFILE_FILE" echo "# NVIDIA GCC version mismatch workaround" >> "$PROFILE_FILE"
echo "# Added by disable-gsp-firmware.sh on $(date)" >> "$PROFILE_FILE" echo "# Added by nvidia_troubleshoot.sh on $(date)" >> "$PROFILE_FILE"
echo "export IGNORE_CC_MISMATCH=1" >> "$PROFILE_FILE" echo "export IGNORE_CC_MISMATCH=1" >> "$PROFILE_FILE"
echo "✓ Added IGNORE_CC_MISMATCH=1 to $PROFILE_FILE" echo "✓ Added IGNORE_CC_MISMATCH=1 to $PROFILE_FILE"
else else
@ -120,10 +150,19 @@ install_pyroveil() {
echo "like Final Fantasy VII Rebirth. Pyroveil can work around these problems." echo "like Final Fantasy VII Rebirth. Pyroveil can work around these problems."
echo "" echo ""
read -p "Would you like to install Pyroveil? (y/N): " -n 1 -r local install_pyroveil=true
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ "$INTERACTIVE_MODE" == "true" ]]; then
read -p "Would you like to install Pyroveil? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
install_pyroveil=false
fi
else
echo "Auto-installing Pyroveil (use --interactive to prompt)"
fi
if [[ "$install_pyroveil" == "true" ]]; then
# Check for required dependencies # Check for required dependencies
local missing_deps=() local missing_deps=()

View File

@ -5,10 +5,40 @@
set -e # Exit on any error set -e # Exit on any error
# Default to non-interactive mode
INTERACTIVE_MODE=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--interactive)
INTERACTIVE_MODE=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -i, --interactive Enable interactive prompts (default: auto-yes)"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use -h or --help for usage information"
exit 1
;;
esac
done
echo "PC Startup Time Monitor for Arch Linux" echo "PC Startup Time Monitor for Arch Linux"
echo "======================================" echo "======================================"
echo "Current Date: $(date)" echo "Current Date: $(date)"
echo "User: ${SUDO_USER:-$USER}" echo "User: ${SUDO_USER:-$USER}"
if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Mode: Interactive (prompts enabled)"
else
echo "Mode: Automatic (auto-yes, use --interactive for prompts)"
fi
# Function to check and request sudo privileges # Function to check and request sudo privileges
check_sudo() { check_sudo() {
@ -492,18 +522,25 @@ confirm_setup() {
echo "- Check time: 8:30 AM daily" echo "- Check time: 8:30 AM daily"
echo "- Action: Show warning if PC wasn't started in expected window" echo "- Action: Show warning if PC wasn't started in expected window"
echo "" echo ""
read -p "Do you want to proceed? (y/N): " confirm
case "$confirm" in if [[ "$INTERACTIVE_MODE" == "true" ]]; then
[yY]|[yY][eE][sS]) read -p "Do you want to proceed? (y/N): " confirm
echo "Proceeding with setup..."
return 0 case "$confirm" in
;; [yY]|[yY][eE][sS])
*) echo "Proceeding with setup..."
echo "Setup cancelled." return 0
exit 0 ;;
;; *)
esac echo "Setup cancelled."
exit 0
;;
esac
else
echo "Auto-proceeding with setup (use --interactive to prompt)"
echo "Proceeding with setup..."
return 0
fi
} }
# Main execution flow # Main execution flow

View File

@ -5,6 +5,31 @@
set -e # Exit on any error set -e # Exit on any error
# Default to non-interactive mode
INTERACTIVE_MODE=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--interactive)
INTERACTIVE_MODE=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -i, --interactive Enable interactive prompts (default: auto-yes)"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use -h or --help for usage information"
exit 1
;;
esac
done
# Function to check and request sudo privileges # Function to check and request sudo privileges
check_sudo() { check_sudo() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
@ -14,7 +39,7 @@ check_sudo() {
fi fi
} }
# Check for sudo privileges first # Check for sudo privileges after argument parsing
check_sudo "$@" check_sudo "$@"
echo "Periodic System Setup - Pacman Wrapper & Hosts File" echo "Periodic System Setup - Pacman Wrapper & Hosts File"
@ -22,6 +47,11 @@ echo "==================================================="
echo "Current Date: $(date)" echo "Current Date: $(date)"
echo "User: $USER" echo "User: $USER"
echo "Original user: ${SUDO_USER:-$USER}" echo "Original user: ${SUDO_USER:-$USER}"
if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Mode: Interactive (prompts enabled)"
else
echo "Mode: Automatic (auto-yes, use --interactive for prompts)"
fi
# Get the directory where this script is located # Get the directory where this script is located
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
@ -470,11 +500,21 @@ run_initial_execution() {
echo "9. Running Initial Execution..." echo "9. Running Initial Execution..."
echo "===============================" echo "==============================="
echo "Would you like to run the system maintenance now to test the setup?" local run_initial=true
read -p "Run initial execution? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Would you like to run the system maintenance now to test the setup?"
read -p "Run initial execution? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
run_initial=false
fi
else
echo "Auto-running initial execution to test the setup (use --interactive to prompt)"
fi
if [[ "$run_initial" == "true" ]]; then
echo "Running initial system maintenance..." echo "Running initial system maintenance..."
/usr/local/bin/periodic-system-maintenance.sh /usr/local/bin/periodic-system-maintenance.sh
echo "✓ Initial execution completed" echo "✓ Initial execution completed"

View File

@ -4,6 +4,31 @@
set -e # Exit on any error set -e # Exit on any error
# Default to non-interactive mode
INTERACTIVE_MODE=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--interactive)
INTERACTIVE_MODE=true
shift
;;
-h|--help)
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -i, --interactive Enable interactive prompts (default: auto-yes)"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
echo "Use -h or --help for usage information"
exit 1
;;
esac
done
# Function to check and request sudo privileges # Function to check and request sudo privileges
check_sudo() { check_sudo() {
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
@ -13,7 +38,7 @@ check_sudo() {
fi fi
} }
# Check for sudo privileges first # Check for sudo privileges after argument parsing
check_sudo "$@" check_sudo "$@"
echo "Thorium Browser Auto-Startup Setup" echo "Thorium Browser Auto-Startup Setup"
@ -21,6 +46,11 @@ echo "=================================="
echo "Current Date: $(date)" echo "Current Date: $(date)"
echo "User: $USER" echo "User: $USER"
echo "Original user: ${SUDO_USER:-$USER}" echo "Original user: ${SUDO_USER:-$USER}"
if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Mode: Interactive (prompts enabled)"
else
echo "Mode: Automatic (auto-yes, use --interactive for prompts)"
fi
# Target URL # Target URL
TARGET_URL="https://www.fitatu.com/app/planner" TARGET_URL="https://www.fitatu.com/app/planner"
@ -68,9 +98,21 @@ check_thorium_browser() {
echo "You can install Thorium browser from:" echo "You can install Thorium browser from:"
echo "https://thorium.rocks/" echo "https://thorium.rocks/"
echo "" echo ""
read -p "Continue anyway? The service will be created but may fail to start (y/N): " -n 1 -r
echo local continue_anyway=false
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
if [[ "$INTERACTIVE_MODE" == "true" ]]; then
read -p "Continue anyway? The service will be created but may fail to start (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
continue_anyway=true
fi
else
echo "Auto-continuing anyway - service will be created but may fail to start (use --interactive to prompt)"
continue_anyway=true
fi
if [[ "$continue_anyway" != true ]]; then
exit 1 exit 1
fi fi
fi fi
@ -363,11 +405,21 @@ test_setup() {
echo "8. Testing Setup..." echo "8. Testing Setup..."
echo "==================" echo "=================="
echo "Would you like to test the browser launcher now?" local run_test=true
read -p "Test launch Thorium browser with Fitatu? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ "$INTERACTIVE_MODE" == "true" ]]; then
echo "Would you like to test the browser launcher now?"
read -p "Test launch Thorium browser with Fitatu? (y/N): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
run_test=false
fi
else
echo "Auto-testing the browser launcher (use --interactive to prompt)"
fi
if [[ "$run_test" == "true" ]]; then
echo "Testing browser launch..." echo "Testing browser launch..."
echo "Note: This will open Thorium browser with Fitatu website" echo "Note: This will open Thorium browser with Fitatu website"