mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
update adjustments and ui (#384)
* update
* update
* testit
* Revert "testit"
This reverts commit b1cc645161
.
* update schema
* update
* add adjustment to serverinfo
* remove Adjustbool
* remove v4l2only
* fix json check for create effect
* update deb
* update
* update remote adjust
* update
* add eff schemas
This commit is contained in:
@@ -5,22 +5,32 @@ install_file()
|
||||
src="$1"
|
||||
dest="$2"
|
||||
|
||||
if [ -e "$dest" ] && ! cmp --quiet "$src" "$dest"
|
||||
then
|
||||
echo "INFO: $dest exists, new version copied to ${dest}.new"
|
||||
cp "$src" "${dest}.new"
|
||||
if [ ! -e "$dest" ]
|
||||
cp "$src" "${dest}"
|
||||
return 1
|
||||
else
|
||||
echo "--> Service file already exists, skip creation"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cp "$src" "${dest}"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
echo "--- hyperion ambient light postinstall ---"
|
||||
echo "- install configuration template"
|
||||
mkdir -p /etc/hyperion
|
||||
mkdir -p /usr/share/hyperion/custom-effects
|
||||
|
||||
#check system
|
||||
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835' /proc/cpuinfo`
|
||||
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"
|
||||
|
||||
#check if hyperion is running
|
||||
HYPERION_RUNNING=false
|
||||
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
|
||||
|
||||
@@ -30,38 +40,91 @@ SERVICE_POSTFIX=""
|
||||
|
||||
if grep -m1 systemd /proc/1/comm > /dev/null
|
||||
then
|
||||
echo "- init deamon: systemd"
|
||||
echo "--> init deamon: systemd"
|
||||
# systemd
|
||||
$HYPERION_RUNNING && systemctl stop hyperion 2> /dev/null
|
||||
install_file /usr/share/hyperion/service/hyperion.systemd.sh /etc/systemd/system/hyperiond.service || SERVICE_POSTFIX=".new"
|
||||
systemctl -q enable hyperiond.service
|
||||
start_msg="systemctl start hyperion"
|
||||
$HYPERION_RUNNING && systemctl start hyperiond
|
||||
$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
|
||||
|
||||
elif [ -e /sbin/initctl ]
|
||||
then
|
||||
echo "- init deamon: upstart"
|
||||
echo "--> init deamon: upstart"
|
||||
# upstart
|
||||
$HYPERION_RUNNING && initctl stop hyperiond
|
||||
install_file /usr/share/hyperion/service/hyperiond.initctl.sh /etc/init/hyperion.conf || SERVICE_POSTFIX=".new"
|
||||
initctl reload-configuration
|
||||
start_msg="initctl start hyperion"
|
||||
$HYPERION_RUNNING && initctl start hyperiond
|
||||
install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
|
||||
start_msg="--> initctl start hyperiond"
|
||||
initctl start hyperiond
|
||||
|
||||
else
|
||||
echo "- init deamon: sysV"
|
||||
echo "--> init deamon: sysV"
|
||||
# sysV
|
||||
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null
|
||||
install_file /usr/share/hyperion/service/hyperion.init.sh /etc/init.d/hyperiond || SERVICE_POSTFIX=".new"
|
||||
chmod +x /etc/init.d/hyperiond
|
||||
update-rc.d hyperiond defaults 98 02
|
||||
start_msg="service hyperion start"
|
||||
$HYPERION_RUNNING && service hyperiond start
|
||||
install_file /usr/share/hyperion/service/hyperion.init /etc/init.d/hyperiond && chmod +x /etc/init.d/hyperiond && update-rc.d hyperiond defaults 98 02
|
||||
start_msg="--> service hyperiond start"
|
||||
service hyperiond start
|
||||
fi
|
||||
|
||||
#cleanup
|
||||
rm -r /usr/share/hyperion/service
|
||||
|
||||
#link binarys and set exec bit
|
||||
BINSP=/usr/share/hyperion/bin
|
||||
BINTP=/usr/bin
|
||||
chmod +x -R $BINSP
|
||||
ln -fs $BINSP/hyperiond $BINTP/hyperiond
|
||||
ln -fs $BINSP/hyperion-remote $BINTP/hyperion-remote
|
||||
ln -fs $BINSP/hyperion-v4l2 $BINTP/hyperion-v4l2
|
||||
ln -fs $BINSP/hyperion-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
|
||||
ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null
|
||||
ln -fs $BINSP/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null
|
||||
ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
|
||||
|
||||
|
||||
#Check, if dtparam=spi=on is in place
|
||||
if [ $CPU_RPI -eq 1 ]; then
|
||||
BOOT_DIR="/boot"
|
||||
if [ $BOOT_BERRYBOOT -eq 1 ]; then
|
||||
BOOT_DIR=$(sed -ne "s#/dev/mmcblk0p1 \([^ ]*\) vfat rw,.*#\1#p" /etc/mtab)
|
||||
fi
|
||||
if [ -z "$BOOT_DIR" -o ! -f "$BOOT_DIR/config.txt" ]; then
|
||||
echo '---> Warning: RPi using BERRYBOOT found but can not locate where config.txt is to enable SPI. (BOOT_DIR='"$BOOT_DIR)"
|
||||
SPIOK=1 # Not sure if OK, but don't ask to reboot
|
||||
else
|
||||
SPIOK=`grep '^\dtparam=spi=on' "$BOOT_DIR/config.txt" | wc -l`
|
||||
if [ $SPIOK -ne 1 ]; then
|
||||
echo '---> Raspberry Pi found, but SPI is not set, we write "dtparam=spi=on" to '"$BOOT_DIR/config.txt"
|
||||
sed -i '$a dtparam=spi=on' "$BOOT_DIR/config.txt"
|
||||
REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to $BOOT_DIR/config.txt"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo "- hyperion is installed, please check your configuration in /etc/hyperion/ -"
|
||||
echo "--> Hyperion has been installed/updated!"
|
||||
echo "--> For configuration, visit with your browser: ${address}"
|
||||
$REBOOTMESSAGE
|
||||
echo "-----------------------------------------------------------------------------"
|
||||
echo "Webpage: www.hyperion-project.org"
|
||||
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
|
||||
|
51
cmake/debian/preinst
Normal file
51
cmake/debian/preinst
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/bin/sh
|
||||
|
||||
# check which init script we should use
|
||||
USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm`
|
||||
USE_INITCTL=`which /sbin/initctl | wc -l`
|
||||
USE_SERVICE=`which /usr/sbin/service | wc -l`
|
||||
|
||||
#check for hyperion install
|
||||
if [ -d /usr/share/hyperion/bin ];then
|
||||
if [ -e /etc/hyperion/hyperion.config.json ];then
|
||||
file=`grep -m1 -c '"general"' /etc/hyperion/hyperion.config.json`
|
||||
if [ $file -ne 1 ]; then
|
||||
echo "--> It seems you are running an old version of Hyperion (1.X). Will create a backup at /usr/share/hyperion/Backup_Hyperion_1.0 and reset configuration / system service"
|
||||
|
||||
# Stop hyperion daemon if it is running
|
||||
echo '---> Stop Hyperion, if necessary'
|
||||
if [ $USE_SYSTEMD -eq 1 ]; then
|
||||
service hyperion stop 2>/dev/null
|
||||
elif [ $USE_INITCTL -eq 1 ]; then
|
||||
/sbin/initctl stop hyperion 2>/dev/null
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
/usr/sbin/service hyperion stop 2>/dev/null
|
||||
fi
|
||||
|
||||
#Backup
|
||||
echo "--> Move old config(s) and files to /usr/share/hyperion/Backup_Hyperion_1.0"
|
||||
mkdir /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
mv /usr/share/hyperion /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
mv /etc/hyperion/* /usr/share/hyperion/Backup_Hyperion_1.0
|
||||
|
||||
#Disabling and delete service files
|
||||
if [ $USE_SYSTEMD -eq 1 ]; then
|
||||
# Delete and disable Hyperion systemd script
|
||||
echo '---> Delete and disable Hyperion systemd service'
|
||||
systemctl disable hyperion.service
|
||||
rm -v /etc/systemd/system/hyperion* 2>/dev/null
|
||||
elif [ $USE_INITCTL -eq 1 ]; then
|
||||
echo '---> Delete and disable Hyperion initctl script'
|
||||
rm -v /etc/init/hyperion* 2>/dev/null
|
||||
initctl reload-configuration
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
# Delete and disable Hyperion init.d script
|
||||
echo '---> Delete and disable Hyperion init.d script'
|
||||
update-rc.d -f hyperion remove
|
||||
rm /etc/init.d/hyperion* 2>/dev/null
|
||||
fi
|
||||
|
||||
echo "--> Hyperion 1.0 installation has been moved"
|
||||
fi
|
||||
fi
|
||||
fi
|
Reference in New Issue
Block a user