mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
even more changes
Signed-off-by: Paulchen-Panther <Paulchen--Panter@gmx.net>
This commit is contained in:
@@ -6,6 +6,7 @@ install_file()
|
||||
dest="$2"
|
||||
|
||||
if [ ! -e "$dest" ]
|
||||
then
|
||||
cp "$src" "${dest}"
|
||||
return 1
|
||||
else
|
||||
@@ -15,10 +16,7 @@ install_file()
|
||||
}
|
||||
|
||||
|
||||
echo "--- hyperion ambient light postinstall ---"
|
||||
echo "- install configuration template"
|
||||
mkdir -p /etc/hyperion
|
||||
mkdir -p /usr/share/hyperion/custom-effects
|
||||
echo "---Hyperion ambient light postinstall ---"
|
||||
|
||||
#check system
|
||||
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835' /proc/cpuinfo`
|
||||
@@ -27,25 +25,29 @@ CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
|
||||
#Check for a bootloader as Berryboot
|
||||
BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab)
|
||||
|
||||
#get current system ip + add default port
|
||||
address=$(ip -o -4 a | awk '$2 == "eth0" { gsub(/\/.*/, "", $4); print $4 }')":8099"
|
||||
#get current system ip
|
||||
NET_IF=`netstat -rn | awk '/^0.0.0.0/ {thif=substr($0,74,10); print thif;} /^default.*UG/ {thif=substr($0,65,10); print thif;}'`
|
||||
NET_IP=`ifconfig ${NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
|
||||
|
||||
#check if hyperion is running
|
||||
HYPERION_RUNNING=false
|
||||
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
|
||||
|
||||
# search for users in system, returns first entry
|
||||
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
|
||||
|
||||
start_msg=""
|
||||
restart_msg=""
|
||||
SERVICE_POSTFIX=""
|
||||
|
||||
if grep -m1 systemd /proc/1/comm > /dev/null
|
||||
then
|
||||
echo "--> init deamon: systemd"
|
||||
# systemd
|
||||
$HYPERION_RUNNING && systemctl stop hyperiond 2> /dev/null
|
||||
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond.service && systemctl -q enable hyperiond.service
|
||||
start_msg="--> systemctl start hyperiond"
|
||||
systemctl start hyperiond
|
||||
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.service
|
||||
systemctl enable hyperiond"@${FOUND_USR}".service
|
||||
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
|
||||
systemctl start hyperiond"@${FOUND_USR}"
|
||||
|
||||
elif [ -e /sbin/initctl ]
|
||||
then
|
||||
@@ -100,9 +102,12 @@ if [ $CPU_RPI -eq 1 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ${start_msg}
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo "--> Hyperion has been installed/updated!"
|
||||
echo "--> For configuration, visit with your browser: ${address}"
|
||||
echo "--> For configuration, visit with your browser: ${NET_IP}:8090"
|
||||
echo "--> or if already used by another service try: ${NET_IP}:8091"
|
||||
$REBOOTMESSAGE
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo "Webpage: www.hyperion-project.org"
|
||||
@@ -110,28 +115,12 @@ echo "Wiki: wiki.hyperion-project.org"
|
||||
echo "Forum: forum.hyperion-project.org"
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
|
||||
# try to open the browser for desktops. TODO: add headless detection(?)
|
||||
if [ $CPU_X32X64 -eq 1]
|
||||
echo "--> Will open browser with target: ${address}"
|
||||
if [[ -e /usr/bin/xdg-open ]]
|
||||
then
|
||||
xdg-open http://"$address"
|
||||
elif [[ -e /usr/bin/x-www-browser ]]
|
||||
then
|
||||
x-www-browser http://"$address"
|
||||
elif [[ -e /usr/bin/www-browser ]]
|
||||
then
|
||||
www-browser http://"$address"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -e /opt/hyperion/ ]
|
||||
then
|
||||
echo
|
||||
echo "---------------------------------------------------------------------------------"
|
||||
echo "- It seemd that you have an older version of hyperion installed in /opt/hyerion -"
|
||||
echo "- please remove it and check your config to avoid problems -"
|
||||
echo "- It seemd that you have an older version of hyperion installed in /opt/hyperion -"
|
||||
echo "- please remove it to avoid problems -"
|
||||
echo "---------------------------------------------------------------------------------"
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user