cleanup scripts: packages/

This commit is contained in:
CvH 2024-07-06 11:48:56 +02:00
parent 99ae3fc3b1
commit 67dcda694b
41 changed files with 466 additions and 483 deletions

View File

@ -24,7 +24,7 @@ if [ -f $HOME/.config/sound.conf ]; then
else else
# get card num # get card num
card=`echo $1 | sed 's/[^0-9]*//g'` card=$(echo $1 | sed 's/[^0-9]*//g')
# set common mixer params # set common mixer params
mixer "$card" Master 0db mixer "$card" Master 0db

View File

@ -23,7 +23,7 @@ Quit Remote q or ctrl+c
com() { com() {
kodi-send --action="$1" >/dev/null 2>&1 kodi-send --action="$1" >/dev/null 2>&1
echo -ne "\r$1\e[K"; echo -ne "\r$1\e[K"
} }
while true; do while true; do
@ -47,6 +47,6 @@ while true; do
+) com "VolumeUp" ;; +) com "VolumeUp" ;;
$'\177') com "Back" ;; $'\177') com "Back" ;;
"") com "Select" ;; "") com "Select" ;;
q) exit q) exit ;;
esac esac
done done

View File

@ -8,8 +8,7 @@ KODI_ROOT=$HOME/.kodi
KODI_ROOT_FAILED=$KODI_ROOT.FAILED KODI_ROOT_FAILED=$KODI_ROOT.FAILED
BOOT_STATUS=$HOME/.config/boot.status BOOT_STATUS=$HOME/.config/boot.status
process_boot_status() process_boot_status() {
{
BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)" BOOT_STATE="$(cat $BOOT_STATUS 2>/dev/null)"
if [ "${BOOT_STATE}" = "SAFE" ]; then if [ "${BOOT_STATE}" = "SAFE" ]; then

View File

@ -41,9 +41,15 @@ OUTPUT="/usr/bin/pastebinit"
while getopts ":hc" opt; do while getopts ":hc" opt; do
case ${opt} in case ${opt} in
c) OUTPUT="cat";; c)
?) usage "${OPTARG}";; OUTPUT="cat"
h) usage;; ;;
?)
usage "${OPTARG}"
;;
h)
usage
;;
esac esac
done done

View File

@ -5,8 +5,7 @@
. /etc/profile . /etc/profile
run_scripts() run_scripts() {
{
list_scripts $1 list_scripts $1
for script in $SCRIPTS; do for script in $SCRIPTS; do
progress "running sleep script $script ($1)..." progress "running sleep script $script ($1)..."
@ -14,8 +13,7 @@ run_scripts()
done done
} }
list_scripts() list_scripts() {
{
case $1 in case $1 in
pre) pre)
SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort) SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort)

View File

