diff --git a/install.sh b/install.sh index e999418..5282112 100644 --- a/install.sh +++ b/install.sh @@ -1,4 +1,9 @@ -if [ ! -f /root/.ssh/id_rsa.pub ] then +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 exit 1 fi @@ -13,6 +18,7 @@ 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/ @@ -27,9 +33,15 @@ systemctl stop nginx rm -rf /etc/nginx mkdir /etc/nginx +mkdir -p /var/www/html +mkdir -p /opt/cache/var-www-html + +systemctl daemon-reload + systemctl enable --now mnt-files.mount +systemctl enable --now var-www-html.mount /opt/nman.sh -systemctl enable nman.timer +systemctl enable --now nman.timer systemctl start nginx \ No newline at end of file diff --git a/mnt-files.mount b/mnt-files.mount index 639a185..72b3ad9 100644 --- a/mnt-files.mount +++ b/mnt-files.mount @@ -5,4 +5,7 @@ Description=mount Type=rclone What=files: Where=/mnt/files -Options=ro,_netdev,allow_other,args2env,config=/root/.config/rclone/rclone.conf,read-only \ No newline at end of file +Options=ro,_netdev,allow_other,args2env,config=/root/.config/rclone/rclone.conf,read-only + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/var-www-html.mount b/var-www-html.mount new file mode 100644 index 0000000..403fd91 --- /dev/null +++ b/var-www-html.mount @@ -0,0 +1,11 @@ +[Unit] +Description=mount + +[Mount] +Type=rclone +What=files:html +Where=/var/www/html +Options=ro,_netdev,allow_other,args2env,config=/root/.config/rclone/rclone.conf,read-only,vfs-cache-mode=full,vfs-cache-max-age=6h,vfs-cache-poll-interval=10m,cache-dir=/opt/cache/var-www-html,no-modtime,transfers=16 + +[Install] +WantedBy=multi-user.target \ No newline at end of file