forked from ophub/amlogic-s9xxx-armbian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand-service.sh
executable file
·569 lines (499 loc) · 23.8 KB
/
command-service.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
#!/bin/bash
#============================================================================
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
#
# This file is a part of the Rebuild Armbian
# https://github.com/ophub/amlogic-s9xxx-armbian
#
# Function: Execute service software install/update/remove command
# Copyright (C) 2021- https://github.com/unifreq/openwrt_packit
# Copyright (C) 2021- https://github.com/ophub/amlogic-s9xxx-armbian
#
# Command: command-service.sh -s <software_id> -m <install/update/remove>
# Example: command-service.sh -s 303 -m install
# command-service.sh -s 303 -m update
# command-service.sh -s 303 -m remove
#
#============================== Software list ===============================
#
# software_303 : For nps
# software_304 : For npc
# software_305 : For plex
# software_306 : For emby-server
# software_307 : For kvm
# software_308 : For pve
# software_309 : For casaos
# software_310 : For arozos
#
#============================================================================
# Execute generic functions
software_path="/usr/share/ophub/armbian-software"
software_command="${software_path}/software-command.sh"
source "${software_command}"
# For nps
software_303() {
case "${software_manage}" in
install)
# Software version query api
software_api="https://api.github.com/repos/ehang-io/nps/releases"
# Check the latest version, E.g: v0.26.10
software_latest_version="$(curl -s "${software_api}" | grep "tag_name" | awk -F '"' '{print $4}' | tr " " "\n" | sort -rV | head -n 1)"
# Query download address, E.g: https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_arm64_server.tar.gz
software_url="$(curl -s "${software_api}" | grep -oE "https:.*/${software_latest_version}/linux_arm64_server.tar.gz")"
[[ -n "${software_url}" ]] || error_msg "The download address is empty!"
echo -e "${INFO} Software download from: [ ${software_url} ]"
# Download software, E.g: /tmp/tmp.xxx/linux_arm64_server.tar.gz
tmp_download="$(mktemp -d)"
software_filename="${software_url##*/}"
echo -e "${STEPS} Start downloading NPS..."
curl -fsSL "${software_url}" -o "${tmp_download}/${software_filename}"
[[ "${?}" -eq "0" && -s "${tmp_download}/${software_filename}" ]] || error_msg "Software download failed!"
echo -e "${INFO} Software downloaded successfully: $(ls ${tmp_download} -l)"
# Installing and start NPS
echo -e "${STEPS} Start the installation and start NPS..."
cd ${tmp_download} && tar -xf ${software_filename}
sudo ./nps install
sudo nps start
sync && sleep 3
echo -e "${NOTE} The NPS address: [ http://${my_address}:8080 ]"
echo -e "${NOTE} The NPS account: [ username:admin / password:123 ]"
echo -e "${NOTE} The NPS Instructions for Use: [ https://ehang-io.github.io/nps ]"
echo -e "${SUCCESS} The NPS installation is successful."
;;
update)
sudo nps stop && sudo nps-update update && sudo nps restart
echo -e "${SUCCESS} The NPS update and restart successfully."
;;
remove)
sudo nps stop && sudo nps uninstall
sudo rm -rf /etc/nps /root/conf/nps.conf /usr/local/bin/nps /usr/local/bin/nps-update /usr/bin/nps /usr/bin/nps-update 2>/dev/null
echo -e "${SUCCESS} The NPS remove successfully."
;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For npc
software_304() {
case "${software_manage}" in
install)
# Software version query api
software_api="https://api.github.com/repos/ehang-io/nps/releases"
# Check the latest version, E.g: v0.26.10
software_latest_version="$(curl -s "${software_api}" | grep "tag_name" | awk -F '"' '{print $4}' | tr " " "\n" | sort -rV | head -n 1)"
# Query download address, E.g: https://github.com/ehang-io/nps/releases/download/v0.26.10/linux_arm64_client.tar.gz
software_url="$(curl -s "${software_api}" | grep -oE "https:.*/${software_latest_version}/linux_arm64_client.tar.gz")"
[[ -n "${software_url}" ]] || error_msg "The download address is empty!"
echo -e "${INFO} Software download from: [ ${software_url} ]"
# Download software, E.g: /tmp/tmp.xxx/linux_arm64_client.tar.gz
tmp_download="$(mktemp -d)"
software_filename="${software_url##*/}"
echo -e "${STEPS} Start downloading NPC..."
curl -fsSL "${software_url}" -o "${tmp_download}/${software_filename}"
[[ "${?}" -eq "0" && -s "${tmp_download}/${software_filename}" ]] || error_msg "Software download failed!"
echo -e "${INFO} Software downloaded successfully: $(ls ${tmp_download} -l)"
# Installing and start NPC
echo -e "${STEPS} Start the installation and start NPC..."
cd ${tmp_download} && tar -xf ${software_filename}
sudo mkdir -p /etc/npc && sudo cp -rf conf /etc/npc
sudo ./npc install
sudo npc start
sync && sleep 3
echo -e "${NOTE} The NPS config file path: [ /etc/npc/conf/npc.conf ]"
echo -e "${NOTE} The NPS enable config command: [ sudo npc -config=/etc/npc/conf/npc.conf ]"
echo -e "${NOTE} The NPC Instructions for Use: [ https://ehang-io.github.io/nps ]"
echo -e "${SUCCESS} The NPC installation is successful."
;;
update)
sudo npc stop && sudo npc-update update && sudo npc restart
echo -e "${SUCCESS} The NPC update and restart successfully."
;;
remove)
sudo npc stop && sudo npc uninstall
sudo rm -rf /etc/npc /root/conf/npc.conf /usr/local/bin/npc /usr/local/bin/npc-update /usr/bin/npc /usr/bin/npc-update 2>/dev/null
echo -e "${SUCCESS} The NPC remove successfully."
;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For plex
software_305() {
case "${software_manage}" in
install)
# Install basic dependencies
echo -e "${STEPS} Start installing basic dependencies..."
software_install "curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates"
# Add Plex Media Server APT repository
echo -e "${STEPS} Start adding the Plex Media Server APT repository..."
echo "deb https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
# Import GPG key
echo -e "${STEPS} Start importing GPG keys..."
curl -fsSOL https://downloads.plex.tv/plex-keys/PlexSign.key
cat PlexSign.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/PlexSigkey.gpg
rm -f PlexSign.key
# Installing Plex Media server
echo -e "${STEPS} Start installing Plex Media server..."
software_install "plexmediaserver"
# Ensure to open the port 32400 through the firewall
echo -e "${STEPS} Set firewall to open port 32400..."
sudo ufw allow 32400 2>/dev/null
# Enable Plex server to start automatically on system boot
echo -e "${STEPS} Start setting up the Plex server to start automatically at system boot..."
sudo systemctl daemon-reload
sudo systemctl enable --now plexmediaserver.service
sudo systemctl restart plexmediaserver.service
# Confirm the service is enabled
echo -e "${STEPS} Confirm the service is enabled..."
systemctl is-enabled plexmediaserver.service
# Configure Plex Media Server
sync && sleep 3
echo -e "${NOTE} The Plex Media Server address: [ http://${my_address}:32400/web ]"
echo -e "${SUCCESS} The Plex Media Server installation is successful."
;;
update) software_update ;;
remove) software_remove "plexmediaserver" ;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For emby-server
software_306() {
case "${software_manage}" in
install)
# Software version query api
software_api="https://api.github.com/repos/MediaBrowser/Emby.Releases/releases"
# Check the latest version, E.g: 4.7.5.0
software_latest_version="$(curl -s "${software_api}" | grep "tag_name" | awk -F '"' '{print $4}' | grep -E [.]0$ | tr " " "\n" | sort -rV | head -n 1)"
# Query download address, E.g: https://github.com/MediaBrowser/Emby.Releases/releases/download/4.7.5.0/emby-server-deb_4.7.5.0_arm64.deb
software_url="$(curl -s "${software_api}" | grep -oE "https:.*${software_latest_version}.*_arm64.deb")"
[[ -n "${software_url}" ]] || error_msg "The download address is empty!"
echo -e "${INFO} Software download from: [ ${software_url} ]"
# Download software, E.g: /tmp/tmp.xxx/emby-server-deb_4.7.5.0_arm64.deb
tmp_download="$(mktemp -d)"
software_filename="${software_url##*/}"
echo -e "${STEPS} Start downloading Emby Server..."
curl -fsSL "${software_url}" -o "${tmp_download}/${software_filename}"
[[ "${?}" -eq "0" && -s "${tmp_download}/${software_filename}" ]] || error_msg "Software download failed!"
echo -e "${INFO} Software downloaded successfully: $(ls ${tmp_download} -l)"
# Installing Emby Server
echo -e "${STEPS} Start installing Emby Server..."
sudo dpkg -i ${tmp_download}/${software_filename}
# Enable Emby Server to start automatically on system boot
echo -e "${STEPS} Start setting up the Emby Server to start automatically at system boot..."
sudo systemctl daemon-reload
sudo systemctl enable --now emby-server.service
sudo systemctl restart emby-server.service
# Confirm the service is enabled
echo -e "${STEPS} Confirm the service is enabled..."
systemctl is-enabled emby-server.service
# Configure Emby Server
sync && sleep 3
echo -e "${NOTE} The Emby Server address: [ http://${my_address}:8096 ]"
echo -e "${SUCCESS} The Emby Server installation is successful."
;;
update) software_update ;;
remove) software_remove "emby-server" ;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For kvm
software_307() {
# kvm general settings
my_network_br0="/etc/network/interfaces.d/br0"
kvm_package_list="\
gconf2 qemu-system-arm qemu-utils qemu-efi ipxe-qemu libvirt-daemon-system libvirt-clients bridge-utils \
virtinst virt-manager seabios vgabios gir1.2-spiceclientgtk-3.0 xauth fonts-noto* \
"
case "${software_manage}" in
install)
echo -e "${STEPS} Start installing KVM and other related virtualization packages..."
software_install "${kvm_package_list}"
# Get desktop system login user
echo -ne "${OPTIONS} Please input the login desktop system user(non-root): "
read get_desktop_user
[[ -n "${get_desktop_user}" ]] && my_user="${get_desktop_user}" || my_user="${USER}"
# If the user exists, add it to the group
if ! id -u ${my_user} >/dev/null 2>&1; then
echo -e "${NOTE} User(${my_user}) does not exist, Start creating..."
sudo adduser ${my_user}
sudo usermod -aG sudo ${my_user}
fi
# Add the login desktop system user to the kvm and libvirt user groups
echo -e "${STEPS} Start adding user(${my_user}) to the kvm and libvirt user groups..."
sudo usermod -aG kvm ${my_user}
sudo usermod -aG libvirt ${my_user}
# Enable X11Forwarding to run Linux GUI programs remotely
sed -i '/X11Forwarding/d' /etc/ssh/sshd_config 2>/dev/null
echo "X11Forwarding yes" >>/etc/ssh/sshd_config 2>/dev/null
# Enable and start the libvirtd.service daemon
echo -e "${STEPS} Start enabling and starting the libvirtd.service daemon..."
sudo systemctl daemon-reload
sudo systemctl enable --now libvirtd.service
sudo systemctl restart libvirtd.service
#sudo systemctl status libvirtd.service
# Add network bridge settings template
echo -e "${STEPS} Start adding bridged network settings template..."
[[ -z "${my_network_card}" || -z "${my_address}" || -z "${my_broadcast}" || -z "${my_netmask}" || -z "${my_gateway}" ]] && {
echo -ne "${OPTIONS} Please input IP address, the default is [ ${my_address} ]: "
read get_address
[[ -n "${get_address}" ]] && my_address="${get_address}"
echo -ne "${OPTIONS} Please input broadcast, the default is [ ${my_broadcast} ]: "
read get_broadcast
[[ -n "${get_broadcast}" ]] && my_broadcast="${get_broadcast}"
echo -ne "${OPTIONS} Please input netmask, the default is [ ${my_netmask} ]: "
read get_netmask
[[ -n "${get_netmask}" ]] && my_netmask="${get_netmask}"
echo -ne "${OPTIONS} Please input gateway, the default is [ ${my_gateway} ]: "
read get_gateway
[[ -n "${get_gateway}" ]] && my_gateway="${get_gateway}"
}
sudo rm -f ${my_network_br0} 2>/dev/null
sudo cat >${my_network_br0} <<EOF
# Network card settings
allow-hotplug ${my_network_card}
iface ${my_network_card} inet manual
pre-up ifconfig \$IFACE up
pre-down ifconfig \$IFACE down
# Bridge settings
auto br0
iface br0 inet static
bridge_ports ${my_network_card}
bridge_stp off
bridge_waitport 0
bridge_fd 0
address ${my_address}
broadcast ${my_broadcast}
netmask ${my_netmask}
gateway ${my_gateway}
dns-nameservers ${my_gateway}
EOF
# Disable netfilter on KVM bridge
sudo cat >>/etc/sysctl.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
EOF
# Reload /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
# Set the virtual machine to start automatically
vm_autostart="/etc/default/libvirt-guests"
[[ -f "${vm_autostart}" ]] && {
sed -i '/^ON_BOOT=.*/d' ${vm_autostart} 2>/dev/null
sed -i '/^ON_SHUTDOWN=.*/d' ${vm_autostart} 2>/dev/null
echo "ON_BOOT=start" >>${vm_autostart} 2>/dev/null
echo "ON_SHUTDOWN=shutdown" >>${vm_autostart} 2>/dev/null
}
sync && sleep 3
echo -e "${NOTE} The bridge network settings: [ ${my_network_br0} ]"
echo -e "${NOTE} KVM can install OpenWrt, Debian, Ubuntu, OpenSUSE, ArchLinux, Centos, Gentoo, KyLin, UOS, etc."
echo -e "${NOTE} Making and using OpenWrt: [ https://github.com/unifreq/openwrt_packit ]"
echo -e "${SUCCESS} The KVM installation is successful."
;;
update) software_update ;;
remove)
software_remove "${kvm_package_list}"
sudo rm -f ${my_network_br0} 2>/dev/null
;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For pve, Tutorials for using [ Cooip-JM: https://github.com/cooip-jm/About-openwrt/wiki ]
software_308() {
# pve general settings
my_interfaces="/etc/network/interfaces"
pve_package_list="pve-manager proxmox-ve"
networking_package_list="ifupdown2 resolvconf bridge-utils lm-sensors"
case "${software_manage}" in
install)
echo -e "${STEPS} Start installing PVE..."
# Add PVE software source
echo -e "${STEPS} Start adding [ ${VERSION_CODENAME} ] software source..."
if [[ "${VERSION_CODENAME}" == "bookworm" ]]; then
# Reference documentation: Cooip JM
echo "deb https://mirrors.apqa.cn/proxmox/debian/pve ${VERSION_CODENAME} port" >/etc/apt/sources.list.d/pveport.list
curl https://mirrors.apqa.cn/proxmox/debian/pveport.gpg -o /etc/apt/trusted.gpg.d/pveport.gpg
elif [[ "${VERSION_CODENAME}" == "bullseye" ]]; then
# Reference documentation: https://www.zhou.pp.ua/2023/08/08/n1/
echo "deb https://raw.githubusercontent.com/pimox/pimox7/master/ dev/" >/etc/apt/sources.list.d/pimox.list
curl https://raw.githubusercontent.com/pimox/pimox7/master/KEY.gpg | apt-key add -
else
error_msg "This version is not supported: [ ${VERSION_CODENAME} ]"
fi
# Declare PATH
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
echo -e "${STEPS} Start installing networking packages..."
software_install "${networking_package_list}"
# Add network settings
echo -e "${STEPS} Start adding network settings..."
[[ -z "${my_network_card}" || -z "${my_mac}" || -z "${my_address}" || -z "${my_broadcast}" || -z "${my_netmask}" || -z "${my_gateway}" ]] && {
echo -ne "${OPTIONS} Please input IP address, the default is [ ${my_address} ]: "
read get_address
[[ -n "${get_address}" ]] && my_address="${get_address}"
echo -ne "${OPTIONS} Please input netmask, the default is [ ${my_netmask} ]: "
read get_netmask
[[ -n "${get_netmask}" ]] && my_netmask="${get_netmask}"
echo -ne "${OPTIONS} Please input gateway, the default is [ ${my_gateway} ]: "
read get_gateway
[[ -n "${get_gateway}" ]] && my_gateway="${get_gateway}"
}
sudo mv -f ${my_interfaces} ${my_interfaces}.bak 2>/dev/null
sudo cat >${my_interfaces} <<EOF
auto lo
iface lo inet loopback
iface ${my_network_card} inet manual
auto vmbr0
iface vmbr0 inet static
hwaddress ether ${my_mac}
address ${my_address}/24
broadcast ${my_broadcast}
netmask ${my_netmask}
gateway ${my_gateway}
bridge-ports ${my_network_card}
bridge-stp off
bridge-fd 0
dns-nameservers ${my_gateway}
EOF
# Confirm hostname
echo -ne "${OPTIONS} Please input the hostname, the default is [ ${my_hostname} ]: "
read get_hostname
[[ -n "${get_hostname}" ]] && my_hostname="${get_hostname}"
echo -e "${INFO} Set the hostname: [ ${my_hostname} ]"
sudo hostnamectl set-hostname ${my_hostname}
sudo cat >/etc/hosts <<EOF
127.0.0.1 localhost
${my_address} ${my_hostname}
EOF
# Adjust the DNS settings
sed -i "s|nameserver.*|nameserver ${my_gateway}|g" /etc/resolv.conf
# Disable systemd-networkd and NetworkManager
networkmanager_status_check="$(systemctl is-active NetworkManager)"
if [[ "${networking_status_check}" == "active" ]]; then
echo -e "${INFO} Disable systemd-networkd and NetworkManager..."
sudo systemctl disable systemd-networkd
sudo systemctl disable systemd-networkd.socket
sudo systemctl disable NetworkManager
sudo systemctl stop NetworkManager
sudo systemctl daemon-reload
fi
# Install networking packages
networking_status_check="$(systemctl is-active networking)"
if [[ "${networking_status_check}" != "active" ]]; then
echo -e "${INFO} Enable networking..."
sudo systemctl enable --now networking
sudo systemctl restart networking
sudo systemctl daemon-reload
echo -e "${NOTE} Network adjustments require a reboot. Please try again after restarting."
sudo sync && sudo reboot
exit 0
fi
echo -e "${STEPS} Start installing packages..."
software_install "${pve_package_list}"
# Optimizing LXC container logs
echo -e "${INFO} Optimizing LXC container logs."
rsyslog_conf="/etc/rsyslog.conf"
[[ -f "${rsyslog_conf}" ]] && {
echo -e "${STEPS} Optimizing LXC container logs..."
sed -i s'|^*.*;auth,authpriv|#&|'g ${rsyslog_conf}
sed -i s'|^daemon.*|#&|'g ${rsyslog_conf}
[[ -f "/var/log/syslog" ]] && echo "" >/var/log/syslog
[[ -f "/var/log/daemon.log" ]] && echo "" >/var/log/daemon.log
sudo service syslog restart
}
# Disable zram
echo -e "${INFO} Disable zram service."
sudo systemctl disable armbian-zram-config.service
sudo systemctl disable armbian-ramlog.service
# Remove ceph-dkms package error
echo -e "${INFO} Remove ceph-dkms package error."
sudo rm -rf /usr/src/ceph-dkms-0.0.2
sudo dpkg --configure -a
# Install optional packages
software_install "ifupdown2"
sudo ifup vmbr0 ${my_network_card}
software_update
# Adjust the PVE web interface (Fix the PVE web interface certificate access)
echo -e "${INFO} Adjust certificate."
sudo rm -f /etc/pve/pve-root-ca.pem /etc/pve/priv/pve-root-ca.* /etc/pve/local/pve-ssl.*
sudo pvecm updatecerts -f
# Add startup service
echo -e "${INFO} Add pveproxy as a startup service."
sudo systemctl daemon-reload
sudo systemctl enable --now pveproxy
sudo systemctl restart pveproxy
# Adjust sshd_config (Fix the SSH certificate access modified by PVE)
[[ -L ~/.ssh/authorized_keys ]] && {
cp -f $(ls -l ~/.ssh/authorized_keys | awk '{print $NF}') ~/.ssh/authorized_keys_2
chmod 600 ~/.ssh/authorized_keys_2
sudo sed -i '/AuthorizedKeysFile/d' /etc/ssh/sshd_config
sudo echo "AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys_2" >>/etc/ssh/sshd_config
sudo /etc/init.d/ssh restart
}
# Fix log issue
[[ -f "/var/log/pveproxy/access.log" ]] || {
echo -e "${INFO} Fix the missing log issue."
sudo mkdir -p /var/log/pveproxy
sudo touch /var/log/pveproxy/access.log
sudo chown -R www-data:www-data /var/log/pveproxy/
sudo chmod -R 755 /var/log/pveproxy/
sudo systemctl restart pveproxy
}
sync && sleep 3
echo -e "${NOTE} The network address: [ https://${my_address}:8006 ]"
echo -e "${NOTE} Username and Password: [ Your system account ]"
echo -e "${SUCCESS} PVE installation is successful, please [ reboot ] Armbian."
;;
update) software_update ;;
remove) software_remove "${pve_package_list}" ;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For casaos
software_309() {
case "${software_manage}" in
install)
echo -e "${STEPS} Start installing CasaOS..."
curl -fsSL https://get.casaos.io | sudo bash
sync && sleep 3
# Get the CasaOS service port
CASA_CONF_PATH="/etc/casaos/gateway.ini"
CASA_PORT="$(grep "port" ${CASA_CONF_PATH} | awk -F "=" '{print $2}')"
[[ "${CASA_PORT}" -eq "80" ]] && my_casa_port="" || my_casa_port=":${CASA_PORT}"
echo -e "${NOTE} The CasaOS access address: [ http://${my_address}${my_casa_port} ]"
echo -e "${SUCCESS} CasaOS installation successful."
;;
update) software_update ;;
remove)
sudo casaos-uninstall
echo -e "${SUCCESS} CasaOS uninstallation successful."
;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# For arozos
software_310() {
case "${software_manage}" in
install)
echo -e "${STEPS} Start installing ArozOS..."
wget -O install.sh https://raw.githubusercontent.com/tobychui/arozos/master/installer/install.sh && bash install.sh
sync && sleep 3
echo -e "${SUCCESS} ArozOS installation successful."
;;
update) software_update ;;
remove)
# Stop and disable the ArozOS service
sudo systemctl stop arozos.service 2>/dev/null
sudo systemctl disable arozos.service 2>/dev/null
sudo rm -f /etc/systemd/system/arozos.service 2>/dev/null
sudo systemctl daemon-reload
# Uninstall ArozOS
sudo rm -rf ~/arozos
sync && sleep 3
echo -e "${SUCCESS} ArozOS uninstallation successful."
;;
*) error_msg "Invalid input parameter: [ ${@} ]" ;;
esac
}
# Initialize variables
init_var "${@}"
software_${software_id} ${software_manage}