UpFast/install.sh
2023-04-11 12:27:09 +02:00

40 lines
734 B
Bash
Executable File

#!/bin/sh
# quick install (and run) script for upfast using systemd
if [ "$(id -u)" -ne 0 ]
then
echo "Please run as root"
exit 1
fi
SIZE="5G"
UFDIR=${1:=/srv/upfast}
USER=${1:=upfast}
useradd --shell /bin/sh --system --home-dir $UFDIR $UFUSER ||
exit 1
mkdir -p "$UFDIR" || # dodge copying of skeletons
exit 1
chown "$UFUSER:$UFUSER" "$UFDIR"
chmod 700 "$UFDIR"
su "$UFUSER" -c"
cd
git clone https://code.cronyakatsuki.xyz/tlast/upfast . ||
exit 1
python3 -m venv env
. ./env/bin/activate ||
exit1
pip install -r requirements.txt ||
exit 1
fallocate -l $SIZE storage
mkfs.ext4 storage
mount storage upload
rm -fd /storage/*" ||
exit 1
cp ./upfast.service /etc/systemd/system/upfast.service
systemctl daemon-reload