1
0
forked from crony/UpFast
UpFast/install.sh

40 lines
734 B
Bash
Raw Normal View History

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