From 2a723da9105327d154dc8e3e34807b02ec651286 Mon Sep 17 00:00:00 2001 From: CooperGerman <43497893+CooperGerman@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:37:03 +0100 Subject: [PATCH 1/7] Create install_arch.sh --- scripts/install_arch.sh | 208 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 scripts/install_arch.sh diff --git a/scripts/install_arch.sh b/scripts/install_arch.sh new file mode 100644 index 0000000..6c40c2c --- /dev/null +++ b/scripts/install_arch.sh @@ -0,0 +1,208 @@ +#!/bin/bash + +# ANSI color codes +GREEN='\033[0;32m' +ORANGE='\033[0;33m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color + +# CD to project root if we're in the scripts dir +current_dir=$(pwd) +if [ "$(basename "$current_dir")" = "scripts" ]; then + cd .. +fi + +# +# Python version verification +# +if ! command -v python3 &>/dev/null; then + echo -e "${ORANGE}Python 3 is not installed or not found. Please install at least Python 3.9 before you continue.${NC}" + exit 1 +fi + +python_version=$(python3 --version) || exit 1 +version_number=$(echo "$python_version" | awk '{print $2}') +IFS='.' read -r major minor patch <<< "$version_number" + +if [[ "$major" -eq 3 && "$minor" -ge 9 ]]; then + echo -e "${GREEN}Python 3.9 or later is installed (Current version: $version_number)${NC}" +else + if [[ -f /etc/os-release ]]; then + source /etc/os-release + if [[ "$VERSION_CODENAME" == "buster" ]]; then + echo -e "${ORANGE}Python 3.9 or later is not installed (Current version: $version_number)${NC}" + echo -e "${ORANGE}You are running an outdated version of Debian/Raspbian (Buster). If you upgrade to Bullseye, you will get the correct python version. Please see guides online on how to upgrade your operating system.${NC}" + exit 1 + fi + fi + echo -e "${ORANGE}Current version of Python ($version_number) is too old for Spoolman.${NC}" + echo -e "${ORANGE}Please look up how to install Python 3.9 or later for your specific operating system.${NC}" + exit 1 +fi + +# +# Install needed system packages +# +# Run pacman update +echo -e "${GREEN}Updating pacman cache...${NC}" +sudo pacman -Syyu || exit 1 + +install_packages=0 +if ! python3 -c 'import venv, ensurepip' &>/dev/null; then + echo -e "${ORANGE}Python venv module is not accessible. Installing venv...${NC}" + install_packages=1 +fi + +if ! command -v pip3 &>/dev/null; then + echo -e "${ORANGE}Python pip is not installed. Installing pip...${NC}" + install_packages=1 +fi + +if ! command -v pg_config &>/dev/null; then + echo -e "${ORANGE}pg_config is not available. Installing postgresql-libs...${NC}" + install_packages=1 +fi + +if ! command -v unzip &>/dev/null; then + echo -e "${ORANGE}unzip is not available. Installing unzip...${NC}" + install_packages=1 +fi + +if [ "$install_packages" -eq 1 ]; then + # sudo pacman update + sudo pacman -S python-pip python-virtualenv postgresql-libs unzip --noconfirm || exit 1 +fi + +# +# Update pip +# +echo -e "${GREEN}Updating pip...${NC}" + +# Run pip upgrade command and capture stdout +upgrade_output=$(python3 -m pip install --user --upgrade pip 2>&1) +exit_code=$? + +# +# Install various pip packages if needed +# +echo -e "${GREEN}Installing system-wide python packages needed for Spoolman...${NC}" +packages=("python-setuptools" "python-wheel" "python-pdm") +for package in "${packages[@]}"; do + if ! pacman -Ss "$package" &>/dev/null; then + echo -e "${GREEN}Installing $package...${NC}" + sudo pacman -S "$package" --noconfirm || exit 1 + fi +done + +# +# Add python bin dir to PATH if needed +# +user_python_bin_dir=$(python3 -m site --user-base)/bin +if [[ ! "$PATH" =~ "$user_python_bin_dir" ]]; then + echo -e "${ORANGE}WARNING: $user_python_bin_dir is not in PATH, this will make it difficult to run PDM commands. Temporarily adding $user_python_bin_dir to PATH...${NC}" + echo -e "${ORANGE}To make this permanent, add the following line to your .bashrc or .zshrc file:${NC}" + echo -e "${ORANGE}export PATH=$user_python_bin_dir:\$PATH${NC}" + export PATH=$user_python_bin_dir:$PATH +fi + +# +# Install Spoolman +# + +# Install PDM dependencies +echo -e "${GREEN}Installing Spoolman backend and its dependencies using PDM...${NC}" + +# Force PDM to use venv. The default is virtualenv which has had some compatibility issues +pdm config venv.backend venv || exit 1 +pdm sync --prod --no-editable || exit 1 + +# +# Initialize the .env file if it doesn't exist +# +if [ ! -f ".env" ]; then + echo -e "${ORANGE}.env file not found. Creating it...${NC}" + cp .env.example .env +fi + +# +# Install systemd service +# +echo -e "${CYAN}Do you want to install Spoolman as a systemd service? This will automatically start Spoolman when your server starts. (y/n)${NC}" +read choice + +if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then + systemd_user_dir="$HOME/.config/systemd/user" + service_name="Spoolman" + + # Check if user-level systemd service exists and remove it + if [ -f "$systemd_user_dir/$service_name.service" ]; then + echo -e "${ORANGE}User-level systemd service already installed. Removing the existing service.${NC}" + systemctl --user stop Spoolman # Stop the service if it's running + systemctl --user disable Spoolman # Disable the service + rm "$systemd_user_dir/$service_name.service" # Remove the user-level service unit file + systemctl --user daemon-reload # Reload the systemd user service manager + fi + + # Get the parent directory of the installer script + script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + spoolman_dir=$(dirname "$script_dir") + + # Verify that we found the right spoolman dir by checking for the existence of pyproject.toml + if [ ! -f "$spoolman_dir/pyproject.toml" ]; then + echo -e "${ORANGE}Could not automatically find the Spoolman directory. Please specify the path to the Spoolman directory (the directory containing pyproject.toml):${NC}" + read spoolman_dir + # Expand the path + spoolman_dir=$(eval echo "$spoolman_dir") + # Verify again + if [ ! -f "$spoolman_dir/pyproject.toml" ]; then + echo -e "${ORANGE}Could not find pyproject.toml in $spoolman_dir. Aborting installation.${NC}" + exit 1 + fi + fi + + # Define the systemd service unit file + service_unit="[Unit] +Description=Spoolman + +[Service] +Type=simple +ExecStart=$spoolman_dir/scripts/start.sh +WorkingDirectory=$spoolman_dir +User=$USER +Restart=always + +[Install] +WantedBy=default.target +" + + # Create the systemd service unit file + service_file="/etc/systemd/system/$service_name.service" + echo "$service_unit" | sudo tee "$service_file" > /dev/null + + # Reload the systemd user service manager + sudo systemctl daemon-reload + + # Enable and start the service + sudo systemctl enable "$service_name" + sudo systemctl start "$service_name" + + # Load .env file now + set -o allexport + source .env + set +o allexport + + local_ip=$(hostname) + + echo -e "${GREEN}Spoolman systemd service has been installed and Spoolman is now starting.${NC}" + echo -e "${GREEN}Spoolman will soon be reachable at ${ORANGE}http://$local_ip:$SPOOLMAN_PORT${NC}" + echo -e "${GREEN}Please note that the displayed IP address may be incorrect for your setup. If needed, replace it manually with the correct IP.${NC}" + echo -e "${GREEN}You can start/restart/stop the service by running e.g. '${CYAN}sudo systemctl stop Spoolman${GREEN}'${NC}" + echo -e "${GREEN}You can disable the service from starting automatically by running '${CYAN}sudo systemctl disable Spoolman${GREEN}'${NC}" + echo -e "${GREEN}You can view the Spoolman logs by running '${CYAN}sudo journalctl -u Spoolman${GREEN}'${NC}" +else + echo -e "${ORANGE}Skipping systemd service installation.${NC}" + echo -e "${ORANGE}You can start Spoolman manually by running 'bash scripts/start.sh'${NC}" +fi + +echo -e "${GREEN}Spoolman has been installed successfully!${NC}" +echo -e "${GREEN}If you want to connect to an external database, you can edit the .env file and restart the service.${NC}" From 1696759325ac9a64d2c99e0d81547f858796ed25 Mon Sep 17 00:00:00 2001 From: CooperGerman <> Date: Mon, 8 Apr 2024 11:27:44 +0200 Subject: [PATCH 2/7] Update install script in readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 22d9c52..60a8171 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ mkdir -p ./Spoolman && \ source_url=$(curl -s https://api.github.com/repos/Donkie/Spoolman/releases/latest | jq -r '.assets[] | select(.name == "spoolman.zip").browser_download_url') && \ curl -sSL $source_url -o temp.zip && unzip temp.zip -d ./Spoolman && rm temp.zip && \ cd ./Spoolman && \ -bash ./scripts/install_debian.sh +bash ./scripts/install.sh ``` #### Updating @@ -77,7 +77,7 @@ source_url=$(curl -s https://api.github.com/repos/Donkie/Spoolman/releases/lates curl -sSL $source_url -o temp.zip && unzip temp.zip -d ./Spoolman && rm temp.zip && \ cp Spoolman_old/.env Spoolman/.env && \ cd ./Spoolman && \ -bash ./scripts/install_debian.sh && \ +bash ./scripts/install.sh && \ rm -rf ../Spoolman_old ``` From 163c809fd5fe153631fe8743da4bda997cb26cbf Mon Sep 17 00:00:00 2001 From: CooperGerman <> Date: Mon, 8 Apr 2024 11:27:52 +0200 Subject: [PATCH 3/7] Add .history to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0208488..6c924ba 100644 --- a/.gitignore +++ b/.gitignore @@ -203,3 +203,4 @@ $RECYCLE.BIN/ data/ .pdm-python +.history \ No newline at end of file From 81ef9b115db813a063cce23c03cd52b4690414c4 Mon Sep 17 00:00:00 2001 From: CooperGerman <> Date: Tue, 9 Apr 2024 09:18:47 +0200 Subject: [PATCH 4/7] Merged arch and debian install scripts for a generic one --- scripts/{install_debian.sh => install.sh} | 66 +++++-- scripts/install_arch.sh | 208 ---------------------- 2 files changed, 47 insertions(+), 227 deletions(-) rename scripts/{install_debian.sh => install.sh} (83%) delete mode 100644 scripts/install_arch.sh diff --git a/scripts/install_debian.sh b/scripts/install.sh similarity index 83% rename from scripts/install_debian.sh rename to scripts/install.sh index 75fb057..9c78152 100755 --- a/scripts/install_debian.sh +++ b/scripts/install.sh @@ -51,38 +51,63 @@ else echo -e "${ORANGE}Please look up how to install Python 3.9 or later for your specific operating system.${NC}" exit 1 fi - # -# Install needed system packages +# Get os package manager # -# Run apt-get update -echo -e "${GREEN}Updating apt-get cache...${NC}" -sudo apt-get update || exit 1 +if [[ -f /etc/os-release ]]; then + source /etc/os-release + if [[ "$ID_LIKE" == *"debian"* ]]; then + pkg_manager="apt-get" + update_cmd="sudo $pkg_manager update" + install_cmd="sudo $pkg_manager install -y" + elif [[ "$ID_LIKE" == *"arch"* ]]; then + pkg_manager="pacman" + update_cmd="sudo $pkg_manager -Sy" + install_cmd="sudo $pkg_manager -S --noconfirm" + else + echo -e "${ORANGE}Your operating system is not supported. Either try to install manually or reach out to spoolman github for support.${NC}" + exit 1 + fi +fi -install_packages=0 +# Run pkg manager update +echo -e "${GREEN}Updating $pkg_manager cache...${NC}" +$update_cmd || exit 1 +packages="" if ! python3 -c 'import venv, ensurepip' &>/dev/null; then echo -e "${ORANGE}Python venv module is not accessible. Installing venv...${NC}" - install_packages=1 + if [[ "$pkg_manager" == "apt-get" ]]; then + packages+="python3-venv" + elif [[ "$pkg_manager" == "pacman" ]]; then + packages+="python-virtualenv" + fi fi if ! command -v pip3 &>/dev/null; then echo -e "${ORANGE}Python pip is not installed. Installing pip...${NC}" - install_packages=1 + if [[ "$pkg_manager" == "apt-get" ]]; then + packages+="python3-pip" + elif [[ "$pkg_manager" == "pacman" ]]; then + packages+="python-pip" + fi fi if ! command -v pg_config &>/dev/null; then echo -e "${ORANGE}pg_config is not available. Installing libpq-dev...${NC}" - install_packages=1 + if [[ "$pkg_manager" == "apt-get" ]]; then + packages+="libpq-dev" + elif [[ "$pkg_manager" == "pacman" ]]; then + packages+="postgresql-libs" + fi fi if ! command -v unzip &>/dev/null; then echo -e "${ORANGE}unzip is not available. Installing unzip...${NC}" - install_packages=1 + packages+="unzip" fi -if [ "$install_packages" -eq 1 ]; then - # sudo apt-get update - sudo apt-get install -y python3-pip python3-venv libpq-dev unzip || exit 1 +if [[ -n "$packages" ]]; then + $install_cmd $packages || exit 1 fi # @@ -114,11 +139,15 @@ fi echo -e "${GREEN}Installing system-wide pip packages needed for Spoolman...${NC}" if [[ $is_externally_managed_env ]]; then echo -e "${GREEN}Installing the packages using apt-get instead of pip since pip is externally managed...${NC}" - apt_packages=("python3-setuptools" "python3-wheel") - sudo apt-get install -y "${apt_packages[@]}" || exit 1 + if [[ "$pkg_manager" == "apt-get" ]]; then + packages="python3-setuptools python3-wheel" + elif [[ "$pkg_manager" == "pacman" ]]; then + packages="python-setuptools python-wheel" + fi + $install_cmd $packages || exit 1 else - packages=("setuptools" "wheel") - for package in "${packages[@]}"; do + packages="setuptools wheel" + for package in $packages; do if ! pip3 show "$package" &>/dev/null; then echo -e "${GREEN}Installing $package...${NC}" pip3 install --user "$package" || exit 1 @@ -138,9 +167,8 @@ fi # Install Spoolman # -# Install PDM dependencies +# Install dependencies echo -e "${GREEN}Installing Spoolman backend and its dependencies...${NC}" - # Create venv if it doesn't exist if [ ! -d ".venv" ]; then python3 -m venv .venv || exit 1 diff --git a/scripts/install_arch.sh b/scripts/install_arch.sh deleted file mode 100644 index 6c40c2c..0000000 --- a/scripts/install_arch.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/bash - -# ANSI color codes -GREEN='\033[0;32m' -ORANGE='\033[0;33m' -CYAN='\033[0;36m' -NC='\033[0m' # No Color - -# CD to project root if we're in the scripts dir -current_dir=$(pwd) -if [ "$(basename "$current_dir")" = "scripts" ]; then - cd .. -fi - -# -# Python version verification -# -if ! command -v python3 &>/dev/null; then - echo -e "${ORANGE}Python 3 is not installed or not found. Please install at least Python 3.9 before you continue.${NC}" - exit 1 -fi - -python_version=$(python3 --version) || exit 1 -version_number=$(echo "$python_version" | awk '{print $2}') -IFS='.' read -r major minor patch <<< "$version_number" - -if [[ "$major" -eq 3 && "$minor" -ge 9 ]]; then - echo -e "${GREEN}Python 3.9 or later is installed (Current version: $version_number)${NC}" -else - if [[ -f /etc/os-release ]]; then - source /etc/os-release - if [[ "$VERSION_CODENAME" == "buster" ]]; then - echo -e "${ORANGE}Python 3.9 or later is not installed (Current version: $version_number)${NC}" - echo -e "${ORANGE}You are running an outdated version of Debian/Raspbian (Buster). If you upgrade to Bullseye, you will get the correct python version. Please see guides online on how to upgrade your operating system.${NC}" - exit 1 - fi - fi - echo -e "${ORANGE}Current version of Python ($version_number) is too old for Spoolman.${NC}" - echo -e "${ORANGE}Please look up how to install Python 3.9 or later for your specific operating system.${NC}" - exit 1 -fi - -# -# Install needed system packages -# -# Run pacman update -echo -e "${GREEN}Updating pacman cache...${NC}" -sudo pacman -Syyu || exit 1 - -install_packages=0 -if ! python3 -c 'import venv, ensurepip' &>/dev/null; then - echo -e "${ORANGE}Python venv module is not accessible. Installing venv...${NC}" - install_packages=1 -fi - -if ! command -v pip3 &>/dev/null; then - echo -e "${ORANGE}Python pip is not installed. Installing pip...${NC}" - install_packages=1 -fi - -if ! command -v pg_config &>/dev/null; then - echo -e "${ORANGE}pg_config is not available. Installing postgresql-libs...${NC}" - install_packages=1 -fi - -if ! command -v unzip &>/dev/null; then - echo -e "${ORANGE}unzip is not available. Installing unzip...${NC}" - install_packages=1 -fi - -if [ "$install_packages" -eq 1 ]; then - # sudo pacman update - sudo pacman -S python-pip python-virtualenv postgresql-libs unzip --noconfirm || exit 1 -fi - -# -# Update pip -# -echo -e "${GREEN}Updating pip...${NC}" - -# Run pip upgrade command and capture stdout -upgrade_output=$(python3 -m pip install --user --upgrade pip 2>&1) -exit_code=$? - -# -# Install various pip packages if needed -# -echo -e "${GREEN}Installing system-wide python packages needed for Spoolman...${NC}" -packages=("python-setuptools" "python-wheel" "python-pdm") -for package in "${packages[@]}"; do - if ! pacman -Ss "$package" &>/dev/null; then - echo -e "${GREEN}Installing $package...${NC}" - sudo pacman -S "$package" --noconfirm || exit 1 - fi -done - -# -# Add python bin dir to PATH if needed -# -user_python_bin_dir=$(python3 -m site --user-base)/bin -if [[ ! "$PATH" =~ "$user_python_bin_dir" ]]; then - echo -e "${ORANGE}WARNING: $user_python_bin_dir is not in PATH, this will make it difficult to run PDM commands. Temporarily adding $user_python_bin_dir to PATH...${NC}" - echo -e "${ORANGE}To make this permanent, add the following line to your .bashrc or .zshrc file:${NC}" - echo -e "${ORANGE}export PATH=$user_python_bin_dir:\$PATH${NC}" - export PATH=$user_python_bin_dir:$PATH -fi - -# -# Install Spoolman -# - -# Install PDM dependencies -echo -e "${GREEN}Installing Spoolman backend and its dependencies using PDM...${NC}" - -# Force PDM to use venv. The default is virtualenv which has had some compatibility issues -pdm config venv.backend venv || exit 1 -pdm sync --prod --no-editable || exit 1 - -# -# Initialize the .env file if it doesn't exist -# -if [ ! -f ".env" ]; then - echo -e "${ORANGE}.env file not found. Creating it...${NC}" - cp .env.example .env -fi - -# -# Install systemd service -# -echo -e "${CYAN}Do you want to install Spoolman as a systemd service? This will automatically start Spoolman when your server starts. (y/n)${NC}" -read choice - -if [ "$choice" == "y" ] || [ "$choice" == "Y" ]; then - systemd_user_dir="$HOME/.config/systemd/user" - service_name="Spoolman" - - # Check if user-level systemd service exists and remove it - if [ -f "$systemd_user_dir/$service_name.service" ]; then - echo -e "${ORANGE}User-level systemd service already installed. Removing the existing service.${NC}" - systemctl --user stop Spoolman # Stop the service if it's running - systemctl --user disable Spoolman # Disable the service - rm "$systemd_user_dir/$service_name.service" # Remove the user-level service unit file - systemctl --user daemon-reload # Reload the systemd user service manager - fi - - # Get the parent directory of the installer script - script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - spoolman_dir=$(dirname "$script_dir") - - # Verify that we found the right spoolman dir by checking for the existence of pyproject.toml - if [ ! -f "$spoolman_dir/pyproject.toml" ]; then - echo -e "${ORANGE}Could not automatically find the Spoolman directory. Please specify the path to the Spoolman directory (the directory containing pyproject.toml):${NC}" - read spoolman_dir - # Expand the path - spoolman_dir=$(eval echo "$spoolman_dir") - # Verify again - if [ ! -f "$spoolman_dir/pyproject.toml" ]; then - echo -e "${ORANGE}Could not find pyproject.toml in $spoolman_dir. Aborting installation.${NC}" - exit 1 - fi - fi - - # Define the systemd service unit file - service_unit="[Unit] -Description=Spoolman - -[Service] -Type=simple -ExecStart=$spoolman_dir/scripts/start.sh -WorkingDirectory=$spoolman_dir -User=$USER -Restart=always - -[Install] -WantedBy=default.target -" - - # Create the systemd service unit file - service_file="/etc/systemd/system/$service_name.service" - echo "$service_unit" | sudo tee "$service_file" > /dev/null - - # Reload the systemd user service manager - sudo systemctl daemon-reload - - # Enable and start the service - sudo systemctl enable "$service_name" - sudo systemctl start "$service_name" - - # Load .env file now - set -o allexport - source .env - set +o allexport - - local_ip=$(hostname) - - echo -e "${GREEN}Spoolman systemd service has been installed and Spoolman is now starting.${NC}" - echo -e "${GREEN}Spoolman will soon be reachable at ${ORANGE}http://$local_ip:$SPOOLMAN_PORT${NC}" - echo -e "${GREEN}Please note that the displayed IP address may be incorrect for your setup. If needed, replace it manually with the correct IP.${NC}" - echo -e "${GREEN}You can start/restart/stop the service by running e.g. '${CYAN}sudo systemctl stop Spoolman${GREEN}'${NC}" - echo -e "${GREEN}You can disable the service from starting automatically by running '${CYAN}sudo systemctl disable Spoolman${GREEN}'${NC}" - echo -e "${GREEN}You can view the Spoolman logs by running '${CYAN}sudo journalctl -u Spoolman${GREEN}'${NC}" -else - echo -e "${ORANGE}Skipping systemd service installation.${NC}" - echo -e "${ORANGE}You can start Spoolman manually by running 'bash scripts/start.sh'${NC}" -fi - -echo -e "${GREEN}Spoolman has been installed successfully!${NC}" -echo -e "${GREEN}If you want to connect to an external database, you can edit the .env file and restart the service.${NC}" From 047b0b286b57cb8cb868e2f9a62f9a74138b8f41 Mon Sep 17 00:00:00 2001 From: CooperGerman Date: Mon, 15 Apr 2024 10:28:32 +0200 Subject: [PATCH 5/7] Added os detection logging in terminal --- scripts/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 9c78152..ecca887 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -60,10 +60,12 @@ if [[ -f /etc/os-release ]]; then pkg_manager="apt-get" update_cmd="sudo $pkg_manager update" install_cmd="sudo $pkg_manager install -y" + echo -e "${GREEN}Detected Debian-based system. Using apt-get package manager.${NC}" elif [[ "$ID_LIKE" == *"arch"* ]]; then pkg_manager="pacman" update_cmd="sudo $pkg_manager -Sy" install_cmd="sudo $pkg_manager -S --noconfirm" + echo -e "${GREEN}Detected Arch-based system. Using pacman package manager.${NC}" else echo -e "${ORANGE}Your operating system is not supported. Either try to install manually or reach out to spoolman github for support.${NC}" exit 1 From c7f02f52e583d734c1dfacaf3422f8a3ceeb231b Mon Sep 17 00:00:00 2001 From: CooperGerman Date: Fri, 26 Apr 2024 15:32:09 +0200 Subject: [PATCH 6/7] Fix for https://github.com/Donkie/Spoolman/pull/335#discussion_r1578391362 --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index ecca887..2b95ca4 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -56,12 +56,12 @@ fi # if [[ -f /etc/os-release ]]; then source /etc/os-release - if [[ "$ID_LIKE" == *"debian"* ]]; then + if [[ "$ID_LIKE" == *"debian"* || "$ID" == *"debian"* ]]; then pkg_manager="apt-get" update_cmd="sudo $pkg_manager update" install_cmd="sudo $pkg_manager install -y" echo -e "${GREEN}Detected Debian-based system. Using apt-get package manager.${NC}" - elif [[ "$ID_LIKE" == *"arch"* ]]; then + elif [[ "$ID_LIKE" == *"arch"* || "$ID" == *"arch"* ]]; then pkg_manager="pacman" update_cmd="sudo $pkg_manager -Sy" install_cmd="sudo $pkg_manager -S --noconfirm" From a6774dd05476118e611e592729c4e62eb9f23057 Mon Sep 17 00:00:00 2001 From: CooperGerman Date: Fri, 26 Apr 2024 15:32:47 +0200 Subject: [PATCH 7/7] Fix for https://github.com/Donkie/Spoolman/pull/335#discussion_r1578393582 --- scripts/install.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 2b95ca4..72d7cc5 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -79,33 +79,33 @@ packages="" if ! python3 -c 'import venv, ensurepip' &>/dev/null; then echo -e "${ORANGE}Python venv module is not accessible. Installing venv...${NC}" if [[ "$pkg_manager" == "apt-get" ]]; then - packages+="python3-venv" + packages+=" python3-venv" elif [[ "$pkg_manager" == "pacman" ]]; then - packages+="python-virtualenv" + packages+=" python-virtualenv" fi fi if ! command -v pip3 &>/dev/null; then echo -e "${ORANGE}Python pip is not installed. Installing pip...${NC}" if [[ "$pkg_manager" == "apt-get" ]]; then - packages+="python3-pip" + packages+=" python3-pip" elif [[ "$pkg_manager" == "pacman" ]]; then - packages+="python-pip" + packages+=" python-pip" fi fi if ! command -v pg_config &>/dev/null; then echo -e "${ORANGE}pg_config is not available. Installing libpq-dev...${NC}" if [[ "$pkg_manager" == "apt-get" ]]; then - packages+="libpq-dev" + packages+=" libpq-dev" elif [[ "$pkg_manager" == "pacman" ]]; then - packages+="postgresql-libs" + packages+=" postgresql-libs" fi fi if ! command -v unzip &>/dev/null; then echo -e "${ORANGE}unzip is not available. Installing unzip...${NC}" - packages+="unzip" + packages+=" unzip" fi if [[ -n "$packages" ]]; then