@ -26,7 +26,6 @@ help() {
echo "And then use: getedid create" echo "And then use: getedid create"
} }
# check for GPU and store string # check for GPU and store string
check_gpu() { 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
@ -39,7 +38,6 @@ check_gpu() {
fi fi
} }
# run this first if the user already has a custom EDID but want to create a new one (TV or AVR change) # run this first if the user already has a custom EDID but want to create a new one (TV or AVR change)
del_edid() { del_edid() {
if [ "$gpu" = "intel/amd" ]; then if [ "$gpu" = "intel/amd" ]; then
@ -63,7 +61,6 @@ del_edid() {
fi fi
} }
# run main script depending on the GPU # run main script depending on the GPU
run() { run() {
if [ "$gpu" = "intel/amd" ]; then if [ "$gpu" = "intel/amd" ]; then
@ -73,19 +70,16 @@ run() {
fi fi
} }
# mounting /flash to rw # mounting /flash to rw
mount_rw() { mount_rw() {
mount -o remount,rw /flash mount -o remount,rw /flash
} }
# mounting /flash to ro # mounting /flash to ro
mount_ro() { mount_ro() {
mount -o remount,ro /flash mount -o remount,ro /flash
} }
# remount /flash to ro and reboot # remount /flash to ro and reboot
sys_reboot() { sys_reboot() {
mount_ro mount_ro
@ -94,7 +88,6 @@ sys_reboot() {
reboot reboot
} }
# check syslinux.cfg and/or extlinux.conf # check syslinux.cfg and/or extlinux.conf
check_file() { check_file() {
# check boot system # check boot system
@ -122,7 +115,6 @@ check_file() {
fi fi
} }
check_content() { check_content() {
# check if changes are already made to $file and exit if yes # 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
@ -131,7 +123,6 @@ check_content() {
fi fi
} }
create_edid() { create_edid() {
# create edid # create edid
mkdir -p /tmp/cpio/lib/firmware/edid mkdir -p /tmp/cpio/lib/firmware/edid
@ -139,13 +130,11 @@ create_edid() {
mkdir -p /storage/.config/firmware/edid mkdir -p /storage/.config/firmware/edid
cp /tmp/cpio/lib/firmware/edid/edid.bin /storage/.config/firmware/edid cp /tmp/cpio/lib/firmware/edid/edid.bin /storage/.config/firmware/edid
# create cpio archive # create cpio archive
cd /tmp/cpio/ cd /tmp/cpio/
find . -print | cpio -ov -H newc >/storage/edid.cpio find . -print | cpio -ov -H newc >/storage/edid.cpio
} }
intel_amd() { intel_amd() {
# check which output is connnected: # check which output is connnected:
counter=0 counter=0
@ -183,7 +172,6 @@ intel_amd() {
sys_reboot sys_reboot
} }
nvidia() { nvidia() {
# check if xorg.conf already exists # check if xorg.conf already exists
if [ -f /storage/.config/xorg.conf -o -f /storage/.config/xorg-nvidia.conf ]; then if [ -f /storage/.config/xorg.conf -o -f /storage/.config/xorg-nvidia.conf ]; then
@ -191,7 +179,6 @@ nvidia() {
exit 6 exit 6
fi fi
# check for multi-montior setup # 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)" 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 if [ "$monitors" -gt "1" ]; then
@ -199,13 +186,11 @@ nvidia() {
exit 7 exit 7
fi fi
# set debug and restart Xorg # set debug and restart Xorg
cp /etc/X11/xorg-nvidia.conf /storage/.config/xorg.conf cp /etc/X11/xorg-nvidia.conf /storage/.config/xorg.conf
sed -i 's/"ModeDebug" "false"/"ModeDebug" "true"/g' /storage/.config/xorg.conf sed -i 's/"ModeDebug" "false"/"ModeDebug" "true"/g' /storage/.config/xorg.conf
systemctl restart xorg.service systemctl restart xorg.service
# get port # get port
nv_port="$(grep -i -w connected /var/log/Xorg.0.log | grep -i -o "dfp-[0-9]" | sort -u)" 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 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 systemctl restart xorg.service
} }
# start script from here # start script from here
case "$1" in case "$1" in
'create') 'create')

View File

@ -4,8 +4,7 @@
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
do_start() { do_start() {
while sleep 1 while sleep 1; do
do
printf "%4s" "$(date +'%l %M' | tr -d '[:space:]')" >"$LED_PATH_TEXT" printf "%4s" "$(date +'%l %M' | tr -d '[:space:]')" >"$LED_PATH_TEXT"
if [ "$LED_COLON" = "off" ]; then if [ "$LED_COLON" = "off" ]; then
echo "1" >"$LED_PATH_COLON" echo "1" >"$LED_PATH_COLON"

View File

@ -6,7 +6,6 @@ check_hosts() {
grep -v "^#" /run/libreelec/hosts | grep "${1}" grep -v "^#" /run/libreelec/hosts | grep "${1}"
} }
# setup hostname # setup hostname
if [ -f /storage/.cache/hostname ]; then if [ -f /storage/.cache/hostname ]; then
cat /storage/.cache/hostname >/proc/sys/kernel/hostname cat /storage/.cache/hostname >/proc/sys/kernel/hostname
@ -44,4 +43,3 @@ nameserver 8.8.8.8
nameserver 8.8.4.4 nameserver 8.8.4.4
EOF EOF
fi fi

View File

@ -19,4 +19,3 @@ NTP=$NTP_SERVERS
EOF EOF
fi fi
fi fi

View File

@ -36,10 +36,10 @@ rm -rf $BOOT_ROOT/start_x.elf
if [ ! -f $BOOT_ROOT/config.txt ]; then if [ ! -f $BOOT_ROOT/config.txt ]; then
cp -p $SYSTEM_ROOT/usr/share/bootloader/config.txt $BOOT_ROOT cp -p $SYSTEM_ROOT/usr/share/bootloader/config.txt $BOOT_ROOT
else else
CONFIG_TXT_VERSION=$( \ CONFIG_TXT_VERSION=$(
grep "^# config.txt version v[0-9]\+" $BOOT_ROOT/config.txt | \ grep "^# config.txt version v[0-9]\+" $BOOT_ROOT/config.txt |
head -n 1 | \ head -n 1 |
sed 's/^# config.txt version v\([0-9]\+\) .*$/\1/' \ sed 's/^# config.txt version v\([0-9]\+\) .*$/\1/'
) )
if [ ${CONFIG_TXT_VERSION:-0} -lt $MIN_CONFIG_TXT_VERSION ]; then if [ ${CONFIG_TXT_VERSION:-0} -lt $MIN_CONFIG_TXT_VERSION ]; then
mv -f $BOOT_ROOT/config.txt $BOOT_ROOT/config.txt.old mv -f $BOOT_ROOT/config.txt $BOOT_ROOT/config.txt.old

View File

@ -170,6 +170,7 @@ do_write(){
*) *)
echo "error: ${2} is not a valid image file!" echo "error: ${2} is not a valid image file!"
exit 1 exit 1
;;
esac esac
else else
echo "error: ${2} not found!" echo "error: ${2} not found!"

View File

@ -107,4 +107,3 @@ logger -t Xorg "### creating needed directories and symlinks ###"
logger -t Xorg "### starting Xorg with '${DISPLAY} vt01 ${XORG_ARGS}' ###" logger -t Xorg "### starting Xorg with '${DISPLAY} vt01 ${XORG_ARGS}' ###"
mkdir -p /run/libreelec mkdir -p /run/libreelec
echo "XORG_ARGS=\"${XORG_ARGS}\"" >/run/libreelec/xorg-settings.conf echo "XORG_ARGS=\"${XORG_ARGS}\"" >/run/libreelec/xorg-settings.conf