mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
cleanup scripts: packages/
This commit is contained in:
parent
99ae3fc3b1
commit
67dcda694b
@ -13,39 +13,39 @@ mixer() {
|
||||
}
|
||||
|
||||
(
|
||||
. /etc/profile
|
||||
. /etc/profile
|
||||
|
||||
progress "Setting up sound card"
|
||||
progress "Setting up sound card"
|
||||
|
||||
if [ -f $HOME/.config/sound.conf ]; then
|
||||
if [ -f $HOME/.config/sound.conf ]; then
|
||||
|
||||
alsactl restore -f $HOME/.config/sound.conf
|
||||
|
||||
else
|
||||
else
|
||||
|
||||
# get card num
|
||||
card=`echo $1 | sed 's/[^0-9]*//g'`
|
||||
# get card num
|
||||
card=$(echo $1 | sed 's/[^0-9]*//g')
|
||||
|
||||
# set common mixer params
|
||||
# set common mixer params
|
||||
mixer "$card" Master 0db
|
||||
mixer "$card" Front 100%
|
||||
mixer "$card" PCM 0db
|
||||
mixer "$card" Synth 100%
|
||||
|
||||
# mute CD, since using digital audio instead
|
||||
# mute CD, since using digital audio instead
|
||||
mixer "$card" CD 0% mute
|
||||
|
||||
# Only unmute Line and Aux if they are possibly used.
|
||||
# mixer "$card" Line 100%
|
||||
# mixer "$card" Aux 100%
|
||||
# Only unmute Line and Aux if they are possibly used.
|
||||
# mixer "$card" Line 100%
|
||||
# mixer "$card" Aux 100%
|
||||
|
||||
# mute mic
|
||||
# mute mic
|
||||
mixer "$card" Mic 0% mute
|
||||
|
||||
# ESS 1969 chipset has 2 PCM channels
|
||||
# ESS 1969 chipset has 2 PCM channels
|
||||
mixer "$card" PCM,1 100%
|
||||
|
||||
# Trident/YMFPCI/emu10k1
|
||||
# Trident/YMFPCI/emu10k1
|
||||
mixer "$card" Wave 100%
|
||||
mixer "$card" Music 100%
|
||||
mixer "$card" AC97 100%
|
||||
@ -55,18 +55,18 @@ else
|
||||
mixer "$card" 'Duplicate Front' 90%
|
||||
mixer "$card" 'Sigmatel 4-Speaker Stereo' 90%
|
||||
|
||||
# CS4237B chipset:
|
||||
# CS4237B chipset:
|
||||
mixer "$card" 'Master Digital' 100%
|
||||
|
||||
# DRC
|
||||
# DRC
|
||||
mixer "$card" 'Dynamic Range Compression' 90%
|
||||
|
||||
# Envy24 chips with analog outs
|
||||
# Envy24 chips with analog outs
|
||||
mixer "$card" DAC 100%
|
||||
mixer "$card" DAC,0 100%
|
||||
mixer "$card" DAC,1 100%
|
||||
|
||||
# some notebooks use headphone instead of master
|
||||
# some notebooks use headphone instead of master
|
||||
mixer "$card" Headphone 100%
|
||||
mixer "$card" Speaker 100%
|
||||
mixer "$card" 'Internal Speaker' 0% mute
|
||||
@ -77,10 +77,10 @@ else
|
||||
mixer "$card" LFE 100%
|
||||
mixer "$card" Center/LFE 100%
|
||||
|
||||
# Intel P4P800-MX (Ubuntu bug #5813)
|
||||
# Intel P4P800-MX (Ubuntu bug #5813)
|
||||
mixer "$card" 'Master Playback Switch' on
|
||||
|
||||
# set digital output mixer params
|
||||
# set digital output mixer params
|
||||
mixer "$card" 'IEC958' 100% on
|
||||
mixer "$card" 'IEC958 Output' 100%
|
||||
mixer "$card" 'IEC958 Coaxial' 100%
|
||||
@ -96,41 +96,41 @@ else
|
||||
mixer "$card" 'Analog Rear' 100%
|
||||
mixer "$card" 'Analog Center/LFE' 100%
|
||||
|
||||
# ASRock ION 330 (and perhaps others) has 2 IEC958 channels
|
||||
# ASRock ION 330 (and perhaps others) has 2 IEC958 channels
|
||||
mixer "$card" IEC958,0 on
|
||||
mixer "$card" IEC958,1 on
|
||||
|
||||
# some ION2 has much more IEC958 channels ...
|
||||
# some ION2 has much more IEC958 channels ...
|
||||
mixer "$card" IEC958,2 on
|
||||
mixer "$card" IEC958,3 on
|
||||
|
||||
# ASRock ION 330 has Master Front set to 0
|
||||
# ASRock ION 330 has Master Front set to 0
|
||||
mixer "$card" 'Master Front' 100%
|
||||
|
||||
# Shuttle XS35GT needs this too
|
||||
# Shuttle XS35GT needs this too
|
||||
mixer "$card" 'Master',0 100% on
|
||||
|
||||
# and this for various Fusion devices like Zotac ZBOX
|
||||
# and this for various Fusion devices like Zotac ZBOX
|
||||
mixer "$card" 'Front',0 100% on
|
||||
|
||||
# NVidia CK804 sound devices
|
||||
# NVidia CK804 sound devices
|
||||
mixer "$card" 'IEC958 Playback AC97-SPSA' 100%
|
||||
|
||||
# Allwinner H3 Analog
|
||||
# Allwinner H3 Analog
|
||||
mixer "$card" 'Line Out' 0db on
|
||||
|
||||
# Allwinner A20 Analog
|
||||
# Allwinner A20 Analog
|
||||
mixer "$card" 'Power Amplifier' 0db
|
||||
mixer "$card" 'Power Amplifier DAC' on
|
||||
mixer "$card" 'Power Amplifier Mute' on
|
||||
|
||||
# Allwinner A64 Analog
|
||||
# Allwinner A64 Analog
|
||||
mixer "$card" Headphone 0db on
|
||||
mixer "$card" 'AIF1 Slot 0 Digital DAC' on
|
||||
|
||||
# Amlogic audio devices
|
||||
# Amlogic audio devices
|
||||
case $(dtsoc) in
|
||||
amlogic,g12*|amlogic,sm1)
|
||||
amlogic,g12* | amlogic,sm1)
|
||||
# AXG HDMI // Logic assumes TDMOUT_A is not present in device-tree when TDMOUT_B is used
|
||||
TDMOUT=$(awk '/TDMOUT/ && $2=="OUT" {print substr($1,length($1),1)}' /sys/firmware/devicetree/base/sound/audio-routing | sort | head -n 1)
|
||||
if [ "${TDMOUT}" = "A" ]; then
|
||||
@ -174,10 +174,10 @@ else
|
||||
;;
|
||||
esac
|
||||
|
||||
# ES8316 headphone jack
|
||||
# ES8316 headphone jack
|
||||
mixer "$card" 'Right Headphone Mixer Right DAC' on
|
||||
mixer "$card" 'Left Headphone Mixer Left DAC' on
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
)&
|
||||
exit 0
|
||||
) &
|
||||
|
@ -4,10 +4,10 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
if [ -f $HOME/.config/sound.conf ] ; then
|
||||
if [ -f $HOME/.config/sound.conf ]; then
|
||||
alsactl restore -f $HOME/.config/sound.conf
|
||||
else
|
||||
if [ -r $HOME/.config/rpi-cirrus-config.sh ] ; then
|
||||
if [ -r $HOME/.config/rpi-cirrus-config.sh ]; then
|
||||
progress "Setting up Cirrus Logic Audio Card with user config"
|
||||
sh $HOME/.config/rpi-cirrus-config.sh
|
||||
else
|
||||
|
@ -23,26 +23,26 @@ if [ ! -f $KODI_ROOT/userdata/sources.xml ]; then
|
||||
fi
|
||||
|
||||
# common setup guisettings
|
||||
if [ ! -f $KODI_ROOT/userdata/guisettings.xml ] ; then
|
||||
if [ ! -f $KODI_ROOT/userdata/guisettings.xml ]; then
|
||||
if [ -f /usr/share/kodi/config/guisettings.xml ]; then
|
||||
cp /usr/share/kodi/config/guisettings.xml $KODI_ROOT/userdata
|
||||
fi
|
||||
if [ "$BOOT_STATE" = "SAFE" ]; then
|
||||
[ ! -f $KODI_ROOT/userdata/guisettings.xml ] && echo '<settings version="2"></settings>' > $KODI_ROOT/userdata/guisettings.xml
|
||||
[ ! -f $KODI_ROOT/userdata/guisettings.xml ] && echo '<settings version="2"></settings>' >$KODI_ROOT/userdata/guisettings.xml
|
||||
xmlstarlet ed --omit-decl --inplace -s settings -t elem -n setting -v "maroon" -i settings/setting -t attr -n id -v lookandfeel.skincolors $KODI_ROOT/userdata/guisettings.xml
|
||||
fi
|
||||
fi
|
||||
|
||||
KODI_ARGS=""
|
||||
|
||||
echo "KODI_ARGS=\"$KODI_ARGS\"" > /run/libreelec/kodi.conf
|
||||
echo "KODI_ARGS=\"$KODI_ARGS\"" >/run/libreelec/kodi.conf
|
||||
|
||||
if [ "$(uname -m)" = "x86_64" ]; then
|
||||
echo "MALLOC_MMAP_THRESHOLD_=524288" >> /run/libreelec/kodi.conf
|
||||
echo "MALLOC_MMAP_THRESHOLD_=524288" >>/run/libreelec/kodi.conf
|
||||
else #arm
|
||||
echo "MALLOC_MMAP_THRESHOLD_=8192" >> /run/libreelec/kodi.conf
|
||||
echo "MALLOC_MMAP_THRESHOLD_=8192" >>/run/libreelec/kodi.conf
|
||||
fi
|
||||
|
||||
if [ -f /storage/.config/kodi.conf ] ; then
|
||||
if [ -f /storage/.config/kodi.conf ]; then
|
||||
cat /storage/.config/kodi.conf >>/run/libreelec/kodi.conf
|
||||
fi
|
||||
|
@ -22,31 +22,31 @@ Quit Remote q or ctrl+c
|
||||
"
|
||||
|
||||
com() {
|
||||
kodi-send --action="$1" > /dev/null 2>&1
|
||||
echo -ne "\r$1\e[K";
|
||||
kodi-send --action="$1" >/dev/null 2>&1
|
||||
echo -ne "\r$1\e[K"
|
||||
}
|
||||
|
||||
while true; do
|
||||
read -r -sn1 k
|
||||
case "$k" in
|
||||
A) com "Up";;
|
||||
B) com "Down";;
|
||||
C) com "Right";;
|
||||
D) com "Left";;
|
||||
c) com "ContextMenu";;
|
||||
d) com "PlayerDebug";;
|
||||
f) com "FullScreen";;
|
||||
i) com "Info";;
|
||||
m) com "Mute";;
|
||||
o) com "CodecInfo";;
|
||||
p) com "Pause";;
|
||||
s) com "TakeScreenshot";;
|
||||
t) com "Skin.ToggleDebug";;
|
||||
x) com "Stop";;
|
||||
-) com "VolumeDown";;
|
||||
+) com "VolumeUp";;
|
||||
$'\177') com "Back";;
|
||||
"") com "Select";;
|
||||
q) exit
|
||||
A) com "Up" ;;
|
||||
B) com "Down" ;;
|
||||
C) com "Right" ;;
|
||||
D) com "Left" ;;
|
||||
c) com "ContextMenu" ;;
|
||||
d) com "PlayerDebug" ;;
|
||||
f) com "FullScreen" ;;
|
||||
i) com "Info" ;;
|
||||
m) com "Mute" ;;
|
||||
o) com "CodecInfo" ;;
|
||||
p) com "Pause" ;;
|
||||
s) com "TakeScreenshot" ;;
|
||||
t) com "Skin.ToggleDebug" ;;
|
||||
x) com "Stop" ;;
|
||||
-) com "VolumeDown" ;;
|
||||
+) com "VolumeUp" ;;
|
||||
$'\177') com "Back" ;;
|
||||
"") com "Select" ;;
|
||||
q) exit ;;
|
||||
esac
|
||||
done
|
||||
|
@ -8,8 +8,7 @@ KODI_ROOT=$HOME/.kodi
|
||||
KODI_ROOT_FAILED=$KODI_ROOT.FAILED
|
||||
BOOT_STATUS=$HOME/.config/boot.status
|
||||
|
||||
process_boot_status()
|
||||
{
|
||||
process_boot_status() {
|
||||
BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)"
|
||||
|
||||
if [ "${BOOT_STATE}" = "SAFE" ]; then
|
||||
@ -21,10 +20,10 @@ process_boot_status()
|
||||
# exiting safe mode - restore failed .kodi
|
||||
rm -fr $KODI_ROOT
|
||||
mv $KODI_ROOT_FAILED $KODI_ROOT
|
||||
echo "OK" > $BOOT_STATUS
|
||||
echo "OK" >$BOOT_STATUS
|
||||
fi
|
||||
else
|
||||
echo "OK" > $BOOT_STATUS
|
||||
echo "OK" >$BOOT_STATUS
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
@ -41,9 +41,15 @@ OUTPUT="/usr/bin/pastebinit"
|
||||
|
||||
while getopts ":hc" opt; do
|
||||
case ${opt} in
|
||||
c) OUTPUT="cat";;
|
||||
?) usage "${OPTARG}";;
|
||||
h) usage;;
|
||||
c)
|
||||
OUTPUT="cat"
|
||||
;;
|
||||
?)
|
||||
usage "${OPTARG}"
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
if [ $# -ne 3 ] ; then
|
||||
if [ $# -ne 3 ]; then
|
||||
echo "$0 usage: context addon-id addon-path"
|
||||
exit 1
|
||||
fi
|
||||
@ -12,13 +12,13 @@ CONTEXT="$1"
|
||||
ADDON_ID="$2"
|
||||
ADDON_PATH="$3"
|
||||
|
||||
if [ ! -d /storage/.config/system.d ] ; then
|
||||
if [ ! -d /storage/.config/system.d ]; then
|
||||
mkdir -p /storage/.config/system.d
|
||||
fi
|
||||
|
||||
SERVICE_FILE="${ADDON_PATH}/system.d/${ADDON_ID}.service"
|
||||
|
||||
if [ -f "${SERVICE_FILE}" ] ; then
|
||||
if [ -f "${SERVICE_FILE}" ]; then
|
||||
case "${CONTEXT}" in
|
||||
enable)
|
||||
systemctl enable "${SERVICE_FILE}"
|
||||
@ -51,7 +51,7 @@ if [ -f "${SERVICE_FILE}" ] ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ ! -d /storage/.cache/kernel-overlays ] ; then
|
||||
if [ ! -d /storage/.cache/kernel-overlays ]; then
|
||||
mkdir -p /storage/.cache/kernel-overlays
|
||||
fi
|
||||
|
||||
@ -70,21 +70,21 @@ esac
|
||||
|
||||
create_overlay_conf() {
|
||||
rm -f "${OVERLAY_CONF}"
|
||||
echo "${OVERLAY_PATH}" > "${OVERLAY_CONF}"
|
||||
echo "${OVERLAY_PATH}" >"${OVERLAY_CONF}"
|
||||
}
|
||||
|
||||
if [ -d "${OVERLAY_PATH}" ] ; then
|
||||
if [ -d "${OVERLAY_PATH}" ]; then
|
||||
OVERLAY_CONF="/storage/.cache/kernel-overlays/50-${ADDON_ID}.conf"
|
||||
|
||||
case "${CONTEXT}" in
|
||||
enable | post-install )
|
||||
enable | post-install)
|
||||
create_overlay_conf
|
||||
;;
|
||||
disable | pre-uninstall )
|
||||
disable | pre-uninstall)
|
||||
rm -f "${OVERLAY_CONF}"
|
||||
;;
|
||||
update )
|
||||
if [ -e "${OVERLAY_CONF}" ] ; then
|
||||
update)
|
||||
if [ -e "${OVERLAY_CONF}" ]; then
|
||||
create_overlay_conf
|
||||
fi
|
||||
;;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
if [ -f /sys/class/rtc/rtc0/wakealarm ]; then
|
||||
logger -t setwakeup.sh "### Setting system wakeup time ###"
|
||||
echo 0 > /sys/class/rtc/rtc0/wakealarm
|
||||
echo $1 > /sys/class/rtc/rtc0/wakealarm
|
||||
echo 0 >/sys/class/rtc/rtc0/wakealarm
|
||||
echo $1 >/sys/class/rtc/rtc0/wakealarm
|
||||
logger -t setwakeup.sh "### $(cat /proc/driver/rtc) ###"
|
||||
fi
|
||||
|
@ -5,17 +5,15 @@
|
||||
|
||||
. /etc/profile
|
||||
|
||||
run_scripts()
|
||||
{
|
||||
run_scripts() {
|
||||
list_scripts $1
|
||||
for script in $SCRIPTS ; do
|
||||
for script in $SCRIPTS; do
|
||||
progress "running sleep script $script ($1)..."
|
||||
sh /usr/lib/systemd/system-sleep.serial/$script $1
|
||||
done
|
||||
}
|
||||
|
||||
list_scripts()
|
||||
{
|
||||
list_scripts() {
|
||||
case $1 in
|
||||
pre)
|
||||
SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort)
|
||||
|
@ -4,22 +4,22 @@
|
||||
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
|
||||
|
||||
# creating initial settings file
|
||||
if [ ! -f /storage/.cache/connman/settings ]; then
|
||||
if [ ! -f /storage/.cache/connman/settings ]; then
|
||||
mkdir -p /storage/.cache/connman
|
||||
cp /usr/share/connman/settings /storage/.cache/connman
|
||||
fi
|
||||
fi
|
||||
|
||||
# set variable for connman main.conf location
|
||||
if [ -f /storage/.config/connman_main.conf ]; then
|
||||
if [ -f /storage/.config/connman_main.conf ]; then
|
||||
export CONNMAN_MAIN="--config=/storage/.config/connman_main.conf"
|
||||
else
|
||||
else
|
||||
export CONNMAN_MAIN="--config=/etc/connman/main.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
# switch resolv.conf management to connman and use current contents
|
||||
# as a fallback
|
||||
if [ -f /run/libreelec/resolv.conf ]; then
|
||||
cat /run/libreelec/resolv.conf > /run/connman/resolv.conf
|
||||
cat /run/libreelec/resolv.conf >/run/connman/resolv.conf
|
||||
fi
|
||||
rm -f /run/libreelec/resolv.conf
|
||||
ln -s /run/connman/resolv.conf /run/libreelec/resolv.conf
|
||||
|
@ -6,7 +6,7 @@
|
||||
if [ -f /storage/.cache/services/samba.conf ]; then
|
||||
. /storage/.cache/services/samba.conf
|
||||
|
||||
if [ "$SAMBA_AUTOSHARE" == "true" ] ; then
|
||||
if [ "$SAMBA_AUTOSHARE" == "true" ]; then
|
||||
/usr/lib/samba/samba-config
|
||||
[ -f /run/samba/smbd.pid ] && pkill -HUP smbd
|
||||
fi
|
||||
|
@ -9,21 +9,21 @@ if [ -x /usr/bin/wg ]; then
|
||||
mkdir -p /storage/.cache/wireguard
|
||||
|
||||
if [ ! -f /storage/.cache/wireguard/privatekey ]; then
|
||||
wg genkey > /storage/.cache/wireguard/privatekey
|
||||
wg genkey >/storage/.cache/wireguard/privatekey
|
||||
echo "created /storage/.cache/wireguard/privatekey"
|
||||
else
|
||||
echo "error, /storage/.cache/wireguard/privatekey already exists"
|
||||
fi
|
||||
|
||||
if [ ! -f /storage/.cache/wireguard/publickey ]; then
|
||||
wg pubkey < /storage/.cache/wireguard/privatekey > /storage/.cache/wireguard/publickey
|
||||
wg pubkey </storage/.cache/wireguard/privatekey >/storage/.cache/wireguard/publickey
|
||||
echo "created /storage/.cache/wireguard/publickey"
|
||||
else
|
||||
echo "error, /storage/.cache/wireguard/publickey already exists"
|
||||
fi
|
||||
|
||||
if [ ! -f /storage/.cache/wireguard/preshared ]; then
|
||||
wg genpsk > /storage/.cache/wireguard/preshared
|
||||
wg genpsk >/storage/.cache/wireguard/preshared
|
||||
echo "created /storage/.cache/wireguard/preshared"
|
||||
else
|
||||
echo "error, /storage/.cache/wireguard/preshared already exists"
|
||||
|
@ -25,7 +25,7 @@ mkdir -p "${TMPDIR}/usr/lib/firmware"
|
||||
cp -r "${EDID_DIR}" "${TMPDIR}/usr/lib/firmware"
|
||||
cd "${TMPDIR}"
|
||||
mount -o remount,rw /flash
|
||||
find usr -print | cpio -ov -H newc > "${EDID_CPIO}"
|
||||
find usr -print | cpio -ov -H newc >"${EDID_CPIO}"
|
||||
sync
|
||||
mount -o remount,ro /flash
|
||||
cd /storage
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
COMPATIBLE=$(cat /proc/device-tree/compatible 2>/dev/null | tr -d '\000' | sed -n -e 's/.*\(allwinner\|amlogic\|fsl\|nxp\|qcom\|raspberrypi\|rockchip\|samsung\).*/\1/p')
|
||||
|
||||
do_dtfile(){
|
||||
do_dtfile() {
|
||||
if [[ -n $(find /flash -name extlinux.conf) ]]; then
|
||||
EXTLINUX=$(find /flash -name extlinux.conf)
|
||||
DTFILE=$(grep FDT "${EXTLINUX}" | sed 's,^ *FDT /,,g')
|
||||
@ -19,7 +19,7 @@ do_dtfile(){
|
||||
echo "${DTFILE}"
|
||||
}
|
||||
|
||||
do_dtflag(){
|
||||
do_dtflag() {
|
||||
if [ "${COMPATIBLE}" = "raspberrypi" ]; then
|
||||
DTFLAG=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
|
||||
PIREV=$(awk '/^Revision/ {sub($3,-6, "", $3); print $3}' /proc/cpuinfo) # truncate to 6-chars
|
||||
@ -36,10 +36,10 @@ do_dtflag(){
|
||||
a*)
|
||||
MEMSIZE="-1g"
|
||||
;;
|
||||
*0002|*0003|*0004|*0005|*0006|*0007|*0008|*0009|*0012)
|
||||
*0002 | *0003 | *0004 | *0005 | *0006 | *0007 | *0008 | *0009 | *0012)
|
||||
MEMSIZE="-256"
|
||||
;;
|
||||
0*|9*)
|
||||
0* | 9*)
|
||||
MEMSIZE="-512"
|
||||
;;
|
||||
*)
|
||||
@ -58,17 +58,17 @@ do_dtflag(){
|
||||
echo "${DTFLAG}${MEMSIZE}"
|
||||
}
|
||||
|
||||
do_dtname(){
|
||||
do_dtname() {
|
||||
DTNAME=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | head -n 1)
|
||||
echo "${DTNAME}"
|
||||
}
|
||||
|
||||
do_dtsoc(){
|
||||
do_dtsoc() {
|
||||
DTSOC=$(cat /proc/device-tree/compatible | cut -f1,2 -d',' | tail -n 1)
|
||||
echo "${DTSOC}"
|
||||
}
|
||||
|
||||
do_unknown(){
|
||||
do_unknown() {
|
||||
echo "unknown"
|
||||
exit 1
|
||||
}
|
||||
|
@ -18,14 +18,14 @@ info() {
|
||||
|
||||
mkdir -p "${EDID_DIR}"
|
||||
|
||||
for c in /sys/class/drm/card?-* ; do
|
||||
for c in /sys/class/drm/card?-*; do
|
||||
[ ! -d "$c" ] && continue
|
||||
[ ! -e "$c/status" ] && continue
|
||||
|
||||
if [ $(cat $c/status 2>/dev/null) = "connected" ]; then
|
||||
CONNECTOR=$(basename $c | cut -c 7-)
|
||||
EDID_NAME="edid-${CONNECTOR}.bin"
|
||||
cat $c/edid > "${EDID_DIR}/${EDID_NAME}" 2>/dev/null
|
||||
cat $c/edid >"${EDID_DIR}/${EDID_NAME}" 2>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
[ -n "${CONNECTORS}" ] && CONNECTORS="${CONNECTORS} "
|
||||
CONNECTORS="${CONNECTORS}${CONNECTOR}"
|
||||
|
@ -26,10 +26,9 @@ help() {
|
||||
echo "And then use: getedid create"
|
||||
}
|
||||
|
||||
|
||||
# check for GPU and store string
|
||||
check_gpu() {
|
||||
if lspci | grep -i vga | grep -i -q -E 'intel|amd' ; then
|
||||
if lspci | grep -i vga | grep -i -q -E 'intel|amd'; then
|
||||
gpu="intel/amd"
|
||||
elif lspci | grep -i vga | grep -i -q nvidia; then
|
||||
gpu="nvidia"
|
||||
@ -39,7 +38,6 @@ check_gpu() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# run this first if the user already has a custom EDID but want to create a new one (TV or AVR change)
|
||||
del_edid() {
|
||||
if [ "$gpu" = "intel/amd" ]; then
|
||||
@ -63,7 +61,6 @@ del_edid() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# run main script depending on the GPU
|
||||
run() {
|
||||
if [ "$gpu" = "intel/amd" ]; then
|
||||
@ -73,19 +70,16 @@ run() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# mounting /flash to rw
|
||||
mount_rw() {
|
||||
mount -o remount,rw /flash
|
||||
}
|
||||
|
||||
|
||||
# mounting /flash to ro
|
||||
mount_ro() {
|
||||
mount -o remount,ro /flash
|
||||
}
|
||||
|
||||
|
||||
# remount /flash to ro and reboot
|
||||
sys_reboot() {
|
||||
mount_ro
|
||||
@ -94,11 +88,10 @@ sys_reboot() {
|
||||
reboot
|
||||
}
|
||||
|
||||
|
||||
# check syslinux.cfg and/or extlinux.conf
|
||||
check_file() {
|
||||
# check boot system
|
||||
if [ -d /sys/firmware/efi -a -f /flash/EFI/BOOT/syslinux.cfg ] ; then
|
||||
if [ -d /sys/firmware/efi -a -f /flash/EFI/BOOT/syslinux.cfg ]; then
|
||||
sys_boot="UEFI"
|
||||
sys_path="/flash/EFI/BOOT"
|
||||
else
|
||||
@ -122,30 +115,26 @@ check_file() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
check_content() {
|
||||
# check if changes are already made to $file and exit if yes
|
||||
if grep -q "initrd=/edid.cpio" $file ; then
|
||||
if grep -q "initrd=/edid.cpio" $file; then
|
||||
echo "$file has been modified. Please run 'getedid delete' first if you want to modify it again. Exiting."
|
||||
exit 5
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
create_edid() {
|
||||
# create edid
|
||||
mkdir -p /tmp/cpio/lib/firmware/edid
|
||||
cat "/sys/class/drm/$card/edid" > /tmp/cpio/lib/firmware/edid/edid.bin
|
||||
cat "/sys/class/drm/$card/edid" >/tmp/cpio/lib/firmware/edid/edid.bin
|
||||
mkdir -p /storage/.config/firmware/edid
|
||||
cp /tmp/cpio/lib/firmware/edid/edid.bin /storage/.config/firmware/edid
|
||||
|
||||
|
||||
# create cpio archive
|
||||
cd /tmp/cpio/
|
||||
find . -print | cpio -ov -H newc > /storage/edid.cpio
|
||||
find . -print | cpio -ov -H newc >/storage/edid.cpio
|
||||
}
|
||||
|
||||
|
||||
intel_amd() {
|
||||
# check which output is connnected:
|
||||
counter=0
|
||||
@ -183,7 +172,6 @@ intel_amd() {
|
||||
sys_reboot
|
||||
}
|
||||
|
||||
|
||||
nvidia() {
|
||||
# check if xorg.conf already exists
|
||||
if [ -f /storage/.config/xorg.conf -o -f /storage/.config/xorg-nvidia.conf ]; then
|
||||
@ -191,7 +179,6 @@ nvidia() {
|
||||
exit 6
|
||||
fi
|
||||
|
||||
|
||||
# check for multi-montior setup
|
||||
monitors="$(grep -i -w "connected" /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u | wc -l)"
|
||||
if [ "$monitors" -gt "1" ]; then
|
||||
@ -199,13 +186,11 @@ nvidia() {
|
||||
exit 7
|
||||
fi
|
||||
|
||||
|
||||
# set debug and restart Xorg
|
||||
cp /etc/X11/xorg-nvidia.conf /storage/.config/xorg.conf
|
||||
sed -i 's/"ModeDebug" "false"/"ModeDebug" "true"/g' /storage/.config/xorg.conf
|
||||
systemctl restart xorg.service
|
||||
|
||||
|
||||
# get port
|
||||
nv_port="$(grep -i -w connected /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u)"
|
||||
nvidia-xconfig --extract-edids-from-file=/var/log/Xorg.0.log --extract-edids-output-file=/storage/.config/edid.bin 1>/dev/null
|
||||
@ -223,7 +208,6 @@ nvidia() {
|
||||
systemctl restart xorg.service
|
||||
}
|
||||
|
||||
|
||||
# start script from here
|
||||
case "$1" in
|
||||
'create')
|
||||
|
@ -15,7 +15,7 @@ mkdir -p "${MODULES_DIR}"
|
||||
mkdir -p "${FIRMWARE_DIR}"
|
||||
|
||||
log() {
|
||||
echo "kernel-overlays-setup: $@" > /dev/kmsg
|
||||
echo "kernel-overlays-setup: $@" >/dev/kmsg
|
||||
}
|
||||
|
||||
apply_overlay() {
|
||||
@ -30,18 +30,18 @@ apply_overlay() {
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -d "${modules_overlay_dir}" ] ; then
|
||||
if [ -d "${modules_overlay_dir}" ]; then
|
||||
GOT_MODULE_OVERLAY="yes"
|
||||
|
||||
if cp -rfs "${modules_overlay_dir}"/* "${MODULES_DIR}" ; then
|
||||
if cp -rfs "${modules_overlay_dir}"/* "${MODULES_DIR}"; then
|
||||
log "added modules from $modules_overlay_dir"
|
||||
else
|
||||
log "failed to add modules from $modules_overlay_dir"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "${firmware_overlay_dir}" ] ; then
|
||||
if cp -rfs "${firmware_overlay_dir}"/* "${FIRMWARE_DIR}" ; then
|
||||
if [ -d "${firmware_overlay_dir}" ]; then
|
||||
if cp -rfs "${firmware_overlay_dir}"/* "${FIRMWARE_DIR}"; then
|
||||
log "added firmware from $firmware_overlay_dir"
|
||||
else
|
||||
log "failed to add firmware from $firmware_overlay_dir"
|
||||
@ -56,26 +56,26 @@ apply_overlay base
|
||||
|
||||
# apply user-configured module overlays
|
||||
|
||||
if [ -d "${OVERLAY_CONFIG_DIR}" ] ; then
|
||||
if [ -d "${OVERLAY_CONFIG_DIR}" ]; then
|
||||
log "adding overlays from ${OVERLAY_CONFIG_DIR}"
|
||||
GOT_MODULE_OVERLAY="no"
|
||||
|
||||
for conf in "${OVERLAY_CONFIG_DIR}/"*.conf ; do
|
||||
if [ -e "$conf" ] ; then
|
||||
for conf in "${OVERLAY_CONFIG_DIR}/"*.conf; do
|
||||
if [ -e "$conf" ]; then
|
||||
log "processing conf $conf"
|
||||
overlay=$(cat "$conf")
|
||||
[ -n "$overlay" ] && apply_overlay "$overlay"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "yes" = "$GOT_MODULE_OVERLAY" ] ; then
|
||||
if [ "yes" = "$GOT_MODULE_OVERLAY" ]; then
|
||||
log "running depmod"
|
||||
/usr/sbin/depmod -a >/dev/kmsg 2>&1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "${USER_FIRMWARE_DIR}" ] && [ -n "$(ls ${USER_FIRMWARE_DIR})" ] ; then
|
||||
if cp -rfs "${USER_FIRMWARE_DIR}"/* "${FIRMWARE_DIR}" ; then
|
||||
if [ -d "${USER_FIRMWARE_DIR}" ] && [ -n "$(ls ${USER_FIRMWARE_DIR})" ]; then
|
||||
if cp -rfs "${USER_FIRMWARE_DIR}"/* "${FIRMWARE_DIR}"; then
|
||||
log "added firmware from ${USER_FIRMWARE_DIR}"
|
||||
else
|
||||
log "failed to add firmware from ${USER_FIRMWARE_DIR}"
|
||||
|
@ -9,7 +9,7 @@ case $(dtsoc) in
|
||||
for triggerfile in $(find /sys/devices/platform/leds -name trigger); do
|
||||
trigger=$(awk -F'[][]' '{print $2}' "$triggerfile")
|
||||
if [ "$trigger" = "heartbeat" ]; then
|
||||
echo "none" > "$triggerfile"
|
||||
echo "none" >"$triggerfile"
|
||||
fi
|
||||
done
|
||||
;;
|
||||
|
@ -7,7 +7,7 @@
|
||||
EARLY_DIR="$2"
|
||||
|
||||
log() {
|
||||
echo "libreelec-target-generator: $@" > /dev/kmsg
|
||||
echo "libreelec-target-generator: $@" >/dev/kmsg
|
||||
}
|
||||
|
||||
if [ -z "$EARLY_DIR" ]; then
|
||||
|
@ -3,13 +3,13 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
do_install(){
|
||||
do_install() {
|
||||
# create the persistent firmware dir
|
||||
mkdir -p "/storage/.config/firmware/edid"
|
||||
|
||||
# capture the raw edid file
|
||||
if [ ! -e /storage/.config/firmware/edid/edid.bin ]; then
|
||||
cat "/sys/class/drm/card0-HDMI-A-1/edid" > "/storage/.config/firmware/edid/edid.bin"
|
||||
cat "/sys/class/drm/card0-HDMI-A-1/edid" >"/storage/.config/firmware/edid/edid.bin"
|
||||
else
|
||||
echo "info: using existing edid.bin"
|
||||
fi
|
||||
@ -18,7 +18,7 @@ do_install(){
|
||||
mkdir -p "/storage/cpio/lib/firmware/edid"
|
||||
cp "/storage/.config/firmware/edid/edid.bin" "/storage/cpio/lib/firmware/edid/"
|
||||
cd "/storage/cpio"
|
||||
find . -print | cpio -ov -H newc > "/storage/.config/firmware/edid/edid.cpio"
|
||||
find . -print | cpio -ov -H newc >"/storage/.config/firmware/edid/edid.cpio"
|
||||
|
||||
# mount /flash rw
|
||||
mount -o remount,rw /flash
|
||||
@ -32,7 +32,7 @@ do_install(){
|
||||
# determine boot method and set params
|
||||
if [ -f "/flash/extlinux/extlinux.conf" ]; then
|
||||
FILE="/flash/extlinux/extlinux.conf"
|
||||
if grep -q "initrd=/edid.cpio" "${FILE}" ; then
|
||||
if grep -q "initrd=/edid.cpio" "${FILE}"; then
|
||||
echo "error: ${FILE} already contains edid.cpio, aborting!"
|
||||
exit 1
|
||||
else
|
||||
@ -43,7 +43,7 @@ do_install(){
|
||||
fi
|
||||
else
|
||||
FILE="/flash/uEnv.ini"
|
||||
if grep -q "initrd=/edid.cpio" "${FILE}" ; then
|
||||
if grep -q "initrd=/edid.cpio" "${FILE}"; then
|
||||
echo "error: ${FILE} already contains edid.cpio info .. aborting!"
|
||||
exit 1
|
||||
else
|
||||
@ -55,7 +55,7 @@ do_install(){
|
||||
fi
|
||||
}
|
||||
|
||||
do_cleanup(){
|
||||
do_cleanup() {
|
||||
rm "/storage/.config/firmware/edid/edid.bin"
|
||||
rm "/storage/.config/firmware/edid/edid.cpio"
|
||||
mount -o remount,rw /flash
|
||||
@ -69,7 +69,7 @@ do_cleanup(){
|
||||
mount -o remount,ro /flash
|
||||
}
|
||||
|
||||
do_usage(){
|
||||
do_usage() {
|
||||
echo "usage: getedid {create|delete}"
|
||||
exit 0
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ get_cleaned_cmdline_txt() {
|
||||
add_initramfs() {
|
||||
# make sure config.txt ends with a newline
|
||||
if [ "$(tail -c 1 ${CONFIG_TXT} | tr -c -d '\n' | tr '\n' 'X')" != "X" ]; then
|
||||
echo "" >> ${CONFIG_TXT}
|
||||
echo "" >>${CONFIG_TXT}
|
||||
fi
|
||||
echo "initramfs edid.cpio" >> ${CONFIG_TXT}
|
||||
echo "initramfs edid.cpio" >>${CONFIG_TXT}
|
||||
}
|
||||
|
||||
add_cmdline() {
|
||||
@ -57,7 +57,7 @@ add_cmdline() {
|
||||
[ -n "${FIRMWARE}" ] && FIRMWARE="${FIRMWARE},"
|
||||
FIRMWARE="${FIRMWARE}${conn}:edid/edid-${conn}.bin"
|
||||
done
|
||||
echo "${CMDLINE} drm.edid_firmware=${FIRMWARE}${VIDEO}" > ${CMDLINE_TXT}
|
||||
echo "${CMDLINE} drm.edid_firmware=${FIRMWARE}${VIDEO}" >${CMDLINE_TXT}
|
||||
}
|
||||
|
||||
set_edids() {
|
||||
@ -73,7 +73,7 @@ delete_edids() {
|
||||
mount -o remount,rw /flash
|
||||
cleanup_config_txt
|
||||
CMDLINE=$(get_cleaned_cmdline_txt)
|
||||
echo "${CMDLINE}" > ${CMDLINE_TXT}
|
||||
echo "${CMDLINE}" >${CMDLINE_TXT}
|
||||
mount -o remount,ro /flash
|
||||
}
|
||||
|
||||
|
@ -3,31 +3,30 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
do_start(){
|
||||
while sleep 1
|
||||
do
|
||||
printf "%4s" "$(date +'%l %M' | tr -d '[:space:]')" > "$LED_PATH_TEXT"
|
||||
do_start() {
|
||||
while sleep 1; do
|
||||
printf "%4s" "$(date +'%l %M' | tr -d '[:space:]')" >"$LED_PATH_TEXT"
|
||||
if [ "$LED_COLON" = "off" ]; then
|
||||
echo "1" > "$LED_PATH_COLON"
|
||||
echo "1" >"$LED_PATH_COLON"
|
||||
LED_COLON="on"
|
||||
else
|
||||
echo "0" > "$LED_PATH_COLON"
|
||||
echo "0" >"$LED_PATH_COLON"
|
||||
LED_COLON="off"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
do_stop(){
|
||||
echo "0" > "$LED_PATH_COLON"
|
||||
echo " " > "$LED_PATH_TEXT"
|
||||
do_stop() {
|
||||
echo "0" >"$LED_PATH_COLON"
|
||||
echo " " >"$LED_PATH_TEXT"
|
||||
}
|
||||
|
||||
case $(dtname) in
|
||||
oranth,tx3-mini|oranth,tx9-pro|sunvell,t95z-plus)
|
||||
oranth,tx3-mini | oranth,tx9-pro | sunvell,t95z-plus)
|
||||
LED_PATH_COLON="/sys/devices/platform/spi/spi_master/spi0/spi0.0/leds/:colon/brightness"
|
||||
LED_PATH_TEXT="/sys/devices/platform/spi/spi_master/spi0/spi0.0/display_text"
|
||||
;;
|
||||
default|*)
|
||||
default | *)
|
||||
# noop
|
||||
;;
|
||||
esac
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2017 Matthias Reichl (hias@horus.com)
|
||||
|
||||
if [ -e "/storage/.config/lirc_options.conf" ] ; then
|
||||
if [ -e "/storage/.config/lirc_options.conf" ]; then
|
||||
LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf"
|
||||
fi
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2017 Matthias Reichl (hias@horus.com)
|
||||
|
||||
if [ -e "/storage/.config/lirc_options.conf" ] ; then
|
||||
if [ -e "/storage/.config/lirc_options.conf" ]; then
|
||||
LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf"
|
||||
fi
|
||||
|
||||
|
@ -4,14 +4,14 @@
|
||||
# Copyright (C) 2009-2015 Stephan Raue (stephan@openelec.tv)
|
||||
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
SYS_CPUFREQ_GOV=$( cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor )
|
||||
SYS_CPUFREQ_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
|
||||
SYS_CPUFREQ_DIR="/sys/devices/system/cpu/cpufreq"
|
||||
|
||||
# Configure frequency scaling properties
|
||||
if [ $SYS_CPUFREQ_GOV = "ondemand" ]; then
|
||||
for policy in ${SYS_CPUFREQ_DIR}/ondemand ${SYS_CPUFREQ_DIR}/policy*/; do
|
||||
if [ -e $policy/up_threshold ]; then
|
||||
echo 50 > $policy/up_threshold
|
||||
echo 50 >$policy/up_threshold
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# read config files
|
||||
for config in /etc/profile.d/*; do
|
||||
if [ -f "$config" ] ; then
|
||||
if [ -f "$config" ]; then
|
||||
. $config
|
||||
fi
|
||||
done
|
||||
|
@ -6,42 +6,40 @@ check_hosts() {
|
||||
grep -v "^#" /run/libreelec/hosts | grep "${1}"
|
||||
}
|
||||
|
||||
|
||||
# setup hostname
|
||||
if [ -f /storage/.cache/hostname ]; then
|
||||
cat /storage/.cache/hostname > /proc/sys/kernel/hostname
|
||||
cat /storage/.cache/hostname >/proc/sys/kernel/hostname
|
||||
fi
|
||||
|
||||
# setup /etc/hosts
|
||||
rm -f /run/libreelec/hosts
|
||||
if [ -f /storage/.config/hosts.conf ]; then
|
||||
cat /storage/.config/hosts.conf > /run/libreelec/hosts
|
||||
cat /storage/.config/hosts.conf >/run/libreelec/hosts
|
||||
# add localhost to hosts if not present
|
||||
LOCALHOST_HOSTS=$(check_hosts "localhost")
|
||||
if [ -z "${LOCALHOST_HOSTS}" ]; then
|
||||
{
|
||||
echo "127.0.0.1 localhost"
|
||||
echo "::1 localhost ip6-localhost ip6-loopback"
|
||||
} >> /run/libreelec/hosts
|
||||
} >>/run/libreelec/hosts
|
||||
fi
|
||||
# add HOSTNAME to hosts if not present
|
||||
HOSTNAME=$(cat /proc/sys/kernel/hostname)
|
||||
HOSTNAME_HOSTS=$(check_hosts "${HOSTNAME}")
|
||||
if [ -z "${HOSTNAME_HOSTS}" ]; then
|
||||
echo "127.0.1.1 ${HOSTNAME}" >> /run/libreelec/hosts
|
||||
echo "127.0.1.1 ${HOSTNAME}" >>/run/libreelec/hosts
|
||||
fi
|
||||
fi
|
||||
|
||||
# setup /etc/resolv.conf
|
||||
rm -f /run/libreelec/resolv.conf
|
||||
if [ -f /storage/.config/resolv.conf ]; then
|
||||
cat /storage/.config/resolv.conf > /run/libreelec/resolv.conf
|
||||
cat /storage/.config/resolv.conf >/run/libreelec/resolv.conf
|
||||
elif [ -f /dev/.kernel_ipconfig ] && [ -f /proc/net/pnp ]; then
|
||||
cat /proc/net/pnp > /run/libreelec/resolv.conf
|
||||
cat /proc/net/pnp >/run/libreelec/resolv.conf
|
||||
else
|
||||
cat << EOF > /run/libreelec/resolv.conf
|
||||
cat <<EOF >/run/libreelec/resolv.conf
|
||||
nameserver 8.8.8.8
|
||||
nameserver 8.8.4.4
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
@ -17,4 +17,4 @@ umount /storage/.cache/systemd-machine-id >/dev/null 2>&1
|
||||
|
||||
# persist uuid
|
||||
mkdir -p /storage/.cache
|
||||
echo "$MACHINEID" > /storage/.cache/systemd-machine-id
|
||||
echo "$MACHINEID" >/storage/.cache/systemd-machine-id
|
||||
|
@ -13,10 +13,9 @@ if [ -f /proc/net/ipconfig/ntp_servers ]; then
|
||||
done
|
||||
if [ -n "$NTP_SERVERS" ]; then
|
||||
mkdir -p /run/systemd/timesyncd.conf.d/
|
||||
cat << EOF > /run/systemd/timesyncd.conf.d/kernel-ntp-servers.conf
|
||||
cat <<EOF >/run/systemd/timesyncd.conf.d/kernel-ntp-servers.conf
|
||||
[Time]
|
||||
NTP=$NTP_SERVERS
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -11,12 +11,12 @@ if [ -f /storage/.config/swap.conf ]; then
|
||||
. /storage/.config/swap.conf
|
||||
fi
|
||||
|
||||
if [ -e /dev/.storage_netboot ] ; then
|
||||
if [ -e /dev/.storage_netboot ]; then
|
||||
logger -t Boot "### netbooting... swap disabled ###"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! "${SWAP_ENABLED}" = "yes" ] ; then
|
||||
if [ ! "${SWAP_ENABLED}" = "yes" ]; then
|
||||
logger -t Boot "### swap disabled via configfile ###"
|
||||
exit 0
|
||||
fi
|
||||
|
@ -17,7 +17,7 @@ mount -o remount,rw $BOOT_ROOT
|
||||
|
||||
# update bootloader files
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/LICENCE* $BOOT_ROOT
|
||||
for f in bootcode.bin fixup.dat start.elf ; do
|
||||
for f in bootcode.bin fixup.dat start.elf; do
|
||||
if [ -f "${SYSTEM_ROOT}/usr/share/bootloader/$f" ]; then
|
||||
cp -p "${SYSTEM_ROOT}/usr/share/bootloader/$f" "${BOOT_ROOT}"
|
||||
fi
|
||||
@ -36,10 +36,10 @@ rm -rf $BOOT_ROOT/start_x.elf
|
||||
if [ ! -f $BOOT_ROOT/config.txt ]; then
|
||||
cp -p $SYSTEM_ROOT/usr/share/bootloader/config.txt $BOOT_ROOT
|
||||
else
|
||||
CONFIG_TXT_VERSION=$( \
|
||||
grep "^# config.txt version v[0-9]\+" $BOOT_ROOT/config.txt | \
|
||||
head -n 1 | \
|
||||
sed 's/^# config.txt version v\([0-9]\+\) .*$/\1/' \
|
||||
CONFIG_TXT_VERSION=$(
|
||||
grep "^# config.txt version v[0-9]\+" $BOOT_ROOT/config.txt |
|
||||
head -n 1 |
|
||||
sed 's/^# config.txt version v\([0-9]\+\) .*$/\1/'
|
||||
)
|
||||
if [ ${CONFIG_TXT_VERSION:-0} -lt $MIN_CONFIG_TXT_VERSION ]; then
|
||||
mv -f $BOOT_ROOT/config.txt $BOOT_ROOT/config.txt.old
|
||||
@ -50,7 +50,7 @@ else
|
||||
fi
|
||||
|
||||
# Add distro config files
|
||||
for distro in "$SYSTEM_ROOT/usr/share/bootloader/distroconfig"*.txt ; do
|
||||
for distro in "$SYSTEM_ROOT/usr/share/bootloader/distroconfig"*.txt; do
|
||||
if [ -f "${distro}" ]; then
|
||||
cp -p "${distro}" $BOOT_ROOT
|
||||
fi
|
||||
|
@ -5,20 +5,20 @@
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
mkdir -p $RELEASE_DIR/3rdparty/bootloader
|
||||
cp -PR $INSTALL/usr/share/bootloader/LICENCE* $RELEASE_DIR/3rdparty/bootloader/
|
||||
for f in bootcode.bin fixup.dat start.elf ; do
|
||||
cp -PR $INSTALL/usr/share/bootloader/LICENCE* $RELEASE_DIR/3rdparty/bootloader/
|
||||
for f in bootcode.bin fixup.dat start.elf; do
|
||||
if [ -f "${INSTALL}/usr/share/bootloader/$f" ]; then
|
||||
cp -PR "${INSTALL}/usr/share/bootloader/$f" "${RELEASE_DIR}/3rdparty/bootloader/"
|
||||
fi
|
||||
done
|
||||
cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/
|
||||
cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/
|
||||
done
|
||||
cp -PR $INSTALL/usr/share/bootloader/*.dtb $RELEASE_DIR/3rdparty/bootloader/
|
||||
cp -PR $INSTALL/usr/share/bootloader/overlays $RELEASE_DIR/3rdparty/bootloader/
|
||||
|
||||
if [ -f $INSTALL/usr/share/bootloader/config.txt ]; then
|
||||
if [ -f $INSTALL/usr/share/bootloader/config.txt ]; then
|
||||
cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/
|
||||
fi
|
||||
for distro in "$INSTALL/usr/share/bootloader/distroconfig"*.txt ; do
|
||||
fi
|
||||
for distro in "$INSTALL/usr/share/bootloader/distroconfig"*.txt; do
|
||||
if [ -f "${distro}" ]; then
|
||||
cp -PR "${distro}" $RELEASE_DIR/3rdparty/bootloader/
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
@ -8,25 +8,25 @@
|
||||
# modify it to run on other hardware and you brick your device you will
|
||||
# receive no support to restore your device. You have been warned!
|
||||
|
||||
do_backup(){
|
||||
do_backup() {
|
||||
do_umount
|
||||
echo "info: compressing ${EMMC} to ${2}, this will take time"
|
||||
dd if="${EMMC}" | gzip > of="${2}"
|
||||
dd if="${EMMC}" | gzip >of="${2}"
|
||||
echo "info: compressing completed"
|
||||
}
|
||||
|
||||
do_detect(){
|
||||
do_detect() {
|
||||
# used on LibreComputer LePotato/LaFrite where pre-formatted modules
|
||||
# must be attached after boot (LibreComputer supports this) else the
|
||||
# device always boots to the pre-installed OS on the module.
|
||||
echo "info: rebinding d0074000.mmc"
|
||||
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/unbind
|
||||
echo -n d0074000.mmc > /sys/bus/platform/drivers/meson-gx-mmc/bind
|
||||
echo -n d0074000.mmc >/sys/bus/platform/drivers/meson-gx-mmc/unbind
|
||||
echo -n d0074000.mmc >/sys/bus/platform/drivers/meson-gx-mmc/bind
|
||||
sleep 1
|
||||
parted -s "${EMMC}" print
|
||||
}
|
||||
|
||||
do_info(){
|
||||
do_info() {
|
||||
BOOTINFO=$(dd if="${BOOT}" count=2048 2>/dev/null | strings | grep -e '^U-Boot ' | awk '{print $2}')
|
||||
EMMCINFO=$(dd if="${EMMC}" count=2048 2>/dev/null | strings | grep -e '^U-Boot ' | awk '{print $2}')
|
||||
echo ""
|
||||
@ -45,7 +45,7 @@ do_info(){
|
||||
echo ""
|
||||
}
|
||||
|
||||
do_labels(){
|
||||
do_labels() {
|
||||
if [ -n "${2}" ] && [ -n "${3}" ]; then
|
||||
BOOTLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||
DISKLABEL=$(echo "${3}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||
@ -77,7 +77,7 @@ do_labels(){
|
||||
echo ""
|
||||
}
|
||||
|
||||
do_resize(){
|
||||
do_resize() {
|
||||
if [ -z "${DISKLABEL}" ]; then
|
||||
DISKLABEL=$(blkid | grep "${EMMC}"p2 | awk -F'"' '{print $2}')
|
||||
fi
|
||||
@ -103,7 +103,7 @@ do_resize(){
|
||||
parted -s "${EMMC}" print
|
||||
}
|
||||
|
||||
do_storage(){
|
||||
do_storage() {
|
||||
if [ -n "${2}" ]; then
|
||||
DISKLABEL=$(echo "${2}" | awk 'BEGIN { getline; print toupper($0) }')
|
||||
else
|
||||
@ -130,7 +130,7 @@ do_storage(){
|
||||
echo ""
|
||||
}
|
||||
|
||||
do_umount(){
|
||||
do_umount() {
|
||||
for mount in $(grep "${EMMC}" /proc/mounts | awk '{print $1}'); do
|
||||
echo "info: unmounting $mount"
|
||||
umount -f "$mount"
|
||||
@ -138,13 +138,13 @@ do_umount(){
|
||||
done
|
||||
}
|
||||
|
||||
do_writeprotect(){
|
||||
do_writeprotect() {
|
||||
echo "info: disabling emmc write protection"
|
||||
echo 0 > "/sys/block/${EMMC}boot0/force_ro"
|
||||
echo 0 > "/sys/block/${EMMC}boot1/force_ro"
|
||||
echo 0 >"/sys/block/${EMMC}boot0/force_ro"
|
||||
echo 0 >"/sys/block/${EMMC}boot1/force_ro"
|
||||
}
|
||||
|
||||
do_write(){
|
||||
do_write() {
|
||||
do_umount
|
||||
|
||||
case $(dtname) in
|
||||
@ -155,7 +155,7 @@ do_write(){
|
||||
|
||||
if [ -e "${2}" ]; then
|
||||
case "${2}" in
|
||||
*box.img.gz|*box.img)
|
||||
*box.img.gz | *box.img)
|
||||
echo "error: ${2} is not a bootable image, aborting!"
|
||||
exit 1
|
||||
;;
|
||||
@ -170,6 +170,7 @@ do_write(){
|
||||
*)
|
||||
echo "error: ${2} is not a valid image file!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "error: ${2} not found!"
|
||||
@ -177,14 +178,14 @@ do_write(){
|
||||
fi
|
||||
}
|
||||
|
||||
do_zero(){
|
||||
do_zero() {
|
||||
do_umount
|
||||
echo "info: zeroing ${EMMC}, be patient, this will take time"
|
||||
dd if="/dev/zero" of="${EMMC}" bs=1M
|
||||
echo "info: zeroing complete"
|
||||
}
|
||||
|
||||
do_help(){
|
||||
do_help() {
|
||||
echo ""
|
||||
echo "usage: emmctool (w)rite <filename> : write <filename>.img/.img.gz to the eMMC module"
|
||||
echo " (b)backup <filename> : dump the emmc partition to <filename>.img.gz file"
|
||||
@ -207,7 +208,7 @@ if [ -z "${EMMC}" ]; then
|
||||
fi
|
||||
|
||||
case $(dtname) in
|
||||
azw*|bananapi*|friendlyarm*|hardkernel*|khadas*|libretech*|radxa*|wetek*)
|
||||
azw* | bananapi* | friendlyarm* | hardkernel* | khadas* | libretech* | radxa* | wetek*)
|
||||
if [ "${BOOT}" = "${EMMC}" ]; then
|
||||
do_info
|
||||
echo "Your device is booted from the eMMC module!"
|
||||
@ -226,27 +227,27 @@ case "${1}" in
|
||||
backup)
|
||||
do_backup "$@"
|
||||
;;
|
||||
detect|d)
|
||||
detect | d)
|
||||
do_detect
|
||||
;;
|
||||
info|i)
|
||||
info | i)
|
||||
do_info
|
||||
;;
|
||||
labels|l)
|
||||
labels | l)
|
||||
do_labels "$@"
|
||||
;;
|
||||
resize|r)
|
||||
resize | r)
|
||||
do_resize
|
||||
;;
|
||||
storage|s)
|
||||
storage | s)
|
||||
do_storage "$@"
|
||||
;;
|
||||
write|w)
|
||||
write | w)
|
||||
do_write "$@"
|
||||
do_resize
|
||||
do_labels
|
||||
;;
|
||||
zero|z)
|
||||
zero | z)
|
||||
do_zero
|
||||
;;
|
||||
*)
|
||||
|
@ -40,8 +40,8 @@ if [ ! -f ${SWAY_CONFIG_DAEMON} ]; then
|
||||
cp ${SWAY_CONFIG_DAEMON_DEFAULT} ${SWAY_CONFIG_BASEDIR}
|
||||
fi
|
||||
|
||||
if [ -f ${SWAY_CONFIG_DAEMON} ] ; then
|
||||
if [ -f ${SWAY_CONFIG_DAEMON} ]; then
|
||||
SWAY_DAEMON_CONF=$(cat ${SWAY_CONFIG_DAEMON} | grep -E '^SWAY_DAEMON_CONF=' | cut -d "\"" -f2)
|
||||
fi
|
||||
|
||||
echo SWAY_DAEMON_ARGS=\"${SWAY_DAEMON_CONF} ${SWAY_DAEMON_ARGS}\" > ${SWAY_CONFIG_RUN}
|
||||
echo SWAY_DAEMON_ARGS=\"${SWAY_DAEMON_CONF} ${SWAY_DAEMON_ARGS}\" >${SWAY_CONFIG_RUN}
|
||||
|
@ -14,4 +14,4 @@ fi
|
||||
export WLR_LIBINPUT_NO_DEVICES=1
|
||||
|
||||
logger -t Sway "### Starting Sway with -V ${SWAY_GPU_ARGS} ${SWAY_DAEMON_ARGS}"
|
||||
/usr/bin/sway -V ${SWAY_GPU_ARGS} ${SWAY_DAEMON_ARGS} > ${SWAY_LOG_FILE} 2>&1
|
||||
/usr/bin/sway -V ${SWAY_GPU_ARGS} ${SWAY_DAEMON_ARGS} >${SWAY_LOG_FILE} 2>&1
|
||||
|
@ -15,4 +15,4 @@ if [ -z "${LOCPATH}" ]; then
|
||||
export LOCPATH="/storage/.cache/locpath"
|
||||
fi
|
||||
|
||||
/usr/bin/foot > ${FOOT_LOG_FILE} 2>&1
|
||||
/usr/bin/foot >${FOOT_LOG_FILE} 2>&1
|
||||
|
@ -6,22 +6,22 @@
|
||||
# wait for xorg-configure@.service
|
||||
# max 10 seconds
|
||||
ARGS_FILE="/run/libreelec/xorg-settings.conf"
|
||||
for i in $(seq 1 40) ; do
|
||||
if [ -e "$ARGS_FILE" ] ; then
|
||||
for i in $(seq 1 40); do
|
||||
if [ -e "$ARGS_FILE" ]; then
|
||||
break
|
||||
fi
|
||||
usleep 250000
|
||||
done
|
||||
|
||||
if [ -e "$ARGS_FILE" ] ; then
|
||||
if [ -e "$ARGS_FILE" ]; then
|
||||
. /run/libreelec/xorg-settings.conf
|
||||
exec xorg-launch-helper $@ $XORG_ARGS
|
||||
else
|
||||
echo "" > /dev/tty1
|
||||
echo "failed to start xorg." > /dev/tty1
|
||||
echo "is your GPU supported?" > /dev/tty1
|
||||
echo "" > /dev/tty1
|
||||
lspci -nn > /dev/tty1
|
||||
echo "" > /dev/tty1
|
||||
echo "" >/dev/tty1
|
||||
echo "failed to start xorg." >/dev/tty1
|
||||
echo "is your GPU supported?" >/dev/tty1
|
||||
echo "" >/dev/tty1
|
||||
lspci -nn >/dev/tty1
|
||||
echo "" >/dev/tty1
|
||||
sleep 30
|
||||
fi
|
||||
|
@ -13,7 +13,7 @@ mkdir -p /var/run
|
||||
|
||||
# HACK. we have xorg-configure@%. so nice race
|
||||
# can happen on multi-gpu setups
|
||||
if [ -e /var/run/xorg-configure.done ] ; then
|
||||
if [ -e /var/run/xorg-configure.done ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@ -26,10 +26,10 @@ logger -t Xorg "creating needed directories and symlinks for driver: "${1}""
|
||||
|
||||
logger -t Xorg "### setup xorg.conf paths ###"
|
||||
|
||||
XORG_CONF_USER="/storage/.config/xorg.conf"
|
||||
XORG_CONF_USER_DRV="/storage/.config/xorg-${1}.conf"
|
||||
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
|
||||
XORG_CONF_DEFAULT_DRV="/etc/X11/xorg-${1}.conf"
|
||||
XORG_CONF_USER="/storage/.config/xorg.conf"
|
||||
XORG_CONF_USER_DRV="/storage/.config/xorg-${1}.conf"
|
||||
XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
|
||||
XORG_CONF_DEFAULT_DRV="/etc/X11/xorg-${1}.conf"
|
||||
|
||||
##############################################################################
|
||||
# creating start options
|
||||
@ -37,18 +37,18 @@ logger -t Xorg "### setup xorg.conf paths ###"
|
||||
|
||||
logger -t Xorg "### creating start options ###"
|
||||
|
||||
XORG_ARGS="-s 0 -noreset -allowMouseOpenFail"
|
||||
XORG_ARGS="-s 0 -noreset -allowMouseOpenFail"
|
||||
|
||||
# load user defined xorg.conf, if exist
|
||||
if [ -f "${XORG_CONF_USER}" ]; then
|
||||
# load user defined xorg.conf, if exist
|
||||
if [ -f "${XORG_CONF_USER}" ]; then
|
||||
XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_USER}"
|
||||
elif [ -f "${XORG_CONF_USER_DRV}" ]; then
|
||||
elif [ -f "${XORG_CONF_USER_DRV}" ]; then
|
||||
XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_USER_DRV}"
|
||||
elif [ -f "${XORG_CONF_DEFAULT}" ]; then
|
||||
elif [ -f "${XORG_CONF_DEFAULT}" ]; then
|
||||
XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT}"
|
||||
elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then
|
||||
elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then
|
||||
XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT_DRV}"
|
||||
fi
|
||||
fi
|
||||
|
||||
##############################################################################
|
||||
# creating needed directories and symlinks
|
||||
@ -56,8 +56,8 @@ logger -t Xorg "### creating start options ###"
|
||||
|
||||
logger -t Xorg "### creating needed directories and symlinks ###"
|
||||
|
||||
# Used to support GeForce 600 Series & newer
|
||||
if [ "${1}" = "nvidia" ]; then
|
||||
# Used to support GeForce 600 Series & newer
|
||||
if [ "${1}" = "nvidia" ]; then
|
||||
ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so
|
||||
ln -sf /usr/lib/libnvidia-ml.so.@NVIDIA_VERSION@ /var/lib/libnvidia-ml.so.1
|
||||
ln -sf /usr/lib/xorg/modules/drivers/nvidia-main_drv.so /var/lib/nvidia_drv.so
|
||||
@ -73,8 +73,8 @@ logger -t Xorg "### creating needed directories and symlinks ###"
|
||||
# indirect rendering
|
||||
ln -sf /usr/lib/libGLX_nvidia.so.0 /var/lib/libGLX_indirect.so.0
|
||||
XORG_ARGS="${XORG_ARGS} -ignoreABI"
|
||||
# Used to support GeForce 500 Series & older
|
||||
elif [ "${1}" = "nvidia-legacy" ]; then
|
||||
# Used to support GeForce 500 Series & older
|
||||
elif [ "${1}" = "nvidia-legacy" ]; then
|
||||
ln -sf /usr/lib/libGL_nvidia-legacy.so.1 /var/lib/libGL.so
|
||||
ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia-legacy.so /var/lib/libglx.so
|
||||
ln -sf /usr/lib/libnvidia-ml.so.@NVIDIA_LEGACY_VERSION@ /var/lib/libnvidia-ml.so.1
|
||||
@ -90,21 +90,20 @@ logger -t Xorg "### creating needed directories and symlinks ###"
|
||||
# indirect rendering
|
||||
ln -sf /usr/lib/libGL_nvidia-legacy.so.1 /var/lib/libGLX_indirect.so.0
|
||||
XORG_ARGS="${XORG_ARGS} -ignoreABI"
|
||||
# Used for AMD & Intel GPUs supported by MESA 3D
|
||||
else
|
||||
# Used for AMD & Intel GPUs supported by MESA 3D
|
||||
else
|
||||
ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so
|
||||
# GL/GLX (GLVND)
|
||||
ln -sf /usr/lib/libGL_glvnd.so.1 /var/lib/libGL.so
|
||||
ln -sf /usr/lib/libGLX_glvnd.so.0 /var/lib/libGLX.so
|
||||
# indirect rendering
|
||||
ln -sf /usr/lib/libGLX_mesa.so.0 /var/lib/libGLX_indirect.so.0
|
||||
fi
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
# setup xorg-settings.conf
|
||||
################################################################################
|
||||
|
||||
logger -t Xorg "### starting Xorg with '${DISPLAY} vt01 ${XORG_ARGS}' ###"
|
||||
mkdir -p /run/libreelec
|
||||
echo "XORG_ARGS=\"${XORG_ARGS}\"" > /run/libreelec/xorg-settings.conf
|
||||
|
||||
mkdir -p /run/libreelec
|
||||
echo "XORG_ARGS=\"${XORG_ARGS}\"" >/run/libreelec/xorg-settings.conf
|
||||
|
Loading…
x
Reference in New Issue
Block a user