2024-10-20 13:23:16 -03:00
|
|
|
#!/bin/bash
|
|
|
|
# usage:
|
|
|
|
# ensure-cockpit.sh
|
|
|
|
#
|
|
|
|
# This script ensures that cockpit it installed and setup
|
|
|
|
|
|
|
|
DRY_RUN=false
|
|
|
|
LOCAL=/usr/local
|
|
|
|
SUDO=$(test ${EUID} -ne 0 && which sudo)
|
2024-10-30 16:44:09 -03:00
|
|
|
L4T_VERSION=$(head -n 1 /etc/nv_tegra_release | grep -o 'R..')
|
2024-10-20 13:23:16 -03:00
|
|
|
|
|
|
|
|
2024-10-30 16:44:09 -03:00
|
|
|
if [ "$L4T_VERSION" == "R35" ]; then
|
|
|
|
$SUDO apt install -t focal-backports cockpit -y
|
|
|
|
else
|
|
|
|
$SUDO apt install cockpit -y
|
|
|
|
fi
|
2024-10-20 13:23:16 -03:00
|
|
|
|
2024-10-31 12:55:20 -03:00
|
|
|
$SUDO apt install -y nodejs gettext make
|
|
|
|
$SUDO wget https://github.com/chabad360/cockpit-docker/releases/download/16/cockpit-docker-16.tar.xz
|
|
|
|
$SUDO tar xvf cockpit-docker-16.tar.xz
|
|
|
|
$SUDO cd cockpit-docker ; export NODE_ENV=production ; sudo make install PREFIX="/usr"
|
|
|
|
sudo systemctl restart cockpit.{socket,service}
|
|
|
|
|
2024-10-30 16:44:09 -03:00
|
|
|
# Change the port to 443/80 and restart
|
2024-10-20 13:23:16 -03:00
|
|
|
$SUDO sed -i 's/9090/443/g' /lib/systemd/system/cockpit.socket
|
|
|
|
$SUDO sed -i '/ListenStream=80/d' /lib/systemd/system/cockpit.socket
|
|
|
|
$SUDO sed -i '/ListenStream=443/a ListenStream=80' /lib/systemd/system/cockpit.socket
|
|
|
|
$SUDO systemctl daemon-reload
|
|
|
|
$SUDO systemctl restart cockpit.socket
|
|
|
|
|