cleanup scripts: package/addons/

This commit is contained in:
CvH 2024-07-06 13:01:44 +02:00
parent 5275163ab0
commit 99ae3fc3b1
12 changed files with 103 additions and 102 deletions

View File

@ -14,7 +14,7 @@ CHROME_FILE="google-chrome-stable_@CHROME_VERSION@-1_amd64.deb"
# check for enough free disk space # check for enough free disk space
if [ $(df -P . | awk 'END {print $4}') -lt 400000 ]; then if [ $(df -P . | awk 'END {print $4}') -lt 400000 ]; then
kodi-send --action="Notification(Not enough disk space, at least 400MB are required,30000,${ICON})" >/dev/null kodi-send --action="Notification(Not enough disk space, at least 400MB are required,30000,${ICON})" >/dev/null
exit 0; exit 0
fi fi
# remove install status and folders # remove install status and folders
@ -41,7 +41,7 @@ rm -f ${CONTROL_FILE} ${DATA_FILE}
( (
curl -# -O -C - https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_FILE} 2>${DATA_FILE} curl -# -O -C - https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/${CHROME_FILE} 2>${DATA_FILE}
touch ${CONTROL_FILE} touch ${CONTROL_FILE}
) | \ ) |
while [ : ]; do while [ : ]; do
[ -f ${DATA_FILE} ] && prog="$(tr '\r' '\n' <${DATA_FILE} | tail -n 1 | sed -r 's/^[# ]+/#/;s/^[^0-9]*//g')" || prog= [ -f ${DATA_FILE} ] && prog="$(tr '\r' '\n' <${DATA_FILE} | tail -n 1 | sed -r 's/^[# ]+/#/;s/^[^0-9]*//g')" || prog=
kodi-send --action="Notification(Downloading Chrome,\"${prog:-0.0%}\",3000,${ICON})" >/dev/null kodi-send --action="Notification(Downloading Chrome,\"${prog:-0.0%}\",3000,${ICON})" >/dev/null

View File

@ -12,8 +12,7 @@ if [ ! -f "$ADDON_DIR/extract.ok" ]; then
chrome-downloader chrome-downloader
fi fi
if [ -e $ADDON_HOME/env ] if [ -e $ADDON_HOME/env ]; then
then
. $ADDON_HOME/env . $ADDON_HOME/env
fi fi
@ -32,8 +31,7 @@ export GDK_PIXBUF_MODULE_FILE=$ADDON_DIR/config/pixbuf.loaders.cache
export XENVIRONMENT=$ADDON_DIR/config/Xdefaults export XENVIRONMENT=$ADDON_DIR/config/Xdefaults
# start unclutter # start unclutter
if [ "$HIDE_CURSOR" == "true" ] if [ "$HIDE_CURSOR" == "true" ]; then
then
unclutter & unclutter &
UNCLUTTER_PID=$! UNCLUTTER_PID=$!
fi fi
@ -57,19 +55,28 @@ case $VAAPI_MODE in
*) *)
LIBGL_ALWAYS_SOFTWARE='1' LIBGL_ALWAYS_SOFTWARE='1'
export LIBGL_ALWAYS_SOFTWARE export LIBGL_ALWAYS_SOFTWARE
;;
esac esac
export LIBVA_DRIVER_NAME LIBVA_DRIVERS_PATH export LIBVA_DRIVER_NAME LIBVA_DRIVERS_PATH
# windowed # windowed
case $WINDOW_MODE in case $WINDOW_MODE in
'maximized') chrome_OPTS="$chrome_OPTS --start-maximized";; 'maximized')
'kiosk') chrome_OPTS="$chrome_OPTS --kiosk";; chrome_OPTS="$chrome_OPTS --start-maximized"
;;
'kiosk')
chrome_OPTS="$chrome_OPTS --kiosk"
;;
esac esac
# rasterization # rasterization
case $RASTER_MODE in case $RASTER_MODE in
'off') chrome_OPTS="$chrome_OPTS --disable-accelerated-2d-canvas --disable-gpu-compositing";; 'off')
'force') chrome_OPTS="$chrome_OPTS --enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist";; chrome_OPTS="$chrome_OPTS --disable-accelerated-2d-canvas --disable-gpu-compositing"
;;
'force')
chrome_OPTS="$chrome_OPTS --enable-gpu-rasterization --enable-accelerated-2d-canvas --ignore-gpu-blacklist"
;;
esac esac
# alsa # alsa
@ -82,8 +89,7 @@ if [ "$AUDIO_DEVICE_TYPE" == "ALSA" ]; then
fi fi
# dark mode # dark mode
if [ "$DARK_MODE" == "true" ] if [ "$DARK_MODE" == "true" ]; then
then
chrome_OPTS="$chrome_OPTS --force-dark-mode" chrome_OPTS="$chrome_OPTS --force-dark-mode"
fi fi
@ -102,8 +108,7 @@ LD_PRELOAD=/usr/lib/libGL.so $ADDON_DIR/chrome-bin/chrome \
2>&1 | tee $ADDON_LOG_FILE 2>&1 | tee $ADDON_LOG_FILE
# kill unclutter # kill unclutter
if [ "$HIDE_CURSOR" == "true" ] if [ "$HIDE_CURSOR" == "true" ]; then
then
kill $UNCLUTTER_PID kill $UNCLUTTER_PID
fi fi

View File

