From de70aca9121f5a9521c32854cae2162b784acee7 Mon Sep 17 00:00:00 2001 From: th3r00t Date: Fri, 8 Aug 2025 20:54:12 +0000 Subject: [PATCH] Created install.sh and pyshelf.sh Also refactored methods to work as a zipapp --- install.sh | 26 ++++++-------------------- pyshelf.sh | 2 +- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/install.sh b/install.sh index b61db63..1060bc7 100755 --- a/install.sh +++ b/install.sh @@ -19,25 +19,11 @@ if [ -f /etc/arch-release ]; then if ! id -u pyshelf >/dev/null 2>&1; then sudo useradd -r -s /usr/bin/nologin pyshelf fi - # Change ownership to the pyshelf user sudo chown -R pyshelf:pyshelf /etc/pyShelf - # Change permissions to allow the pyshelf user to read and write sudo chmod -R 755 /etc/pyShelf - # Create a virtual environment for pyshelf sudo -u pyshelf uv sync sudo -u pyshelf mkdir release - # Install dependencies - - # switch to the pyshelf user - # sudo pacman -S --needed python-uv python python-pip python-pipx nodejs npm\ - # libxml2 libxslt zlib libjpeg-turbo gcc base-devel python-loguru\ - # python-rapidfuzz python-sqlalchemy python-pypdf python-beautifulsoup4\ - # python-lxml python-poetry python-standard-imghdr - # git clone https://aur.archlinux.org/python-mobi.git - # cd python-mobi - # makepkg -si --noconfirm - # cd .. - # install python-mobi from AUR + # sudo -u pyshelf direnv allow else sudo apt-get update sudo apt-get install -y python3-uv python3 python3-pip nodejs npm libxml2 libxslt1-dev zlib1g-dev libjpeg-turbo8-dev build-essential @@ -48,11 +34,11 @@ fi sudo -u pyshelf ./build.sh # Install assets -sudo mkdir -p /var/lib/pyshelf/assets -sudo cp -r ./src/frontend/static /var/lib/pyshelf/assets -sudo cp -r ./src/frontend/templates /var/lib/pyshelf/assets +# sudo mkdir -p /var/lib/pyshelf/assets +# sudo cp -r ./src/frontend/static /var/lib/pyshelf/assets +# sudo cp -r ./src/frontend/templates /var/lib/pyshelf/assets # Install executable -sudo cp ./release/pyshelf /usr/local/bin/pyshelf -sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf +# sudo cp ./release/pyshelf /usr/local/bin/pyshelf +# sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf diff --git a/pyshelf.sh b/pyshelf.sh index 1ff4042..7331d4b 100755 --- a/pyshelf.sh +++ b/pyshelf.sh @@ -3,7 +3,7 @@ # It sets up the environment and runs the main script. # first we need to activate the virtual environment if [ -d ".venv" ]; then - source venv/bin/activate + source .venv/bin/activate else echo "Virtual environment not found. Please create it first." exit 1