Mu2_Deploy/reload-cockpit.sh

35 lines
930 B
Bash
Raw Permalink Normal View History

#!/bin/bash
# usage:
# reload-cockpit.sh
#
# This script first ensures that cockpit is installed and setup, then it will
set -x
LOCAL=/usr/local
LOCAL_SCRIPTS=("temperature.sh" "cockpitScript.sh")
# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Permission denied. Please run as root."
exit 1
fi
# Copy cockpit files to the correct locations
rm -rf /usr/share/cockpit/general
mkdir -p /usr/share/cockpit/general
cp -rf ui/general/* /usr/share/cockpit/general/
cp -rf ui/branding-ubuntu/* /usr/share/cockpit/branding/ubuntu/
cp -rf ui/static/* /usr/share/cockpit/static/
cp -rf ui/base1/* /usr/share/cockpit/base1/
[ -d $LOCAL/echopilot ] || mkdir $LOCAL/echopilot
install -Dm755 version.txt $LOCAL/echopilot/.
for script in "${LOCAL_SCRIPTS[@]}"; do
install -Dm755 $script $LOCAL/echopilot/$script
done
# Restart the cockpit service
# systemctl daemon-reload
# systemctl restart cockpit.socket