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
# get card num
card=`echo $1 | sed 's/[^0-9]*//g'`
card=$(echo $1 | sed 's/[^0-9]*//g')
# set common mixer params
mixer "$card" Master 0db

View File

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

View File

@ -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

View File

@ -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

View File

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

View File

@ -26,7 +26,6 @@ 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
@ -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,7 +88,6 @@ sys_reboot() {
reboot
}
# check syslinux.cfg and/or extlinux.conf
check_file() {
# check boot system
@ -122,7 +115,6 @@ 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
@ -131,7 +123,6 @@ check_content() {
fi
}
create_edid() {
# create edid
mkdir -p /tmp/cpio/lib/firmware/edid
@ -139,13 +130,11 @@ create_edid() {
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
}
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')

View File

@ -4,8 +4,7 @@
# Copyright (C) 2022-present Team LibreELEC (https://libreelec.tv)
do_start() {
while sleep 1
do
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"

View File

@ -6,7 +6,6 @@ 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
@ -44,4 +43,3 @@ nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
fi

View File

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

View File

@ -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

View File

@ -170,6 +170,7 @@ do_write(){
*)
echo "error: ${2} is not a valid image file!"
exit 1
;;
esac
else
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}' ###"
mkdir -p /run/libreelec
echo "XORG_ARGS=\"${XORG_ARGS}\"" >/run/libreelec/xorg-settings.conf