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:
34
install.sh
vendored
34
install.sh
vendored
@@ -4,6 +4,19 @@ set -e # Exit on error
|
|||||||
cd /tmp/
|
cd /tmp/
|
||||||
git clone https://github.com/th3r00t/pyShelf.git
|
git clone https://github.com/th3r00t/pyShelf.git
|
||||||
cd /tmp/pyShelf/
|
cd /tmp/pyShelf/
|
||||||
|
# create pyshelf system user if it doesn't exist
|
||||||
|
if ! id -u pyshelf >/dev/null 2>&1; then
|
||||||
|
sudo useradd -r -s /usr/bin/nologin pyshelfA
|
||||||
|
sudo mkdir -p /home/pyshelf
|
||||||
|
sudo chown pyshelf:pyshelf /home/pyshelf
|
||||||
|
sudo chmod 755 /home/pyshelf
|
||||||
|
fi
|
||||||
|
# make home dir for pyshelf user if it doesn't exist
|
||||||
|
if [ ! -d /home/pyshelf ]; then
|
||||||
|
sudo mkdir -p /home/pyshelf
|
||||||
|
sudo chown pyshelf:pyshelf /home/pyshelf
|
||||||
|
sudo chmod 755 /home/pyshelf
|
||||||
|
fi
|
||||||
|
|
||||||
# Ensure the correct branch is checked out before installing dependencies
|
# Ensure the correct branch is checked out before installing dependencies
|
||||||
git fetch origin
|
git fetch origin
|
||||||
@@ -15,14 +28,12 @@ if [ -f /etc/arch-release ]; then
|
|||||||
sudo mkdir /etc/pyShelf
|
sudo mkdir /etc/pyShelf
|
||||||
sudo cp -avR . /etc/pyShelf
|
sudo cp -avR . /etc/pyShelf
|
||||||
cd /etc/pyShelf
|
cd /etc/pyShelf
|
||||||
# I need to create a system user for pyshelf, if it doesn't exist
|
# sudo chown -R pyshelf:pyshelf /etc/pyShelf
|
||||||
if ! id -u pyshelf >/dev/null 2>&1; then
|
# sudo chmod -R 755 /etc/pyShelf
|
||||||
sudo useradd -r -s /usr/bin/nologin pyshelf
|
# sudo -u pyshelf uv sync
|
||||||
fi
|
# sudo -u pyshelf mkdir release
|
||||||
sudo chown -R pyshelf:pyshelf /etc/pyShelf
|
sudo uv sync
|
||||||
sudo chmod -R 755 /etc/pyShelf
|
sudo mkdir release
|
||||||
sudo -u pyshelf uv sync
|
|
||||||
sudo -u pyshelf mkdir release
|
|
||||||
# sudo -u pyshelf direnv allow
|
# sudo -u pyshelf direnv allow
|
||||||
else
|
else
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@@ -31,7 +42,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the release
|
# Build the release
|
||||||
sudo -u pyshelf ./build.sh
|
sudo ./build.sh
|
||||||
|
|
||||||
# Install assets
|
# Install assets
|
||||||
# sudo mkdir -p /var/lib/pyshelf/assets
|
# sudo mkdir -p /var/lib/pyshelf/assets
|
||||||
@@ -40,5 +51,10 @@ sudo -u pyshelf ./build.sh
|
|||||||
|
|
||||||
# Install executable
|
# Install executable
|
||||||
# sudo cp ./release/pyshelf /usr/local/bin/pyshelf
|
# sudo cp ./release/pyshelf /usr/local/bin/pyshelf
|
||||||
|
sudo ln -s /etc/pyShelf/pyshelf.sh /usr/local/bin/
|
||||||
|
# Make sure the executable is owned by the pyshelf user
|
||||||
|
# sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf.sh
|
||||||
|
# Make the executable accessible
|
||||||
|
# sudo chmod 755 /usr/local/bin/pyshelf.sh
|
||||||
# sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf
|
# sudo chown pyshelf:pyshelf /usr/local/bin/pyshelf
|
||||||
|
|
||||||
|
|||||||
4
pyshelf.sh
vendored
4
pyshelf.sh
vendored
@@ -9,8 +9,8 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# then we need to run the main script
|
# then we need to run the main script
|
||||||
if [ -f "release/pyshelf" ]; then
|
if [ -f "/etc/pyShelf/release/pyshelf" ]; then
|
||||||
sudo -u pyshelf /etc/pyShelf/release/pyshelf
|
exec /etc/pyShelf/release/pyshelf
|
||||||
else
|
else
|
||||||
echo "Main script not found. Please check the directory."
|
echo "Main script not found. Please check the directory."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user