Skip to content

Commit 9d4f580

Browse files
committed
Update jdownloader-install.sh
1 parent 9aba7a2 commit 9d4f580

1 file changed

Lines changed: 152 additions & 6 deletions

File tree

install/jdownloader-install.sh

Lines changed: 152 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ update_os
1515

1616
JAVA_VERSION="21" setup_java
1717

18+
msg_info "Installing GUI Dependencies (Xvfb, Openbox, x11vnc, noVNC, tint2)"
19+
$STD apt install -y \
20+
xvfb \
21+
x11vnc \
22+
novnc \
23+
websockify \
24+
openbox \
25+
tint2 \
26+
x11-xserver-utils \
27+
x11-utils \
28+
wmctrl \
29+
fonts-dejavu-core \
30+
ffmpeg \
31+
rtmpdump
32+
msg_ok "Installed GUI Dependencies"
33+
1834
msg_info "Downloading JDownloader"
1935
mkdir -p /opt/jdownloader
2036
$STD wget -O /opt/jdownloader/JDownloader.jar https://installer.jdownloader.org/JDownloader.jar
@@ -28,33 +44,163 @@ msg_ok "Installed JDownloader"
2844
msg_info "Configuring JDownloader"
2945
cat <<EOF >/opt/jdownloader/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json
3046
{
31-
"email" : "changeme@example.com",
32-
"password" : "changeme",
47+
"email" : null,
48+
"password" : null,
3349
"devicename" : "JDownloader@LXC",
3450
"autoconnectenabledv2" : false
3551
}
3652
EOF
53+
54+
cat <<EOF >/opt/jdownloader/cfg/org.jdownloader.api.RemoteAPIConfig.json
55+
{"headlessmyjdownloadermandatory":false,"deprecatedapienabled":false,"jdanywhereapienabled":false}
56+
EOF
3757
msg_ok "Configured JDownloader"
3858

39-
msg_info "Creating Service"
59+
msg_info "Configuring Openbox (Auto-Maximize JDownloader Window)"
60+
mkdir -p /root/.config/openbox
61+
cat <<'EOF' >/root/.config/openbox/rc.xml
62+
<?xml version="1.0" encoding="UTF-8"?>
63+
<openbox_config xmlns="http://openbox.org/3.4/rc">
64+
<applications>
65+
<application class="*">
66+
<maximized>true</maximized>
67+
<position force="yes">
68+
<x>0</x>
69+
<y>0</y>
70+
</position>
71+
</application>
72+
</applications>
73+
</openbox_config>
74+
EOF
75+
msg_ok "Configured Openbox"
76+
77+
msg_info "Creating Xvfb Service"
78+
cat <<EOF >/etc/systemd/system/xvfb.service
79+
[Unit]
80+
Description=Virtual Framebuffer X Server
81+
After=network.target
82+
83+
[Service]
84+
Type=simple
85+
ExecStartPre=/bin/sh -c 'rm -f /tmp/.X1-lock'
86+
ExecStart=/usr/bin/Xvfb :1 -screen 0 1280x800x24
87+
ExecStartPost=/bin/sh -c 'sleep 1 && DISPLAY=:1 xset s off && DISPLAY=:1 xset s noblank && DISPLAY=:1 xset -dpms'
88+
Restart=always
89+
RestartSec=5
90+
91+
[Install]
92+
WantedBy=multi-user.target
93+
EOF
94+
msg_ok "Created Xvfb Service"
95+
96+
msg_info "Creating Openbox Service"
97+
cat <<EOF >/etc/systemd/system/openbox.service
98+
[Unit]
99+
Description=Openbox Window Manager
100+
After=xvfb.service
101+
Requires=xvfb.service
102+
103+
[Service]
104+
Type=simple
105+
Environment=DISPLAY=:1
106+
ExecStart=/usr/bin/openbox
107+
Restart=always
108+
RestartSec=5
109+
110+
[Install]
111+
WantedBy=multi-user.target
112+
EOF
113+
msg_ok "Created Openbox Service"
114+
115+
msg_info "Creating tint2 Taskbar Service"
116+
cat <<EOF >/etc/systemd/system/tint2.service
117+
[Unit]
118+
Description=tint2 Taskbar
119+
After=openbox.service
120+
Requires=openbox.service
121+
122+
[Service]
123+
Type=simple
124+
Environment=DISPLAY=:1
125+
ExecStart=/usr/bin/tint2
126+
Restart=always
127+
RestartSec=5
128+
129+
[Install]
130+
WantedBy=multi-user.target
131+
EOF
132+
msg_ok "Created tint2 Service"
133+
134+
msg_info "Creating JDownloader Service"
40135
cat <<EOF >/etc/systemd/system/jdownloader.service
41136
[Unit]
42137
Description=JDownloader Download Manager
43-
After=network.target
138+
After=openbox.service
139+
Requires=openbox.service
44140
45141
[Service]
46142
Type=simple
47143
User=root
144+
Environment=DISPLAY=:1
48145
WorkingDirectory=/opt/jdownloader
49-
ExecStart=/usr/bin/java -Djava.awt.headless=true -jar /opt/jdownloader/JDownloader.jar
146+
ExecStartPre=/bin/sleep 3
147+
ExecStart=/usr/bin/java -Dsun.java2d.xrender=false -Dsun.java2d.pmoffscreen=false -Dsun.java2d.opengl=false -jar /opt/jdownloader/JDownloader.jar
50148
Restart=always
51149
RestartSec=10
52150
53151
[Install]
54152
WantedBy=multi-user.target
55153
EOF
154+
msg_ok "Created JDownloader Service"
155+
156+
msg_info "Creating x11vnc Service"
157+
cat <<EOF >/etc/systemd/system/x11vnc.service
158+
[Unit]
159+
Description=x11vnc Server
160+
After=jdownloader.service
161+
Requires=xvfb.service
162+
163+
[Service]
164+
Type=simple
165+
ExecStart=/usr/bin/x11vnc -display :1 -forever -shared -rfbport 5900 -nopw -noipv6 -xkb -noxdamage -nowf -nowcr -wait 50 -defer 50
166+
Restart=always
167+
RestartSec=5
168+
169+
[Install]
170+
WantedBy=multi-user.target
171+
EOF
172+
msg_ok "Created x11vnc Service"
173+
174+
msg_info "Creating noVNC Service"
175+
cat <<EOF >/etc/systemd/system/novnc.service
176+
[Unit]
177+
Description=noVNC WebSocket Proxy
178+
After=x11vnc.service
179+
Requires=x11vnc.service
180+
181+
[Service]
182+
Type=simple
183+
ExecStart=/usr/bin/websockify --web=/usr/share/novnc 6080 localhost:5900
184+
Restart=always
185+
RestartSec=5
186+
187+
[Install]
188+
WantedBy=multi-user.target
189+
EOF
190+
msg_ok "Created noVNC Service"
191+
192+
msg_info "Starting Services"
193+
systemctl daemon-reload
194+
systemctl enable -q --now xvfb
195+
sleep 2
196+
systemctl enable -q --now openbox
197+
sleep 1
198+
systemctl enable -q --now tint2
56199
systemctl enable -q --now jdownloader
57-
msg_ok "Created Service"
200+
sleep 3
201+
systemctl enable -q --now x11vnc
202+
systemctl enable -q --now novnc
203+
msg_ok "Started Services"
58204

59205
motd_ssh
60206
customize

0 commit comments

Comments
 (0)