@ -9,9 +9,15 @@
HDHR_LOCKFILE="/var/lock/userspace-driver-hdhomerun.lck" HDHR_LOCKFILE="/var/lock/userspace-driver-hdhomerun.lck"
HDHR_LOCKFD=99 HDHR_LOCKFD=99
# obtain an exclusive lock # obtain an exclusive lock
exlock() { eval "exec $HDHR_LOCKFD>\"$HDHR_LOCKFILE\""; flock -x $HDHR_LOCKFD; } exlock() {
eval "exec $HDHR_LOCKFD>\"$HDHR_LOCKFILE\""
flock -x $HDHR_LOCKFD
}
# drop a lock # drop a lock
unlock() { flock -u $HDHR_LOCKFD; flock -xn $HDHR_LOCKFD && rm -f "$HDHR_LOCKFILE"; } unlock() {
flock -u $HDHR_LOCKFD
flock -xn $HDHR_LOCKFD && rm -f "$HDHR_LOCKFILE"
}
# end locking mechanism # end locking mechanism
# exclusive lock # exclusive lock

View File

@ -14,7 +14,7 @@ JELLYFIN_FILE="jellyfin_@JELLYFIN_VERSION@.tar.xz"
# check for enough free disk space # check for enough free disk space
if [ $(df . | awk 'END {print $4}') -lt 200000 ]; then if [ $(df . | awk 'END {print $4}') -lt 200000 ]; then
kodi-send --action="Notification(Not enough disk space, at least 200MB are required,30000,${ICON})" >/dev/null kodi-send --action="Notification(Not enough disk space, at least 200MB are required,30000,${ICON})" >/dev/null
exit 0; exit 0
fi fi
# remove install status and folders # remove install status and folders
@ -27,7 +27,7 @@ if [ -d ${ADDON_DIR}/libs ]; then
fi fi
# create tmp download dir # create tmp download dir
TEMP_DIR=`mktemp -d` TEMP_DIR=$(mktemp -d)
mkdir -p ${TEMP_DIR}/tmp_download mkdir -p ${TEMP_DIR}/tmp_download
if [ -d ${TEMP_DIR}/tmp_download ]; then if [ -d ${TEMP_DIR}/tmp_download ]; then
@ -44,7 +44,7 @@ rm -f ${CONTROL_FILE} ${DATA_FILE}
( (
curl -L -# -O -C - https://repo.jellyfin.org/files/server/portable/stable/v@JELLYFIN_VERSION@/any/${JELLYFIN_FILE} 2>${DATA_FILE} curl -L -# -O -C - https://repo.jellyfin.org/files/server/portable/stable/v@JELLYFIN_VERSION@/any/${JELLYFIN_FILE} 2>${DATA_FILE}
touch ${CONTROL_FILE} touch ${CONTROL_FILE}
) | \ ) |
while [ : ]; do while [ : ]; do
[ -f ${DATA_FILE} ] && prog="$(tr '\r' '\n' <${DATA_FILE} | tail -n 1 | sed -r 's/^[# ]+/#/;s/^[^0-9]*//g')" || prog= [ -f ${DATA_FILE} ] && prog="$(tr '\r' '\n' <${DATA_FILE} | tail -n 1 | sed -r 's/^[# ]+/#/;s/^[^0-9]*//g')" || prog=
kodi-send --action="Notification(Downloading Jellyfin,\"${prog:-0.0%}\",3000,${ICON})" >/dev/null kodi-send --action="Notification(Downloading Jellyfin,\"${prog:-0.0%}\",3000,${ICON})" >/dev/null

View File

@ -6,10 +6,10 @@
. /etc/profile . /etc/profile
oe_setup_addon service.system.syncthing oe_setup_addon service.system.syncthing
STNODEFAULTFOLDER="1" syncthing -home=$ADDON_HOME \ STNODEFAULTFOLDER="1" syncthing \
-home=$ADDON_HOME \
-gui-address="$gui_address" \ -gui-address="$gui_address" \
-logflags=0 \ -logflags=0 \
-no-browser \ -no-browser \
-no-restart \ -no-restart \
& &

View File

@ -3,8 +3,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
if [ $# -lt 1 ] if [ $# -lt 1 ]; then
then
. /etc/profile . /etc/profile
ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend42" ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend42"
@ -53,24 +52,20 @@ dflag=
vflag= vflag=
cflag= cflag=
for a in "$@" for a in "$@"; do
do
[ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 [ "$a" = "-d" -o "$a" = "--description" ] && dflag=1
[ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 [ "$a" = "-v" -o "$a" = "--version" ] && vflag=1
[ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 [ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1
done done
if [ -n "$dflag" ] if [ -n "$dflag" ]; then
then
echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi"
fi fi
if [ -n "$vflag" ] if [ -n "$vflag" ]; then
then
echo "1.0" echo "1.0"
fi fi
if [ -n "$cflag" ] if [ -n "$cflag" ]; then
then
echo "baseline" echo "baseline"
fi fi

View File

@ -3,8 +3,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
if [ $# -lt 1 ] if [ $# -lt 1 ]; then
then
. /etc/profile . /etc/profile
ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend43" ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend43"
@ -53,24 +52,20 @@ dflag=
vflag= vflag=
cflag= cflag=
for a in "$@" for a in "$@"; do
do
[ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 [ "$a" = "-d" -o "$a" = "--description" ] && dflag=1
[ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 [ "$a" = "-v" -o "$a" = "--version" ] && vflag=1
[ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 [ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1
done done
if [ -n "$dflag" ] if [ -n "$dflag" ]; then
then
echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi"
fi fi
if [ -n "$vflag" ] if [ -n "$vflag" ]; then
then
echo "1.0" echo "1.0"
fi fi
if [ -n "$cflag" ] if [ -n "$cflag" ]; then
then
echo "baseline" echo "baseline"
fi fi