mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Created install.sh and pyshelf.sh
Also refactored methods to work as a zipapp
This commit is contained in:
35
install.sh
vendored
35
install.sh
vendored
@@ -11,11 +11,33 @@ git checkout 0.8.0--dev-zipapp
|
|||||||
|
|
||||||
# if on arch linux, install python3-uv
|
# if on arch linux, install python3-uv
|
||||||
if [ -f /etc/arch-release ]; then
|
if [ -f /etc/arch-release ]; then
|
||||||
sudo pacman -S --needed python-uv python python-pip python-pipx nodejs npm\
|
sudo pacman -Syy python-uv
|
||||||
libxml2 libxslt zlib libjpeg-turbo gcc base-devel python-loguru\
|
sudo mkdir /etc/pyShelf
|
||||||
python-rapidfuzz
|
sudo cp -avR . /etc/pyShelf
|
||||||
pipx install . --include-deps
|
cd /etc/pyShelf
|
||||||
pipx ensurepath
|
# I need to create a system user for pyshelf, if it doesn't exist
|
||||||
|
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
|
||||||
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
|
||||||
@@ -23,7 +45,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the release
|
# Build the release
|
||||||
./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
|
||||||
@@ -32,4 +54,5 @@ 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
|
||||||
|
|
||||||
|
|||||||
17
pyshelf.sh
vendored
Executable file
17
pyshelf.sh
vendored
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/sh
|
||||||
|
# This script is used to run the pyshelf application.
|
||||||
|
# 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
|
||||||
|
else
|
||||||
|
echo "Virtual environment not found. Please create it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# then we need to run the main script
|
||||||
|
if [ -f "release/pyshelf" ]; then
|
||||||
|
./release/pyshelf
|
||||||
|
else
|
||||||
|
echo "Main script not found. Please check the directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user