scripts/install.sh

52 lines
988 B
Bash

#!/bin/sh
if [ "$EUID" -ne 0 ]; then
echo not root
exit 1
fi
if [ ! -f /root/.ssh/id_rsa.pub ]; then
echo no ssh key, generate: rsa without password
ssh-keygen
fi
echo
echo Add the following key to your remote sftp:
cat /root/.ssh/id_rsa.pub
echo
echo Press enter to continue
read
apt update
apt install -y python3 rclone fuse
mkdir -p /root/.config/rclone
cp -n rclone.conf /root/.config/rclone/rclone.conf
cp nman.service /etc/systemd/system/
cp nman.timer /etc/systemd/system/
cp mnt-files.mount /etc/systemd/system/
cp var-www-html.mount /etc/systemd/system/
cp nman /etc/default/
cp nman.py /opt/
cp nman.sh /opt/
chmod +x /opt/nman.sh
systemctl stop nginx
rm -rf /etc/nginx
mkdir /etc/nginx
mkdir -p /var/www/html
mkdir -p /opt/cache/var-www-html
ln -s /usr/bin/rclone /sbin/mount.rclone
systemctl daemon-reload
systemctl enable --now mnt-files.mount
systemctl enable --now var-www-html.mount
/opt/nman.sh
systemctl enable --now nman.timer
systemctl start nginx