Created install.sh and pyshelf.sh

Also refactored methods to work as a zipapp
This commit is contained in:
2025-08-08 20:54:12 +00:00
parent 4918c40d54
commit de70aca912
2 changed files with 7 additions and 21 deletions

26
install.sh vendored
View File

@@ -19,25 +19,11 @@ if [ -f /etc/arch-release ]; then
if ! id -u pyshelf >/dev/null 2>&1; then if ! id -u pyshelf >/dev/null 2>&1; then
sudo useradd -r -s /usr/bin/nologin pyshelf sudo useradd -r -s /usr/bin/nologin pyshelf
fi fi
# Change ownership to the pyshelf user
sudo chown -R pyshelf:pyshelf /etc/pyShelf sudo chown -R pyshelf:pyshelf /etc/pyShelf
# Change permissions to allow the pyshelf user to read and write
sudo chmod -R 755 /etc/pyShelf sudo chmod -R 755 /etc/pyShelf
# Create a virtual environment for pyshelf
sudo -u pyshelf uv sync sudo -u pyshelf uv sync
sudo -u pyshelf mkdir release sudo -u pyshelf mkdir release
# Install dependencies # sudo -u pyshelf direnv allow
# 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
else else
sudo apt-get update 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 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 sudo -u pyshelf ./build.sh
# Install assets # Install assets
sudo mkdir -p /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/static /var/lib/pyshelf/assets
sudo cp -r ./src/frontend/templates /var/lib/pyshelf/assets # sudo cp -r ./src/frontend/templates /var/lib/pyshelf/assets
# Install executable # Install executable
sudo cp ./release/pyshelf /usr/local/bin/pyshelf # sudo cp ./release/pyshelf /usr/local/bin/pyshelf
sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf # sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf

2
pyshelf.sh vendored
View File

@@ -3,7 +3,7 @@
# It sets up the environment and runs the main script. # It sets up the environment and runs the main script.
# first we need to activate the virtual environment # first we need to activate the virtual environment
if [ -d ".venv" ]; then if [ -d ".venv" ]; then
source venv/bin/activate source .venv/bin/activate
else else
echo "Virtual environment not found. Please create it first." echo "Virtual environment not found. Please create it first."
exit 1 exit 1