forked from ohhdemgirls/PlexInTheCloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07-ubooquity.sh
executable file
·79 lines (67 loc) · 1.97 KB
/
07-ubooquity.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
source vars
## INFO
# This script installs and configures ubooquity
##
#######################
# Pre-Install
#######################
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Execute 'sudo su' to swap to the root user."
exit 1
fi
#######################
# Dependencies
#######################
apt-get install -y default-jre
#######################
# Install
#######################
wget -O ubooquity.zip http://vaemendis.net/ubooquity/service/download.php
unzip ubooquity.zip -d /opt/ubooquity/
rm ubooquity.zip
#######################
# Structure
#######################
rclone mkdir $encrypted:comics
#######################
# Systemd Service File
#######################
tee "/etc/systemd/system/ubooquity.service" > /dev/null <<EOF
[Unit]
Description=Ubooquity
After=rcloneMount.service
[Service]
User=$username
Group=$username
WorkingDirectory=/opt/ubooquity
ExecStart=/usr/bin/java -jar /opt/ubooquity/Ubooquity.jar -headless -webadmin
Restart=always
[Install]
WantedBy=multi-user.target
EOF
#######################
# Permissions
#######################
chown -R $username:$username /opt/ubooquity
#######################
# Autostart
#######################
systemctl daemon-reload
systemctl start ubooquity
systemctl enable ubooquity
#######################
# Remote Access
#######################
echo ''
echo "Do you want to allow remote access to Ubooquity?"
echo "If so, you need to tell UFW to open the port."
echo "Otherwise, you can use SSH port forwarding."
echo ''
echo "Would you like us to open the port in UFW?"
select yn in "Yes" "No"; do
case $yn in
Yes ) ufw allow 2202; echo ''; echo "Port 2202 open, Ubooquity is now available over the internet at $ipaddr:2202/admin."; echo ''; break;;
No ) echo "Port 2202 left closed. You can still access it on your local machine by issuing the following command: ssh $username@$ipaddr -L 2202:localhost:2202"; echo "and then open localhost:2202 on your browser."; exit;;
esac
done