diff --git a/config/docker/source/bin/docker b/config/docker/source/bin/docker index 41e4bf33ac..54e66e198a 100644 --- a/config/docker/source/bin/docker +++ b/config/docker/source/bin/docker @@ -8,4 +8,4 @@ name="$(basename $0)" oe_setup_addon "$name" docker rm "$name" 2>/dev/null -docker run --name="$name" \ +docker run --name="$name" diff --git a/config/noobs/partition_setup.sh b/config/noobs/partition_setup.sh index 7f0e5344db..052e6138d9 100755 --- a/config/noobs/partition_setup.sh +++ b/config/noobs/partition_setup.sh @@ -6,7 +6,8 @@ MOUNTPOINT="/tmp/LibreELEC-System" md5sumCheck() { - ( cd $MOUNTPOINT + ( + cd $MOUNTPOINT echo "checking MD5: $1" md5sum -c $1.md5 if [ "$?" = "1" ]; then @@ -35,19 +36,19 @@ if [ -z $part1 -o -z $part2 -o -z $id1 -o -z $id2 ]; then fi # create mountpoint - mkdir -p $MOUNTPOINT +mkdir -p $MOUNTPOINT # mount needed partition - mount $part1 $MOUNTPOINT +mount $part1 $MOUNTPOINT # check md5sum - md5sumCheck kernel.img - md5sumCheck SYSTEM +md5sumCheck kernel.img +md5sumCheck SYSTEM # create bootloader configuration - echo "creating bootloader configuration..." - echo "boot=$id1 disk=$id2 quiet @EXTRA_CMDLINE@" > $MOUNTPOINT/cmdline.txt +echo "creating bootloader configuration..." +echo "boot=$id1 disk=$id2 quiet @EXTRA_CMDLINE@" >$MOUNTPOINT/cmdline.txt # cleanup mountpoint - umount $MOUNTPOINT - rmdir $MOUNTPOINT +umount $MOUNTPOINT +rmdir $MOUNTPOINT diff --git a/config/show_config b/config/show_config index fd29a40ad5..86008b25a5 100644 --- a/config/show_config +++ b/config/show_config @@ -37,7 +37,7 @@ show_config() { config_message+="\n - LLVM support:\t\t\t ${LLVM_SUPPORT}" config_message+="\n - DEBUG:\t\t\t\t ${DEBUG:-no}" config_message+="\n - CFLAGS:\t\t\t\t ${TARGET_CFLAGS}" - config_message+="\n - LDFLAGS:\t\t\t\t $(sed 's/^ *//' <<< ${TARGET_LDFLAGS})" + config_message+="\n - LDFLAGS:\t\t\t\t $(sed 's/^ *//' <<<${TARGET_LDFLAGS})" config_message+="\n - Local Ccache:\t\t\t ${LOCAL_CCACHE:-no}" config_message+="\n - CONFIG_SHELL:\t\t\t ${CONFIG_SHELL:-auto}" @@ -104,7 +104,7 @@ show_config() { config_message+="\n ${dashes}${dashes}" config_message+="\n - Graphic Drivers:\t\t\t ${GRAPHIC_DRIVERS}" config_message+="\n - Display Server:\t\t\t ${DISPLAYSERVER}" - if [ "${DISPLAYSERVER}" = "x11" ] ; then + if [ "${DISPLAYSERVER}" = "x11" ]; then for drv in ${XORG_DRIVERS}; do XORG_DRIVERS_CONFIG+="xf86-video-${drv} " done @@ -113,11 +113,11 @@ show_config() { fi config_message+="\n - Window Manager / Compositor:\t\t ${WINDOWMANAGER}" config_message+="\n - OpenGL (GLX) support (provider):\t ${OPENGL_SUPPORT}" - [ "${OPENGL}" != "no" ] && config_message+=" (${OPENGL})" + [ "${OPENGL}" != "no" ] && config_message+=" (${OPENGL})" config_message+="\n - OpenGL ES support (provider):\t ${OPENGLES_SUPPORT}" - [ "${OPENGLES}" != "no" ] && config_message+=" (${OPENGLES})" + [ "${OPENGLES}" != "no" ] && config_message+=" (${OPENGLES})" config_message+="\n - Vulkan API support (provider):\t ${VULKAN_SUPPORT}" - [ "${VULKAN}" != "no" ] && config_message+=" (${VULKAN})" + [ "${VULKAN}" != "no" ] && config_message+=" (${VULKAN})" if [ "${VULKAN_SUPPORT}" = "yes" ]; then config_message+="\n - Vulkan Graphic Drivers:\t\t ${VULKAN_DRIVERS_CONFIG}" fi diff --git a/packages/addons/browser/chrome/source/bin/chrome-downloader b/packages/addons/browser/chrome/source/bin/chrome-downloader index 375bf3bf00..48d26089ac 100755 --- a/packages/addons/browser/chrome/source/bin/chrome-downloader +++ b/packages/addons/browser/chrome/source/bin/chrome-downloader @@ -14,7 +14,7 @@ CHROME_FILE="google-chrome-stable_@CHROME_VERSION@-1_amd64.deb" # check for enough free disk space 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 - exit 0; + exit 0 fi # remove install status and folders @@ -41,9 +41,9 @@ 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} touch ${CONTROL_FILE} -) | \ +) | 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 [ -f ${CONTROL_FILE} ] && break sleep 4 diff --git a/packages/addons/browser/chrome/source/bin/chrome-start b/packages/addons/browser/chrome/source/bin/chrome-start index ddc79c0fb4..350d8d9893 100755 --- a/packages/addons/browser/chrome/source/bin/chrome-start +++ b/packages/addons/browser/chrome/source/bin/chrome-start @@ -12,8 +12,7 @@ if [ ! -f "$ADDON_DIR/extract.ok" ]; then chrome-downloader fi -if [ -e $ADDON_HOME/env ] -then +if [ -e $ADDON_HOME/env ]; then . $ADDON_HOME/env fi @@ -32,8 +31,7 @@ export GDK_PIXBUF_MODULE_FILE=$ADDON_DIR/config/pixbuf.loaders.cache export XENVIRONMENT=$ADDON_DIR/config/Xdefaults # start unclutter -if [ "$HIDE_CURSOR" == "true" ] -then +if [ "$HIDE_CURSOR" == "true" ]; then unclutter & UNCLUTTER_PID=$! fi @@ -43,33 +41,42 @@ LIBVA_DRIVERS_PATH="/usr/lib/dri:$ADDON_DIR/lib.private" LIBVA_DRIVER_NAME='' case $VAAPI_MODE in 'intel') - LIBVA_DRIVER_NAME='i965' - chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder" - ;; + LIBVA_DRIVER_NAME='i965' + chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder" + ;; 'amd') - LIBVA_DRIVER_NAME='vdpau' - chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder" - ;; + LIBVA_DRIVER_NAME='vdpau' + chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder" + ;; 'nvidia') - LIBVA_DRIVER_NAME='vdpau' - chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder --allow-no-sandbox-job --disable-gpu-sandbox" - ;; + LIBVA_DRIVER_NAME='vdpau' + chrome_OPTS="$chrome_OPTS --use-gl=desktop --enable-features=VaapiVideoDecoder --allow-no-sandbox-job --disable-gpu-sandbox" + ;; *) - LIBGL_ALWAYS_SOFTWARE='1' - export LIBGL_ALWAYS_SOFTWARE + LIBGL_ALWAYS_SOFTWARE='1' + export LIBGL_ALWAYS_SOFTWARE + ;; esac export LIBVA_DRIVER_NAME LIBVA_DRIVERS_PATH # windowed case $WINDOW_MODE in - 'maximized') chrome_OPTS="$chrome_OPTS --start-maximized";; - 'kiosk') chrome_OPTS="$chrome_OPTS --kiosk";; + 'maximized') + chrome_OPTS="$chrome_OPTS --start-maximized" + ;; + 'kiosk') + chrome_OPTS="$chrome_OPTS --kiosk" + ;; esac # rasterization case $RASTER_MODE in - 'off') 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";; + 'off') + 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 # alsa @@ -82,8 +89,7 @@ if [ "$AUDIO_DEVICE_TYPE" == "ALSA" ]; then fi # dark mode -if [ "$DARK_MODE" == "true" ] -then +if [ "$DARK_MODE" == "true" ]; then chrome_OPTS="$chrome_OPTS --force-dark-mode" fi @@ -102,8 +108,7 @@ LD_PRELOAD=/usr/lib/libGL.so $ADDON_DIR/chrome-bin/chrome \ 2>&1 | tee $ADDON_LOG_FILE # kill unclutter -if [ "$HIDE_CURSOR" == "true" ] -then +if [ "$HIDE_CURSOR" == "true" ]; then kill $UNCLUTTER_PID fi diff --git a/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh b/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh index 2acb365ce1..c405a8818d 100644 --- a/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh +++ b/packages/addons/driver/hdhomerun/source/bin/userspace-driver.sh @@ -9,9 +9,15 @@ HDHR_LOCKFILE="/var/lock/userspace-driver-hdhomerun.lck" HDHR_LOCKFD=99 # 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 -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 # exclusive lock @@ -40,9 +46,9 @@ mkdir -p /var/config # check settings version XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $HDHR_ADDON_SETTINGS)" if [ "$XML_SETTINGS_VER" = "2" ]; then - xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$HDHR_ADDON_SETTINGS" > /var/config/hdhomerun-addon.conf + xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$HDHR_ADDON_SETTINGS" >/var/config/hdhomerun-addon.conf else - xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$HDHR_ADDON_SETTINGS" > /var/config/hdhomerun-addon.conf + xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$HDHR_ADDON_SETTINGS" >/var/config/hdhomerun-addon.conf fi . /var/config/hdhomerun-addon.conf @@ -63,8 +69,8 @@ if [ -z "$(pidof userhdhomerun)" ]; then DISABLE=$(eval echo \$ATTACHED_TUNER_${SERIAL_UNIQ}_DISABLE) NUMBERS=$(eval echo \$ATTACHED_TUNER_${SERIAL_UNIQ}_NUMBERS) - NUMBERS=$(( $NUMBERS -1 )) - NUMBERS=$(( $NUMBERS *1 )) + NUMBERS=$(($NUMBERS - 1)) + NUMBERS=$(($NUMBERS * 1)) for i in $(seq 0 $NUMBERS); do SERIAL="$SERIAL_UNIQ-$i" @@ -104,7 +110,7 @@ if [ -z "$(pidof userhdhomerun)" ]; then sed -i -e ':a' -e '/^\n*$/{$d;N;};/\n$/ba' $DVBHDHOMERUN_CONF_TMP if [ "$LIBHDHOMERUN_LOG" = "true" ]; then - cat >>$DVBHDHOMERUN_CONF_TMP << EOF + cat >>$DVBHDHOMERUN_CONF_TMP </dev/null) - sn_new=$(grep "Name of device: " /var/log/dvbhdhomerun.log) - if [ "$sn_old" != "$sn_new" ]; then - echo -n $sn_new >$HDHR_ADDON_HOME/adapters.txt - fi -)& + # save adapter names in background + ( + sleep 4 + sn_old=$(cat $HDHR_ADDON_HOME/adapters.txt 2>/dev/null) + sn_new=$(grep "Name of device: " /var/log/dvbhdhomerun.log) + if [ "$sn_old" != "$sn_new" ]; then + echo -n $sn_new >$HDHR_ADDON_HOME/adapters.txt + fi + ) & fi logger -t HDHomeRun "### HDHomeRun ready ###" diff --git a/packages/addons/service/docker/source/bin/docker-config b/packages/addons/service/docker/source/bin/docker-config index 1b1d133d29..44c5935b49 100755 --- a/packages/addons/service/docker/source/bin/docker-config +++ b/packages/addons/service/docker/source/bin/docker-config @@ -16,7 +16,7 @@ if [ ! -f "$ADDON_HOME_DIR/config/docker.conf" ]; then else # previous deprecated options before v23.0.0 need to be updated sed -i -e 's/--storage-opt overlay2.override_kernel_check=1//' \ - -e 's/--graph=/--data-root=/' $ADDON_HOME_DIR/config/docker.conf + -e 's/--graph=/--data-root=/' $ADDON_HOME_DIR/config/docker.conf fi if [ ! -d "$ADDON_HOME_DIR/docker" ]; then diff --git a/packages/addons/service/inadyn/source/bin/inadyn-service b/packages/addons/service/inadyn/source/bin/inadyn-service index d570d10016..c7e677546d 100644 --- a/packages/addons/service/inadyn/source/bin/inadyn-service +++ b/packages/addons/service/inadyn/source/bin/inadyn-service @@ -4,28 +4,28 @@ # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) f="/storage/.kodi/userdata/addon_data/service.system.inadyn/settings.xml" -[ -f "$f" ] && sed -i 's/inadyn_s/inadyn_c/g' "$f" +[ -f "$f" ] && sed -i 's/inadyn_s/inadyn_c/g' "$f" . /etc/profile oe_setup_addon service.system.inadyn if [ "$inadyn_S" == "inadyn.conf" ]; then - config="$ADDON_HOME/inadyn.conf" + config="$ADDON_HOME/inadyn.conf" else - config="$ADDON_HOME/inadyn.temp" - if [ -z "$inadyn_a" -o -z "$inadyn_p" -o -z "$inadyn_u" ]; then - rm -fr "$config" - else - echo "\ + config="$ADDON_HOME/inadyn.temp" + if [ -z "$inadyn_a" -o -z "$inadyn_p" -o -z "$inadyn_u" ]; then + rm -fr "$config" + else + echo "\ provider $inadyn_S { ssl = $inadyn_c username = $inadyn_u password = $inadyn_p hostname = $inadyn_a -}" > "$config" - fi +}" >"$config" + fi fi if [ -f "$config" ]; then - inadyn -f "$config" -l info + inadyn -f "$config" -l info fi diff --git a/packages/addons/service/jellyfin/source/bin/jellyfin-downloader b/packages/addons/service/jellyfin/source/bin/jellyfin-downloader index ceaae3221b..334ac1945f 100644 --- a/packages/addons/service/jellyfin/source/bin/jellyfin-downloader +++ b/packages/addons/service/jellyfin/source/bin/jellyfin-downloader @@ -14,7 +14,7 @@ JELLYFIN_FILE="jellyfin_@JELLYFIN_VERSION@.tar.xz" # check for enough free disk space 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 - exit 0; + exit 0 fi # remove install status and folders @@ -27,7 +27,7 @@ if [ -d ${ADDON_DIR}/libs ]; then fi # create tmp download dir -TEMP_DIR=`mktemp -d` +TEMP_DIR=$(mktemp -d) mkdir -p ${TEMP_DIR}/tmp_download if [ -d ${TEMP_DIR}/tmp_download ]; then @@ -44,9 +44,9 @@ 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} touch ${CONTROL_FILE} -) | \ +) | 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 [ -f ${CONTROL_FILE} ] && break sleep 4 diff --git a/packages/addons/service/jellyfin/source/bin/jellyfin-start b/packages/addons/service/jellyfin/source/bin/jellyfin-start index b38f8c4026..cbc6846ad2 100644 --- a/packages/addons/service/jellyfin/source/bin/jellyfin-start +++ b/packages/addons/service/jellyfin/source/bin/jellyfin-start @@ -15,7 +15,7 @@ libs="${ADDON_DIR}/libs" ff="/storage/.kodi/addons/tools.ffmpeg-tools/bin" exec \ -nice -n "$jellyfin_nice" \ -dotnet "${libs}/jellyfin.dll" \ + nice -n "$jellyfin_nice" \ + dotnet "${libs}/jellyfin.dll" \ --datadir "${ADDON_HOME}" \ --ffmpeg "${ff}/ffmpeg" diff --git a/packages/addons/service/nextpvr/source/bin/nextpvr-downloader b/packages/addons/service/nextpvr/source/bin/nextpvr-downloader index 64ed30b859..29d7a8e9a8 100644 --- a/packages/addons/service/nextpvr/source/bin/nextpvr-downloader +++ b/packages/addons/service/nextpvr/source/bin/nextpvr-downloader @@ -40,7 +40,7 @@ echo "Downloading NextPVR" # download NextPVR rm -f ${CONTROL_FILE} ${DATA_FILE} ( - curl -L -# -O -C - https://github.com/sub3/releases/releases/download/${NEXTPVR_VERSION%~*}/${NEXTPVR_FILE} 2>${DATA_FILE} + curl -L -# -O -C - https://github.com/sub3/releases/releases/download/${NEXTPVR_VERSION%~*}/${NEXTPVR_FILE} 2>${DATA_FILE} touch ${CONTROL_FILE} ) | while [ : ]; do diff --git a/packages/addons/service/syncthing/source/bin/syncthing-service b/packages/addons/service/syncthing/source/bin/syncthing-service index ad8dc3760b..00c7e0b5a8 100644 --- a/packages/addons/service/syncthing/source/bin/syncthing-service +++ b/packages/addons/service/syncthing/source/bin/syncthing-service @@ -6,10 +6,10 @@ . /etc/profile oe_setup_addon service.system.syncthing -STNODEFAULTFOLDER="1" syncthing -home=$ADDON_HOME \ - -gui-address="$gui_address" \ - -logflags=0 \ - -no-browser \ - -no-restart \ - & - +STNODEFAULTFOLDER="1" syncthing \ + -home=$ADDON_HOME \ + -gui-address="$gui_address" \ + -logflags=0 \ + -no-browser \ + -no-restart \ + & diff --git a/packages/addons/service/touchscreen/source/bin/ts_env.sh b/packages/addons/service/touchscreen/source/bin/ts_env.sh index 0c7219145a..cef201ca19 100644 --- a/packages/addons/service/touchscreen/source/bin/ts_env.sh +++ b/packages/addons/service/touchscreen/source/bin/ts_env.sh @@ -21,7 +21,7 @@ if [ -f $ADDON_HOME/ts_env.sh ]; then if [ ! -x $ADDON_HOME/ts_env.sh ]; then chmod +x $ADDON_HOME/ts_env.sh fi - + dos2unix $ADDON_HOME/ts_env.sh dos2unix $ADDON_HOME/ts.conf @@ -48,7 +48,7 @@ else TS_DEVICE_CONF_GENERIC="ts.conf-generic" #TS_DEVICE="$TS_DEVICE_1" # use specified one, should exist ts.conf for it - TS_DEVICE="" # find one automatically + TS_DEVICE="" # find one automatically #echo "device: $TS_DEVICE" TS_DEVICE_CONF="" @@ -59,7 +59,7 @@ else TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_DEVICE="$TS_DEVICE_1" '$0 ~ TS_DEVICE {print $1}') if [ -n "$TSLIB_TSDEVICE" ]; then TS_DEVICE_CONF="$TS_DEVICE_CONF_1" - rmmod st1232 >/dev/null 2>&1 # it's not + rmmod st1232 >/dev/null 2>&1 # it's not else TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_DEVICE="$TS_DEVICE_2" '$0 ~ TS_DEVICE {print $1}') if [ -n "$TSLIB_TSDEVICE" ]; then diff --git a/packages/addons/service/tvheadend42/source/bin/tv_grab_file b/packages/addons/service/tvheadend42/source/bin/tv_grab_file index 318927a03b..7cd4196ab5 100755 --- a/packages/addons/service/tvheadend42/source/bin/tv_grab_file +++ b/packages/addons/service/tvheadend42/source/bin/tv_grab_file @@ -3,8 +3,7 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) -if [ $# -lt 1 ] -then +if [ $# -lt 1 ]; then . /etc/profile ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend42" @@ -24,24 +23,24 @@ then if [ "$XMLTV_TYPE" = "FILE" ]; then case "$XMLTV_LOCATION_FILE" in - *.gz | *.bz2 | *.xz) + *.gz | *.bz2 | *.xz) zcat "$XMLTV_LOCATION_FILE" ;; - *) + *) cat "$XMLTV_LOCATION_FILE" ;; esac exit 0 elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then - if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then + if [ -e "$XMLTV_LOCATION_SCRIPT" ]; then exec "$XMLTV_LOCATION_SCRIPT" fi elif [ "$XMLTV_TYPE" = "WEB" ]; then case "$XMLTV_LOCATION_WEB" in - *.gz | *.bz2 | *.xz) + *.gz | *.bz2 | *.xz) wget -qO - "$XMLTV_LOCATION_WEB" | zcat ;; - *) + *) wget -qO - "$XMLTV_LOCATION_WEB" ;; esac @@ -53,24 +52,20 @@ dflag= vflag= cflag= -for a in "$@" -do +for a in "$@"; do [ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 [ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 [ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 done -if [ -n "$dflag" ] -then +if [ -n "$dflag" ]; then echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" fi -if [ -n "$vflag" ] -then +if [ -n "$vflag" ]; then echo "1.0" fi -if [ -n "$cflag" ] -then +if [ -n "$cflag" ]; then echo "baseline" fi diff --git a/packages/addons/service/tvheadend43/source/bin/tv_grab_file b/packages/addons/service/tvheadend43/source/bin/tv_grab_file index f2cf25ed88..5e8a9b5e7d 100755 --- a/packages/addons/service/tvheadend43/source/bin/tv_grab_file +++ b/packages/addons/service/tvheadend43/source/bin/tv_grab_file @@ -3,8 +3,7 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) -if [ $# -lt 1 ] -then +if [ $# -lt 1 ]; then . /etc/profile ADDON_HOME="$HOME/.kodi/userdata/addon_data/service.tvheadend43" @@ -24,24 +23,24 @@ then if [ "$XMLTV_TYPE" = "FILE" ]; then case "$XMLTV_LOCATION_FILE" in - *.gz | *.bz2 | *.xz) + *.gz | *.bz2 | *.xz) zcat "$XMLTV_LOCATION_FILE" ;; - *) + *) cat "$XMLTV_LOCATION_FILE" ;; esac exit 0 elif [ "$XMLTV_TYPE" = "SCRIPT" ]; then - if [ -e "$XMLTV_LOCATION_SCRIPT" ] ; then + if [ -e "$XMLTV_LOCATION_SCRIPT" ]; then exec "$XMLTV_LOCATION_SCRIPT" fi elif [ "$XMLTV_TYPE" = "WEB" ]; then case "$XMLTV_LOCATION_WEB" in - *.gz | *.bz2 | *.xz) + *.gz | *.bz2 | *.xz) wget -qO - "$XMLTV_LOCATION_WEB" | zcat ;; - *) + *) wget -qO - "$XMLTV_LOCATION_WEB" ;; esac @@ -53,24 +52,20 @@ dflag= vflag= cflag= -for a in "$@" -do +for a in "$@"; do [ "$a" = "-d" -o "$a" = "--description" ] && dflag=1 [ "$a" = "-v" -o "$a" = "--version" ] && vflag=1 [ "$a" = "-c" -o "$a" = "--capabilities" ] && cflag=1 done -if [ -n "$dflag" ] -then +if [ -n "$dflag" ]; then echo "tv_grab_file is a simple grabber that can be configured through the addon settings from Kodi" fi -if [ -n "$vflag" ] -then +if [ -n "$vflag" ]; then echo "1.0" fi -if [ -n "$cflag" ] -then +if [ -n "$cflag" ]; then echo "baseline" fi diff --git a/packages/audio/alsa-utils/scripts/soundconfig b/packages/audio/alsa-utils/scripts/soundconfig index 8ce81b35b7..e5c00f2150 100755 --- a/packages/audio/alsa-utils/scripts/soundconfig +++ b/packages/audio/alsa-utils/scripts/soundconfig @@ -13,171 +13,171 @@ 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 + 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 - mixer "$card" Master 0db - mixer "$card" Front 100% - mixer "$card" PCM 0db - mixer "$card" Synth 100% + # 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 - mixer "$card" CD 0% mute + # 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 - mixer "$card" Mic 0% mute + # mute mic + mixer "$card" Mic 0% mute -# ESS 1969 chipset has 2 PCM channels - mixer "$card" PCM,1 100% + # ESS 1969 chipset has 2 PCM channels + mixer "$card" PCM,1 100% -# Trident/YMFPCI/emu10k1 - mixer "$card" Wave 100% - mixer "$card" Music 100% - mixer "$card" AC97 100% - mixer "$card" Surround 90% - mixer "$card" 'Surround Digital' 90% - mixer "$card" 'Wave Surround' 90% - mixer "$card" 'Duplicate Front' 90% - mixer "$card" 'Sigmatel 4-Speaker Stereo' 90% + # Trident/YMFPCI/emu10k1 + mixer "$card" Wave 100% + mixer "$card" Music 100% + mixer "$card" AC97 100% + mixer "$card" Surround 90% + mixer "$card" 'Surround Digital' 90% + mixer "$card" 'Wave Surround' 90% + mixer "$card" 'Duplicate Front' 90% + mixer "$card" 'Sigmatel 4-Speaker Stereo' 90% -# CS4237B chipset: - mixer "$card" 'Master Digital' 100% + # CS4237B chipset: + mixer "$card" 'Master Digital' 100% -# DRC - mixer "$card" 'Dynamic Range Compression' 90% + # DRC + mixer "$card" 'Dynamic Range Compression' 90% -# Envy24 chips with analog outs - mixer "$card" DAC 100% - mixer "$card" DAC,0 100% - mixer "$card" DAC,1 100% + # 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 - mixer "$card" Headphone 100% - mixer "$card" Speaker 100% - mixer "$card" 'Internal Speaker' 0% mute - mixer "$card" Playback 100% - mixer "$card" Headphone 100% - mixer "$card" Speaker 100% - mixer "$card" Center 100% - mixer "$card" LFE 100% - mixer "$card" Center/LFE 100% + # some notebooks use headphone instead of master + mixer "$card" Headphone 100% + mixer "$card" Speaker 100% + mixer "$card" 'Internal Speaker' 0% mute + mixer "$card" Playback 100% + mixer "$card" Headphone 100% + mixer "$card" Speaker 100% + mixer "$card" Center 100% + mixer "$card" LFE 100% + mixer "$card" Center/LFE 100% -# Intel P4P800-MX (Ubuntu bug #5813) - mixer "$card" 'Master Playback Switch' on + # Intel P4P800-MX (Ubuntu bug #5813) + mixer "$card" 'Master Playback Switch' on -# set digital output mixer params - mixer "$card" 'IEC958' 100% on - mixer "$card" 'IEC958 Output' 100% - mixer "$card" 'IEC958 Coaxial' 100% - mixer "$card" 'IEC958 LiveDrive' 100% - mixer "$card" 'IEC958 Optical Raw' 100% - mixer "$card" 'SPDIF Out' 100% - mixer "$card" 'SPDIF Front' 100% - mixer "$card" 'SPDIF Rear' 100% - mixer "$card" 'SPDIF Center/LFE' 100% - mixer "$card" 'Master Digital' 100% + # set digital output mixer params + mixer "$card" 'IEC958' 100% on + mixer "$card" 'IEC958 Output' 100% + mixer "$card" 'IEC958 Coaxial' 100% + mixer "$card" 'IEC958 LiveDrive' 100% + mixer "$card" 'IEC958 Optical Raw' 100% + mixer "$card" 'SPDIF Out' 100% + mixer "$card" 'SPDIF Front' 100% + mixer "$card" 'SPDIF Rear' 100% + mixer "$card" 'SPDIF Center/LFE' 100% + mixer "$card" 'Master Digital' 100% - mixer "$card" 'Analog Front' 100% - mixer "$card" 'Analog Rear' 100% - mixer "$card" 'Analog Center/LFE' 100% + mixer "$card" 'Analog Front' 100% + mixer "$card" 'Analog Rear' 100% + mixer "$card" 'Analog Center/LFE' 100% -# ASRock ION 330 (and perhaps others) has 2 IEC958 channels - mixer "$card" IEC958,0 on - mixer "$card" IEC958,1 on + # 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 ... - mixer "$card" IEC958,2 on - mixer "$card" IEC958,3 on + # 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 - mixer "$card" 'Master Front' 100% + # ASRock ION 330 has Master Front set to 0 + mixer "$card" 'Master Front' 100% -# Shuttle XS35GT needs this too - mixer "$card" 'Master',0 100% on + # Shuttle XS35GT needs this too + mixer "$card" 'Master',0 100% on -# and this for various Fusion devices like Zotac ZBOX - mixer "$card" 'Front',0 100% on + # and this for various Fusion devices like Zotac ZBOX + mixer "$card" 'Front',0 100% on -# NVidia CK804 sound devices - mixer "$card" 'IEC958 Playback AC97-SPSA' 100% + # NVidia CK804 sound devices + mixer "$card" 'IEC958 Playback AC97-SPSA' 100% -# Allwinner H3 Analog - mixer "$card" 'Line Out' 0db on + # Allwinner H3 Analog + mixer "$card" 'Line Out' 0db on -# Allwinner A20 Analog - mixer "$card" 'Power Amplifier' 0db - mixer "$card" 'Power Amplifier DAC' on - mixer "$card" 'Power Amplifier Mute' on + # Allwinner A20 Analog + mixer "$card" 'Power Amplifier' 0db + mixer "$card" 'Power Amplifier DAC' on + mixer "$card" 'Power Amplifier Mute' on -# Allwinner A64 Analog - mixer "$card" Headphone 0db on - mixer "$card" 'AIF1 Slot 0 Digital DAC' on + # Allwinner A64 Analog + mixer "$card" Headphone 0db on + mixer "$card" 'AIF1 Slot 0 Digital DAC' on -# Amlogic audio devices - case $(dtsoc) in - 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 - mixer "$card" 'FRDDR_A SINK 1 SEL' 'OUT 0' - mixer "$card" 'FRDDR_A SRC 1 EN' on - mixer "$card" 'TDMOUT_A SRC SEL' 'IN 0' - mixer "$card" 'TOHDMITX' on - mixer "$card" 'TOHDMITX I2S SRC' 'I2S A' - elif [ "${TDMOUT}" = "B" ]; then - mixer "$card" 'FRDDR_A SINK 1 SEL' 'OUT 1' - mixer "$card" 'FRDDR_A SRC 1 EN' on - mixer "$card" 'TDMOUT_B SRC SEL' 'IN 0' - mixer "$card" 'TOHDMITX' on - mixer "$card" 'TOHDMITX I2S SRC' 'I2S B' - fi - # AXG S/PDIF - SPDIFOUT=$(awk '/SPDIF/' /sys/firmware/devicetree/base/sound/audio-routing | sort | head -n 1) - if [ -n "${SPDIFOUT}" ]; then - mixer "$card" 'FRDDR_B SINK 1 SEL' 'OUT 3' - mixer "$card" 'FRDDR_B SRC 1 EN' on - mixer "$card" 'SPDIFOUT SRC SEL' 'IN 1' - mixer "$card" 'SPDIFOUT Playback' on - fi - # AXG Headphone Jack - ACODEC=$(awk '/ACODEC/' /sys/firmware/devicetree/base/sound/audio-routing | sort | head -n 1) - if [ -n "${ACODEC}" ]; then - mixer "$card" 'TOACODEC OUT EN' on - mixer "$card" 'TOACODEC SRC' 'I2S ${TDMOUT}' - mixer "$card" 'ACODEC Playback Switch' on - mixer "$card" 'ACODEC Playback Channel Mode' Stereo - fi - ;; - amlogic,meson-gx*) - # AIU HDMI and S/PDIF - mixer "$card" 'AIU HDMI CTRL SRC' 'I2S' - mixer "$card" 'AIU SPDIF SRC SEL' 'SPDIF' - # AIU ACODEC headphone jack - mixer "$card" 'ACODEC' 80% on - mixer "$card" 'AIU ACODEC SRC' 'I2S' - mixer "$card" 'AIU ACODEC OUT EN' on - ;; - esac + # Amlogic audio devices + case $(dtsoc) in + 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 + mixer "$card" 'FRDDR_A SINK 1 SEL' 'OUT 0' + mixer "$card" 'FRDDR_A SRC 1 EN' on + mixer "$card" 'TDMOUT_A SRC SEL' 'IN 0' + mixer "$card" 'TOHDMITX' on + mixer "$card" 'TOHDMITX I2S SRC' 'I2S A' + elif [ "${TDMOUT}" = "B" ]; then + mixer "$card" 'FRDDR_A SINK 1 SEL' 'OUT 1' + mixer "$card" 'FRDDR_A SRC 1 EN' on + mixer "$card" 'TDMOUT_B SRC SEL' 'IN 0' + mixer "$card" 'TOHDMITX' on + mixer "$card" 'TOHDMITX I2S SRC' 'I2S B' + fi + # AXG S/PDIF + SPDIFOUT=$(awk '/SPDIF/' /sys/firmware/devicetree/base/sound/audio-routing | sort | head -n 1) + if [ -n "${SPDIFOUT}" ]; then + mixer "$card" 'FRDDR_B SINK 1 SEL' 'OUT 3' + mixer "$card" 'FRDDR_B SRC 1 EN' on + mixer "$card" 'SPDIFOUT SRC SEL' 'IN 1' + mixer "$card" 'SPDIFOUT Playback' on + fi + # AXG Headphone Jack + ACODEC=$(awk '/ACODEC/' /sys/firmware/devicetree/base/sound/audio-routing | sort | head -n 1) + if [ -n "${ACODEC}" ]; then + mixer "$card" 'TOACODEC OUT EN' on + mixer "$card" 'TOACODEC SRC' 'I2S ${TDMOUT}' + mixer "$card" 'ACODEC Playback Switch' on + mixer "$card" 'ACODEC Playback Channel Mode' Stereo + fi + ;; + amlogic,meson-gx*) + # AIU HDMI and S/PDIF + mixer "$card" 'AIU HDMI CTRL SRC' 'I2S' + mixer "$card" 'AIU SPDIF SRC SEL' 'SPDIF' + # AIU ACODEC headphone jack + mixer "$card" 'ACODEC' 80% on + mixer "$card" 'AIU ACODEC SRC' 'I2S' + mixer "$card" 'AIU ACODEC OUT EN' on + ;; + esac -# ES8316 headphone jack - mixer "$card" 'Right Headphone Mixer Right DAC' on - mixer "$card" 'Left Headphone Mixer Left DAC' on -fi + # ES8316 headphone jack + mixer "$card" 'Right Headphone Mixer Right DAC' on + mixer "$card" 'Left Headphone Mixer Left DAC' on + fi -exit 0 -)& + exit 0 +) & diff --git a/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config b/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config index d8bda0b07c..cb6dded91c 100755 --- a/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config +++ b/packages/audio/rpi-cirrus-config/scripts/rpi-cirrus-config @@ -4,21 +4,21 @@ . /etc/profile -if [ -f $HOME/.config/sound.conf ] ; then - alsactl restore -f $HOME/.config/sound.conf +if [ -f $HOME/.config/sound.conf ]; then + alsactl restore -f $HOME/.config/sound.conf else - 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 - progress "Setting up Cirrus Logic Audio Card" + 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 + progress "Setting up Cirrus Logic Audio Card" - # load helper functions and definitions - . /usr/lib/alsa/rpi-cirrus-functions.sh + # load helper functions and definitions + . /usr/lib/alsa/rpi-cirrus-functions.sh - playback_to_spdif - playback_to_lineout - playback_to_headset - mixer 'Noise Gate Switch' off - fi + playback_to_spdif + playback_to_lineout + playback_to_headset + mixer 'Noise Gate Switch' off + fi fi diff --git a/packages/mediacenter/kodi/scripts/kodi-config b/packages/mediacenter/kodi/scripts/kodi-config index 5844ebc6c0..5c537df71f 100755 --- a/packages/mediacenter/kodi/scripts/kodi-config +++ b/packages/mediacenter/kodi/scripts/kodi-config @@ -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 '' > $KODI_ROOT/userdata/guisettings.xml + [ ! -f $KODI_ROOT/userdata/guisettings.xml ] && echo '' >$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 diff --git a/packages/mediacenter/kodi/scripts/kodi-remote b/packages/mediacenter/kodi/scripts/kodi-remote index 8b73560d0a..01572ffe29 100755 --- a/packages/mediacenter/kodi/scripts/kodi-remote +++ b/packages/mediacenter/kodi/scripts/kodi-remote @@ -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 diff --git a/packages/mediacenter/kodi/scripts/kodi-safe-mode b/packages/mediacenter/kodi/scripts/kodi-safe-mode index eda642a84e..293f748420 100755 --- a/packages/mediacenter/kodi/scripts/kodi-safe-mode +++ b/packages/mediacenter/kodi/scripts/kodi-safe-mode @@ -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 diff --git a/packages/mediacenter/kodi/scripts/pastekodi b/packages/mediacenter/kodi/scripts/pastekodi index 099205dd70..009c7b9c5c 100755 --- a/packages/mediacenter/kodi/scripts/pastekodi +++ b/packages/mediacenter/kodi/scripts/pastekodi @@ -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 @@ -90,13 +96,13 @@ fi vcgencmd bootloader_version | cat_data "Bootloader version" fi - cat_file "/flash/config.txt" # RPi + cat_file "/flash/config.txt" # RPi cat_file "/flash/distroconfig.txt" # RPi - cat_file "/flash/cmdline.txt" # RPi + cat_file "/flash/cmdline.txt" # RPi - cat_file "/flash/syslinux.cfg" # x86 BIOS + cat_file "/flash/syslinux.cfg" # x86 BIOS cat_file "/flash/EFI/BOOT/syslinux.cfg" # x86 EFI - cat_file "/flash/extlinux.conf" # x86 legacy + cat_file "/flash/extlinux.conf" # x86 legacy cat_file "/flash/extlinux/extlinux.conf" # u-boot diff --git a/packages/mediacenter/kodi/scripts/service-addon-wrapper b/packages/mediacenter/kodi/scripts/service-addon-wrapper index 56e061fbbd..e9ce2040b1 100755 --- a/packages/mediacenter/kodi/scripts/service-addon-wrapper +++ b/packages/mediacenter/kodi/scripts/service-addon-wrapper @@ -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 ;; diff --git a/packages/mediacenter/kodi/scripts/setwakeup.sh b/packages/mediacenter/kodi/scripts/setwakeup.sh index a85d1e201b..8582735e0b 100755 --- a/packages/mediacenter/kodi/scripts/setwakeup.sh +++ b/packages/mediacenter/kodi/scripts/setwakeup.sh @@ -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 diff --git a/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh b/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh index ccce1ae95f..652ac404ae 100644 --- a/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d.serial/10-addon-sleep.sh @@ -14,4 +14,4 @@ for script in $HOME/.kodi/addons/*/sleep.d/*.power; do fi done -exit 0 \ No newline at end of file +exit 0 diff --git a/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh b/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh index 3a6f0e7cb1..d70e02a48f 100755 --- a/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d.serial/20-custom-sleep.sh @@ -14,4 +14,4 @@ for script in $HOME/.config/sleep.d/*.power; do fi done -exit 0 \ No newline at end of file +exit 0 diff --git a/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh b/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh index 2102e085c5..3090a32e93 100755 --- a/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh +++ b/packages/mediacenter/kodi/sleep.d/openelec-sleep.sh @@ -5,25 +5,23 @@ . /etc/profile -run_scripts() -{ - list_scripts $1 - for script in $SCRIPTS ; do - progress "running sleep script $script ($1)..." - sh /usr/lib/systemd/system-sleep.serial/$script $1 - done +run_scripts() { + list_scripts $1 + for script in $SCRIPTS; do + progress "running sleep script $script ($1)..." + sh /usr/lib/systemd/system-sleep.serial/$script $1 + done } -list_scripts() -{ - case $1 in - pre) - SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort) - ;; - post) - SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort -r) - ;; - esac +list_scripts() { + case $1 in + pre) + SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort) + ;; + post) + SCRIPTS=$(ls /usr/lib/systemd/system-sleep.serial/ | sort -r) + ;; + esac } run_scripts $1 diff --git a/packages/network/connman/scripts/connman-setup b/packages/network/connman/scripts/connman-setup index 16bc279ad2..da62062e02 100755 --- a/packages/network/connman/scripts/connman-setup +++ b/packages/network/connman/scripts/connman-setup @@ -4,22 +4,22 @@ # Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv) # creating initial settings file - if [ ! -f /storage/.cache/connman/settings ]; then - mkdir -p /storage/.cache/connman - cp /usr/share/connman/settings /storage/.cache/connman - fi +if [ ! -f /storage/.cache/connman/settings ]; then + mkdir -p /storage/.cache/connman + cp /usr/share/connman/settings /storage/.cache/connman +fi # set variable for connman main.conf location - if [ -f /storage/.config/connman_main.conf ]; then - export CONNMAN_MAIN="--config=/storage/.config/connman_main.conf" - else - export CONNMAN_MAIN="--config=/etc/connman/main.conf" - fi +if [ -f /storage/.config/connman_main.conf ]; then + export CONNMAN_MAIN="--config=/storage/.config/connman_main.conf" +else + export CONNMAN_MAIN="--config=/etc/connman/main.conf" +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 diff --git a/packages/network/iptables/scripts/iptables_helper b/packages/network/iptables/scripts/iptables_helper index 308f00c874..f4edda01ec 100755 --- a/packages/network/iptables/scripts/iptables_helper +++ b/packages/network/iptables/scripts/iptables_helper @@ -51,17 +51,17 @@ flush() { enable() { for cmd in $IPTABLES_CMDS; do case "$cmd" in - *6*) - rules="$RULES6" - ipv="6" - ;; - *) - rules="$RULES4" - ipv="4" - ;; + *6*) + rules="$RULES6" + ipv="6" + ;; + *) + rules="$RULES4" + ipv="4" + ;; esac if [ -e "$rules" ]; then - "$cmd-restore" "$rules" + "$cmd-restore" "$rules" fi done check_docker @@ -70,24 +70,24 @@ enable() { if [ "$1" = "enable" ]; then case "${RULES}" in - "none") - flush - ;; - "public") - RULES4="${PUBLIC_RULES}4" - RULES6="${PUBLIC_RULES}6" - ;; - "home") - RULES4="${HOME_RULES}4" - RULES6="${HOME_RULES}6" - ;; - "custom") - RULES4="${CUSTOM_RULES}4" - RULES6="${CUSTOM_RULES}6" - ;; - *) - exit 1 - ;; + "none") + flush + ;; + "public") + RULES4="${PUBLIC_RULES}4" + RULES6="${PUBLIC_RULES}6" + ;; + "home") + RULES4="${HOME_RULES}4" + RULES6="${HOME_RULES}6" + ;; + "custom") + RULES4="${CUSTOM_RULES}4" + RULES6="${CUSTOM_RULES}6" + ;; + *) + exit 1 + ;; esac enable elif [ "$1" = "disable" ]; then diff --git a/packages/network/samba/scripts/samba-autoshare b/packages/network/samba/scripts/samba-autoshare index 7112925dd9..28e8629b01 100755 --- a/packages/network/samba/scripts/samba-autoshare +++ b/packages/network/samba/scripts/samba-autoshare @@ -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 diff --git a/packages/network/wireguard-tools/scripts/wg-keygen b/packages/network/wireguard-tools/scripts/wg-keygen index ef341d6040..3d6c723d40 100755 --- a/packages/network/wireguard-tools/scripts/wg-keygen +++ b/packages/network/wireguard-tools/scripts/wg-keygen @@ -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/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" diff --git a/packages/sysutils/busybox/scripts/create-edid-cpio b/packages/sysutils/busybox/scripts/create-edid-cpio index d98362886e..07177fe6ec 100755 --- a/packages/sysutils/busybox/scripts/create-edid-cpio +++ b/packages/sysutils/busybox/scripts/create-edid-cpio @@ -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 diff --git a/packages/sysutils/busybox/scripts/dthelper b/packages/sysutils/busybox/scripts/dthelper index 6dd9d10114..a4af0d46c8 100755 --- a/packages/sysutils/busybox/scripts/dthelper +++ b/packages/sysutils/busybox/scripts/dthelper @@ -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 } diff --git a/packages/sysutils/busybox/scripts/dump-active-edids-drm b/packages/sysutils/busybox/scripts/dump-active-edids-drm index 2dd4af57c1..7e9cde045f 100755 --- a/packages/sysutils/busybox/scripts/dump-active-edids-drm +++ b/packages/sysutils/busybox/scripts/dump-active-edids-drm @@ -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}" diff --git a/packages/sysutils/busybox/scripts/getedid b/packages/sysutils/busybox/scripts/getedid index 4cf91b2435..467970e01d 100755 --- a/packages/sysutils/busybox/scripts/getedid +++ b/packages/sysutils/busybox/scripts/getedid @@ -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,12 +38,11 @@ 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 check_file - if [ -f "$file".old ]; then + if [ -f "$file".old ]; then mount_rw rm "$file" mv "$file".old "$file" @@ -60,10 +58,9 @@ del_edid() { rm -f /storage/.config/xorg.conf rm -f /storage/.config/xorg.le.backup systemctl restart xorg.service - fi + 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 + # 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 @@ -162,7 +151,7 @@ intel_amd() { fi done - # create the edid + # create the edid create_edid # check extlinux.conf and syslinux.cfg @@ -175,7 +164,7 @@ intel_amd() { # make a backup of $file cp "$file" "$file".old - + # add boot parameters to $file sed -i "/ APPEND/s/$/ initrd=\/edid.cpio drm.edid_firmware=edid\/edid.bin video=$hdmi:D/" "$file" @@ -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,12 +186,10 @@ 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)" @@ -212,7 +197,7 @@ nvidia() { # set mode debug back to false sed -i 's/"ModeDebug" "true"/"ModeDebug" "false"/g' /storage/.config/xorg.conf - + # set port and uncomment lines sed -i "s/# Option \"ConnectedMonitor\" \"DFP-0\"/ Option \"ConnectedMonitor\" \"$nv_port\"/g" /storage/.config/xorg.conf sed -i "s/# Option \"CustomEDID\" \"DFP-0:\/storage\/.config\/edid.bin\"/ Option \"CustomEDID\" \"$nv_port:\/storage\/.config\/edid.bin\"/g" /storage/.config/xorg.conf @@ -223,7 +208,6 @@ nvidia() { systemctl restart xorg.service } - # start script from here case "$1" in 'create') diff --git a/packages/sysutils/busybox/scripts/kernel-overlays-setup b/packages/sysutils/busybox/scripts/kernel-overlays-setup index 3da3fea42b..3d03414a73 100755 --- a/packages/sysutils/busybox/scripts/kernel-overlays-setup +++ b/packages/sysutils/busybox/scripts/kernel-overlays-setup @@ -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}" diff --git a/packages/sysutils/busybox/scripts/ledfix b/packages/sysutils/busybox/scripts/ledfix index d997bf01d7..def286c9b0 100755 --- a/packages/sysutils/busybox/scripts/ledfix +++ b/packages/sysutils/busybox/scripts/ledfix @@ -9,8 +9,8 @@ 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 - ;; + ;; esac diff --git a/packages/sysutils/busybox/scripts/libreelec-target-generator b/packages/sysutils/busybox/scripts/libreelec-target-generator index 11f65200da..4a54c35f08 100755 --- a/packages/sysutils/busybox/scripts/libreelec-target-generator +++ b/packages/sysutils/busybox/scripts/libreelec-target-generator @@ -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 diff --git a/packages/sysutils/busybox/scripts/update-bootloader-edid-amlogic b/packages/sysutils/busybox/scripts/update-bootloader-edid-amlogic index 2974fddc4f..5054c60e02 100755 --- a/packages/sysutils/busybox/scripts/update-bootloader-edid-amlogic +++ b/packages/sysutils/busybox/scripts/update-bootloader-edid-amlogic @@ -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 } diff --git a/packages/sysutils/busybox/scripts/update-bootloader-edid-rpi b/packages/sysutils/busybox/scripts/update-bootloader-edid-rpi index 1516f3e9d1..0ca946a639 100755 --- a/packages/sysutils/busybox/scripts/update-bootloader-edid-rpi +++ b/packages/sysutils/busybox/scripts/update-bootloader-edid-rpi @@ -43,21 +43,21 @@ 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() { CMDLINE=$(get_cleaned_cmdline_txt) - FIRMWARE="" + FIRMWARE="" VIDEO="" for conn in "$@"; do VIDEO="${VIDEO} video=${conn}:D" [ -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 } diff --git a/packages/sysutils/busybox/scripts/vfd-clock b/packages/sysutils/busybox/scripts/vfd-clock index a4618ea3cb..a94fb474b1 100755 --- a/packages/sysutils/busybox/scripts/vfd-clock +++ b/packages/sysutils/busybox/scripts/vfd-clock @@ -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 diff --git a/packages/sysutils/lirc/scripts/lircd_helper b/packages/sysutils/lirc/scripts/lircd_helper index 8430b4a37f..75be889c13 100755 --- a/packages/sysutils/lirc/scripts/lircd_helper +++ b/packages/sysutils/lirc/scripts/lircd_helper @@ -3,8 +3,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2017 Matthias Reichl (hias@horus.com) -if [ -e "/storage/.config/lirc_options.conf" ] ; then - LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" +if [ -e "/storage/.config/lirc_options.conf" ]; then + LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" fi exec /usr/sbin/lircd $LIRCD_OPTIONS "$@" /storage/.config/lircd.conf diff --git a/packages/sysutils/lirc/scripts/lircd_uinput_helper b/packages/sysutils/lirc/scripts/lircd_uinput_helper index 46685cd4f7..3c27b80be8 100755 --- a/packages/sysutils/lirc/scripts/lircd_uinput_helper +++ b/packages/sysutils/lirc/scripts/lircd_uinput_helper @@ -3,8 +3,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (C) 2017 Matthias Reichl (hias@horus.com) -if [ -e "/storage/.config/lirc_options.conf" ] ; then - LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" +if [ -e "/storage/.config/lirc_options.conf" ]; then + LIRCD_OPTIONS="-O /storage/.config/lirc_options.conf" fi exec /usr/sbin/lircd-uinput $LIRCD_OPTIONS "$@" diff --git a/packages/sysutils/systemd/scripts/cpufreq b/packages/sysutils/systemd/scripts/cpufreq index c39eb4e12f..0d1bd69572 100755 --- a/packages/sysutils/systemd/scripts/cpufreq +++ b/packages/sysutils/systemd/scripts/cpufreq @@ -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 diff --git a/packages/sysutils/systemd/scripts/environment-setup b/packages/sysutils/systemd/scripts/environment-setup index b5121928df..eb78e067ed 100755 --- a/packages/sysutils/systemd/scripts/environment-setup +++ b/packages/sysutils/systemd/scripts/environment-setup @@ -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 diff --git a/packages/sysutils/systemd/scripts/network-base-setup b/packages/sysutils/systemd/scripts/network-base-setup index a857c5f47a..400084f759 100755 --- a/packages/sysutils/systemd/scripts/network-base-setup +++ b/packages/sysutils/systemd/scripts/network-base-setup @@ -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 </run/libreelec/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 EOF fi - diff --git a/packages/sysutils/systemd/scripts/systemd-machine-id-setup b/packages/sysutils/systemd/scripts/systemd-machine-id-setup index bee033bfc5..4d669eeee4 100755 --- a/packages/sysutils/systemd/scripts/systemd-machine-id-setup +++ b/packages/sysutils/systemd/scripts/systemd-machine-id-setup @@ -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 diff --git a/packages/sysutils/systemd/scripts/systemd-timesyncd-setup b/packages/sysutils/systemd/scripts/systemd-timesyncd-setup index eb9494ca5e..0c6c254d69 100755 --- a/packages/sysutils/systemd/scripts/systemd-timesyncd-setup +++ b/packages/sysutils/systemd/scripts/systemd-timesyncd-setup @@ -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 </run/systemd/timesyncd.conf.d/kernel-ntp-servers.conf [Time] NTP=$NTP_SERVERS EOF fi fi - diff --git a/packages/sysutils/util-linux/scripts/mount-swap b/packages/sysutils/util-linux/scripts/mount-swap index e02a39f3a0..6ecdef3891 100755 --- a/packages/sysutils/util-linux/scripts/mount-swap +++ b/packages/sysutils/util-linux/scripts/mount-swap @@ -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 diff --git a/packages/tools/bcm2835-bootloader/files/update.sh b/packages/tools/bcm2835-bootloader/files/update.sh index 500d2079aa..44a79652ba 100755 --- a/packages/tools/bcm2835-bootloader/files/update.sh +++ b/packages/tools/bcm2835-bootloader/files/update.sh @@ -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 diff --git a/packages/tools/bcm2835-bootloader/release b/packages/tools/bcm2835-bootloader/release index efdb7322e7..a633fadfe2 100755 --- a/packages/tools/bcm2835-bootloader/release +++ b/packages/tools/bcm2835-bootloader/release @@ -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 - 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/ - - if [ -f $INSTALL/usr/share/bootloader/config.txt ]; then - cp -PR $INSTALL/usr/share/bootloader/config.txt $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 + if [ -f "${INSTALL}/usr/share/bootloader/$f" ]; then + cp -PR "${INSTALL}/usr/share/bootloader/$f" "${RELEASE_DIR}/3rdparty/bootloader/" 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 +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 + cp -PR $INSTALL/usr/share/bootloader/config.txt $RELEASE_DIR/3rdparty/bootloader/ +fi +for distro in "$INSTALL/usr/share/bootloader/distroconfig"*.txt; do + if [ -f "${distro}" ]; then + cp -PR "${distro}" $RELEASE_DIR/3rdparty/bootloader/ + fi +done diff --git a/packages/tools/emmctool/scripts/emmctool b/packages/tools/emmctool/scripts/emmctool index cd76b47b0d..0cc5f04001 100755 --- a/packages/tools/emmctool/scripts/emmctool +++ b/packages/tools/emmctool/scripts/emmctool @@ -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(){ - echo "info: disabling emmc write protection" - echo 0 > "/sys/block/${EMMC}boot0/force_ro" - echo 0 > "/sys/block/${EMMC}boot1/force_ro" +do_writeprotect() { + echo "info: disabling emmc write protection" + 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 : write .img/.img.gz to the eMMC module" echo " (b)backup : dump the emmc partition to .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 ;; *) diff --git a/packages/wayland/compositor/sway/scripts/sway-config b/packages/wayland/compositor/sway/scripts/sway-config index 65c0ee2b3a..62f4925f70 100755 --- a/packages/wayland/compositor/sway/scripts/sway-config +++ b/packages/wayland/compositor/sway/scripts/sway-config @@ -29,7 +29,7 @@ fi if [ ! -f ${SWAY_CONFIG_USER} ]; then mkdir -p ${SWAY_CONFIG_BASEDIR} - cp ${SWAY_CONFIG_USER_DEFAULT} ${SWAY_CONFIG_BASEDIR} + cp ${SWAY_CONFIG_USER_DEFAULT} ${SWAY_CONFIG_BASEDIR} fi if [ ! -f ${SWAY_CONFIG_COLOR} ]; then @@ -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 - SWAY_DAEMON_CONF=$(cat ${SWAY_CONFIG_DAEMON} | grep -E '^SWAY_DAEMON_CONF=' | cut -d "\"" -f2) +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} diff --git a/packages/wayland/compositor/sway/scripts/sway.sh b/packages/wayland/compositor/sway/scripts/sway.sh index b1b4c5b0d5..a80ecced56 100755 --- a/packages/wayland/compositor/sway/scripts/sway.sh +++ b/packages/wayland/compositor/sway/scripts/sway.sh @@ -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 diff --git a/packages/wayland/util/foot/scripts/foot.sh b/packages/wayland/util/foot/scripts/foot.sh index 7e30579dc0..d7c08f999e 100755 --- a/packages/wayland/util/foot/scripts/foot.sh +++ b/packages/wayland/util/foot/scripts/foot.sh @@ -8,11 +8,11 @@ FOOT_LOG_FILE=/var/log/foot.log if [ ! -f ${FOOT_CONFIG_DIR}/foot.ini ]; then mkdir -p ${FOOT_CONFIG_DIR} - cp ${FOOT_CONFIG_DEFAULT} ${FOOT_CONFIG_DIR} + cp ${FOOT_CONFIG_DEFAULT} ${FOOT_CONFIG_DIR} fi 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 diff --git a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch index 9e6c719783..ecb623e2e4 100755 --- a/packages/x11/util/xorg-launch-helper/scripts/xorg-launch +++ b/packages/x11/util/xorg-launch-helper/scripts/xorg-launch @@ -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 diff --git a/packages/x11/xserver/xorg-server/scripts/xorg-configure b/packages/x11/xserver/xorg-server/scripts/xorg-configure index a7e9a97c35..5321ea9ec0 100755 --- a/packages/x11/xserver/xorg-server/scripts/xorg-configure +++ b/packages/x11/xserver/xorg-server/scripts/xorg-configure @@ -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 - XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_USER}" - elif [ -f "${XORG_CONF_USER_DRV}" ]; then - XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_USER_DRV}" - elif [ -f "${XORG_CONF_DEFAULT}" ]; then - XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT}" - elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then - XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT_DRV}" - fi +# 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 + XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_USER_DRV}" +elif [ -f "${XORG_CONF_DEFAULT}" ]; then + XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT}" +elif [ -f "$XORG_CONF_DEFAULT_DRV" ]; then + XORG_ARGS="${XORG_ARGS} -config ${XORG_CONF_DEFAULT_DRV}" +fi ############################################################################## # creating needed directories and symlinks @@ -56,55 +56,54 @@ 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 - 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 - ln -sf /usr/lib/nvidia/nvidia.ko /var/lib/nvidia.ko - ln -sf /usr/lib/vdpau/libvdpau_nvidia-main.so.1 /var/lib/libvdpau_nvidia.so.1 - ln -sf /usr/lib/vdpau/libvdpau_nvidia-main.so.1 /var/lib/libvdpau_nvidia.so - ln -sf /usr/bin/nvidia-main-smi /var/lib/nvidia-smi - ln -sf /usr/bin/nvidia-main-xconfig /var/lib/nvidia-xconfig - insmod /var/lib/nvidia.ko - # 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_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 - 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 - ln -sf /usr/lib/xorg/modules/drivers/nvidia-legacy_drv.so /var/lib/nvidia_drv.so - ln -sf /usr/lib/nvidia-legacy/nvidia.ko /var/lib/nvidia.ko - ln -sf /usr/lib/vdpau/libvdpau_nvidia-legacy.so.1 /var/lib/libvdpau_nvidia.so.1 - ln -sf /usr/lib/vdpau/libvdpau_nvidia-legacy.so.1 /var/lib/libvdpau_nvidia.so - ln -sf /usr/bin/nvidia-legacy-smi /var/lib/nvidia-smi - ln -sf /usr/bin/nvidia-legacy-xconfig /var/lib/nvidia-xconfig - insmod /var/lib/nvidia.ko - # GLX (NON-GLVND) - ln -sf /usr/lib/libGL_nvidia-legacy.so.1 /var/lib/libGLX.so - # 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 - 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 +# 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 + ln -sf /usr/lib/nvidia/nvidia.ko /var/lib/nvidia.ko + ln -sf /usr/lib/vdpau/libvdpau_nvidia-main.so.1 /var/lib/libvdpau_nvidia.so.1 + ln -sf /usr/lib/vdpau/libvdpau_nvidia-main.so.1 /var/lib/libvdpau_nvidia.so + ln -sf /usr/bin/nvidia-main-smi /var/lib/nvidia-smi + ln -sf /usr/bin/nvidia-main-xconfig /var/lib/nvidia-xconfig + insmod /var/lib/nvidia.ko + # 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_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 + 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 + ln -sf /usr/lib/xorg/modules/drivers/nvidia-legacy_drv.so /var/lib/nvidia_drv.so + ln -sf /usr/lib/nvidia-legacy/nvidia.ko /var/lib/nvidia.ko + ln -sf /usr/lib/vdpau/libvdpau_nvidia-legacy.so.1 /var/lib/libvdpau_nvidia.so.1 + ln -sf /usr/lib/vdpau/libvdpau_nvidia-legacy.so.1 /var/lib/libvdpau_nvidia.so + ln -sf /usr/bin/nvidia-legacy-smi /var/lib/nvidia-smi + ln -sf /usr/bin/nvidia-legacy-xconfig /var/lib/nvidia-xconfig + insmod /var/lib/nvidia.ko + # GLX (NON-GLVND) + ln -sf /usr/lib/libGL_nvidia-legacy.so.1 /var/lib/libGLX.so + # 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 + 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 ################################################################################ # 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 diff --git a/projects/Allwinner/filesystem/usr/bin/cputemp b/projects/Allwinner/filesystem/usr/bin/cputemp index 11535271c5..33e4d3d5ff 100755 --- a/projects/Allwinner/filesystem/usr/bin/cputemp +++ b/projects/Allwinner/filesystem/usr/bin/cputemp @@ -5,4 +5,4 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Allwinner/filesystem/usr/bin/gputemp b/projects/Allwinner/filesystem/usr/bin/gputemp index 761b5d1f30..cf7bcfe4a2 100755 --- a/projects/Allwinner/filesystem/usr/bin/gputemp +++ b/projects/Allwinner/filesystem/usr/bin/gputemp @@ -5,8 +5,8 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) if [ -f /sys/class/thermal/thermal_zone1/temp ]; then - TEMP="$(cat /sys/class/thermal/thermal_zone1/temp)" + TEMP="$(cat /sys/class/thermal/thermal_zone1/temp)" else - TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" + TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" fi -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Amlogic/bootloader/canupdate.sh b/projects/Amlogic/bootloader/canupdate.sh index 4f61c09bfa..9542cc57c6 100644 --- a/projects/Amlogic/bootloader/canupdate.sh +++ b/projects/Amlogic/bootloader/canupdate.sh @@ -5,7 +5,7 @@ # detect legacy kernel installs and abort to prevent upgrades case $(uname -r) in - 3.14*|4.9*) + 3.14* | 4.9*) echo "Updates from Amlogic vendor kernels are not supported!" sleep 10 exit 1 diff --git a/projects/Amlogic/bootloader/update.sh b/projects/Amlogic/bootloader/update.sh index fc91b8bd72..d692ddd3e3 100644 --- a/projects/Amlogic/bootloader/update.sh +++ b/projects/Amlogic/bootloader/update.sh @@ -8,56 +8,56 @@ [ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) # identify the boot device - if [ -z "$BOOT_DISK" ]; then - case $BOOT_PART in - /dev/sd[a-z][0-9]*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") - ;; - /dev/mmcblk*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") - ;; - esac - fi +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi # mount $BOOT_ROOT rw - mount -o remount,rw $BOOT_ROOT +mount -o remount,rw $BOOT_ROOT # update /amlogic device trees - if [ -d $BOOT_ROOT/amlogic ]; then - for dtbfile in $BOOT_ROOT/amlogic/*.dtb ; do - dtb=$(basename $dtbfile) - echo "Updating $dtb" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/amlogic/ 2>/dev/null || true - done - fi +if [ -d $BOOT_ROOT/amlogic ]; then + for dtbfile in $BOOT_ROOT/amlogic/*.dtb; do + dtb=$(basename $dtbfile) + echo "Updating $dtb" + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/amlogic/ 2>/dev/null || true + done +fi # update /extlinux device trees - if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then - for dtbfile in $BOOT_ROOT/*.dtb ; do - dtb=$(basename $dtbfile) - echo "Updating $dtb" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/ 2>/dev/null || true - done - fi +if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then + for dtbfile in $BOOT_ROOT/*.dtb; do + dtb=$(basename $dtbfile) + echo "Updating $dtb" + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/ 2>/dev/null || true + done +fi # update /dtb device trees - if [ -d $BOOT_ROOT/dtb ]; then - for dtbfile in $BOOT_ROOT/dtb/*.dtb ; do - dtb=$(basename $dtbfile) - echo "Updating $dtb" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true - done - fi +if [ -d $BOOT_ROOT/dtb ]; then + for dtbfile in $BOOT_ROOT/dtb/*.dtb; do + dtb=$(basename $dtbfile) + echo "Updating $dtb" + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/dtb/ 2>/dev/null || true + done +fi # update u-boot scripts - if [ -f $BOOT_ROOT/uEnv.ini ]; then - for scriptfile in $SYSTEM_ROOT/usr/share/bootloader/*_autoscript* $SYSTEM_ROOT/usr/share/bootloader/*.scr ; do - script=$(basename $scriptfile) - echo "Updating $script" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$script $BOOT_ROOT/ 2>/dev/null || true - done - fi +if [ -f $BOOT_ROOT/uEnv.ini ]; then + for scriptfile in $SYSTEM_ROOT/usr/share/bootloader/*_autoscript* $SYSTEM_ROOT/usr/share/bootloader/*.scr; do + script=$(basename $scriptfile) + echo "Updating $script" + cp -p $SYSTEM_ROOT/usr/share/bootloader/$script $BOOT_ROOT/ 2>/dev/null || true + done +fi # mount $BOOT_ROOT ro - sync - mount -o remount,ro $BOOT_ROOT +sync +mount -o remount,ro $BOOT_ROOT diff --git a/projects/Amlogic/filesystem/usr/bin/cputemp b/projects/Amlogic/filesystem/usr/bin/cputemp index 312f817d74..64397436ca 100755 --- a/projects/Amlogic/filesystem/usr/bin/cputemp +++ b/projects/Amlogic/filesystem/usr/bin/cputemp @@ -4,7 +4,7 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) case $(dtsoc) in - amlogic,g12*|amlogic,sm1) + amlogic,g12* | amlogic,sm1) TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone1/temp) ;; *) @@ -12,5 +12,5 @@ case $(dtsoc) in ;; esac -TEMP="$(( $TEMP / 1000 ))" +TEMP="$(($TEMP / 1000))" echo "${TEMP} C" diff --git a/projects/Amlogic/packages/systemd/scripts/cpufreq b/projects/Amlogic/packages/systemd/scripts/cpufreq index 940e090a58..9afa1b1b06 100755 --- a/projects/Amlogic/packages/systemd/scripts/cpufreq +++ b/projects/Amlogic/packages/systemd/scripts/cpufreq @@ -8,16 +8,16 @@ SYS_CPUFREQ_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) if [ "${SYS_CPUFREQ_GOV}" = "ondemand" ]; then for io_is_busy in $(find /sys/devices/system/cpu -name io_is_busy); do - echo 1 > "${io_is_busy}" + echo 1 >"${io_is_busy}" done for up_threshold in $(find /sys/devices/system/cpu -name up_threshold); do - echo 50 > "${up_threshold}" + echo 50 >"${up_threshold}" done for sampling_rate in $(find /sys/devices/system/cpu -name sampling_rate); do - echo 100000 > "${sampling_rate}" + echo 100000 >"${sampling_rate}" done for sampling_down_factor in $(find /sys/devices/system/cpu -name sampling_down_factor); do - echo 50 > "${sampling_down_factor}" + echo 50 >"${sampling_down_factor}" done else echo "cpufreq: settings not found for current cpu governor." | systemd-cat -p info diff --git a/projects/Generic/devices/x11/filesystem/usr/bin/intel-fullrange.sh b/projects/Generic/devices/x11/filesystem/usr/bin/intel-fullrange.sh index f114b9f8b3..8bd01d287a 100755 --- a/projects/Generic/devices/x11/filesystem/usr/bin/intel-fullrange.sh +++ b/projects/Generic/devices/x11/filesystem/usr/bin/intel-fullrange.sh @@ -2,14 +2,15 @@ FB_TYPE="$(grep '^0 ' /proc/fb | sed 's/[^[:space:]] //')" if [ "$FB_TYPE" == "inteldrmfb" ] || echo "$FB_TYPE" | grep -q "^i9[0-9]*drmfb$"; then - OUTPUT=`/usr/bin/xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'` - for out in $OUTPUT ; do + OUTPUT=$(/usr/bin/xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q') + for out in $OUTPUT; do # Hack - something is not yet fully right /usr/bin/xrandr -display :0 --output $out --set "Broadcast RGB" "Full" # Seems there is a little race somewhere on some outputs # Turn the display shortly off and on again if [ -e "/storage/.config/forcedisplay" ]; then - /usr/bin/xrandr -display :0 --output $out --off ; /usr/bin/xrandr -display :0 --output $out --auto + /usr/bin/xrandr -display :0 --output $out --off + /usr/bin/xrandr -display :0 --output $out --auto fi done fi diff --git a/projects/Generic/filesystem/usr/bin/cputemp b/projects/Generic/filesystem/usr/bin/cputemp index 747bdb0e35..e64e0535f3 100755 --- a/projects/Generic/filesystem/usr/bin/cputemp +++ b/projects/Generic/filesystem/usr/bin/cputemp @@ -16,16 +16,16 @@ if [ $(basename "$0") = "gputemp" -o "$1" = "gpu" ]; then for hwmon in /sys/class/hwmon/*; do if [ -f "${hwmon}/name" ]; then case $(cat ${hwmon}/name) in - nouveau|radeon|amdgpu) + nouveau | radeon | amdgpu) [[ -f "${hwmon}/temp1_input" ]] && TEMP="$(cat ${hwmon}/temp1_input)" && break [[ -f "${hwmon}/temp2_input" ]] && TEMP="$(cat ${hwmon}/temp2_input)" && break ;; - # intel gpu is supported by cpu coretemp below + # intel gpu is supported by cpu coretemp below esac fi done - TEMP="$(( $TEMP / 1000 ))" + TEMP="$(($TEMP / 1000))" fi fi @@ -34,7 +34,7 @@ if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then for hwmon in /sys/class/hwmon/*; do if [ -f "${hwmon}/name" ]; then case $(cat ${hwmon}/name) in - coretemp|k10temp|scpi_sensors) + coretemp | k10temp | scpi_sensors) [[ -f "${hwmon}/temp1_input" ]] && TEMP="$(cat ${hwmon}/temp1_input)" && break [[ -f "${hwmon}/temp2_input" ]] && TEMP="$(cat ${hwmon}/temp2_input)" && break ;; @@ -46,7 +46,7 @@ if [ "$1" = "cpu" -o "$TEMP" = "0" ]; then TEMP="$(cat /sys/class/hwmon/hwmon0/device/temp1_input)" fi - TEMP="$(( $TEMP / 1000 ))" + TEMP="$(($TEMP / 1000))" fi echo "${TEMP} C" diff --git a/projects/NXP/devices/iMX6/filesystem/usr/bin/rdu-network b/projects/NXP/devices/iMX6/filesystem/usr/bin/rdu-network index 2dc484b01a..9f9ff24d7a 100755 --- a/projects/NXP/devices/iMX6/filesystem/usr/bin/rdu-network +++ b/projects/NXP/devices/iMX6/filesystem/usr/bin/rdu-network @@ -13,105 +13,104 @@ USED_IFACES="" function log { - logger -t "${LOGGER_TAG}" "$@" + logger -t "${LOGGER_TAG}" "$@" } function logerr { - logger -t "${LOGGER_TAG}" -p "err" "$@" + logger -t "${LOGGER_TAG}" -p "err" "$@" } # Select setup based on model case "${MODEL}" in - "ZII RDU2+ Board" | "ZII RDU2 Board") - log "Loading RDU2 networking setup..." - IP_IFACE="eth1" - BR_NAME="br0" - BR_IFACES="netaux netleft netright gigabit_proc" - ALL_IFACES="eth0 ${IP_IFACE} ${BR_IFACES} ${BR_NAME}" - ;; - "ZII RDU1 Board") - log "Loading RDU1 networking setup..." - IP_IFACE="br0" - BR_NAME="br0" - BR_IFACES="netaux netleft netright" - ALL_IFACES="eth0 ${BR_NAME} ${BR_IFACES}" - ;; - *) - logerr "invalid hardware model detected: ${MODEL}" - exit 1 - ;; + "ZII RDU2+ Board" | "ZII RDU2 Board") + log "Loading RDU2 networking setup..." + IP_IFACE="eth1" + BR_NAME="br0" + BR_IFACES="netaux netleft netright gigabit_proc" + ALL_IFACES="eth0 ${IP_IFACE} ${BR_IFACES} ${BR_NAME}" + ;; + "ZII RDU1 Board") + log "Loading RDU1 networking setup..." + IP_IFACE="br0" + BR_NAME="br0" + BR_IFACES="netaux netleft netright" + ALL_IFACES="eth0 ${BR_NAME} ${BR_IFACES}" + ;; + *) + logerr "invalid hardware model detected: ${MODEL}" + exit 1 + ;; esac case "${ACTION}" in - "start") + "start") - # Assume RDU network is already started if the bridge is available - if [ -d /sys/class/net/${BR_NAME} ]; then - log "Networking setup is already started" - exit 0 - fi + # Assume RDU network is already started if the bridge is available + if [ -d /sys/class/net/${BR_NAME} ]; then + log "Networking setup is already started" + exit 0 + fi - # Cleanup all addresses from all interfaces and bring them down - log "Resetting interfaces..." - for IFACE in ${ALL_IFACES}; do - log " Resetting ${IFACE}..." - ip addr flush dev ${IFACE} >/dev/null 2>&1 - ip link set dev ${IFACE} down >/dev/null 2>&1 - done + # Cleanup all addresses from all interfaces and bring them down + log "Resetting interfaces..." + for IFACE in ${ALL_IFACES}; do + log " Resetting ${IFACE}..." + ip addr flush dev ${IFACE} >/dev/null 2>&1 + ip link set dev ${IFACE} down >/dev/null 2>&1 + done - # Create bridge with all interfaces - log "Creating bridge interface..." - brctl addbr ${BR_NAME} >/dev/null 2>&1 - for IFACE in ${BR_IFACES}; do - log " Adding ${IFACE} to bridge..." - brctl addif ${BR_NAME} ${IFACE} >/dev/null 2>&1 - done + # Create bridge with all interfaces + log "Creating bridge interface..." + brctl addbr ${BR_NAME} >/dev/null 2>&1 + for IFACE in ${BR_IFACES}; do + log " Adding ${IFACE} to bridge..." + brctl addif ${BR_NAME} ${IFACE} >/dev/null 2>&1 + done - # Bring all bridge interfaces and the bridge itself up - log "Bringing up all interfaces..." - for IFACE in ${ALL_IFACES}; do - log " Bringing up ${IFACE}..." - ip link set dev ${IFACE} up >/dev/null 2>&1 - done + # Bring all bridge interfaces and the bridge itself up + log "Bringing up all interfaces..." + for IFACE in ${ALL_IFACES}; do + log " Bringing up ${IFACE}..." + ip link set dev ${IFACE} up >/dev/null 2>&1 + done - # All done - log "RDU networking started" - exit 0 - ;; + # All done + log "RDU networking started" + exit 0 + ;; - "stop") + "stop") - # Assume RDU network is already stopped if the bridge is available - if [ ! -d /sys/class/net/${BR_NAME} ]; then - log "Networking setup is already stopped" - exit 0 - fi + # Assume RDU network is already stopped if the bridge is available + if [ ! -d /sys/class/net/${BR_NAME} ]; then + log "Networking setup is already stopped" + exit 0 + fi - # Cleanup all addresses from all interfaces and bring them down - log "Resetting interfaces..." - for IFACE in ${ALL_IFACES}; do - ip addr flush dev ${IFACE} >/dev/null 2>&1 - ip link set dev ${IFACE} down >/dev/null 2>&1 - done + # Cleanup all addresses from all interfaces and bring them down + log "Resetting interfaces..." + for IFACE in ${ALL_IFACES}; do + ip addr flush dev ${IFACE} >/dev/null 2>&1 + ip link set dev ${IFACE} down >/dev/null 2>&1 + done - # Remove bridge interfaces and bridge itself - log "Removing bridge interface..." - for IFACE in ${BR_IFACES}; do - brctl delif ${BR_NAME} ${IFACE} >/dev/null 2>&1 - done - brctl delbr ${BR_NAME} >/dev/null 2>&1 + # Remove bridge interfaces and bridge itself + log "Removing bridge interface..." + for IFACE in ${BR_IFACES}; do + brctl delif ${BR_NAME} ${IFACE} >/dev/null 2>&1 + done + brctl delbr ${BR_NAME} >/dev/null 2>&1 - # All done - log "RDU networking stopped" - exit 0 - ;; + # All done + log "RDU networking stopped" + exit 0 + ;; - *) - logerr "invalid action requested: ${ACTION}" - exit 2 - ;; + *) + logerr "invalid action requested: ${ACTION}" + exit 2 + ;; esac - diff --git a/projects/NXP/devices/iMX8/filesystem/usr/bin/cputemp b/projects/NXP/devices/iMX8/filesystem/usr/bin/cputemp index ba32390a43..8eec69c21e 100755 --- a/projects/NXP/devices/iMX8/filesystem/usr/bin/cputemp +++ b/projects/NXP/devices/iMX8/filesystem/usr/bin/cputemp @@ -4,4 +4,4 @@ # Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/NXP/devices/iMX8/filesystem/usr/bin/gputemp b/projects/NXP/devices/iMX8/filesystem/usr/bin/gputemp index a3d2f4f34e..c2f56a0e76 100755 --- a/projects/NXP/devices/iMX8/filesystem/usr/bin/gputemp +++ b/projects/NXP/devices/iMX8/filesystem/usr/bin/gputemp @@ -4,4 +4,4 @@ # Copyright (C) 2021-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone1/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Qualcomm/devices/Dragonboard/bootloader/update.sh b/projects/Qualcomm/devices/Dragonboard/bootloader/update.sh index 5fc9961e23..eba28ea271 100644 --- a/projects/Qualcomm/devices/Dragonboard/bootloader/update.sh +++ b/projects/Qualcomm/devices/Dragonboard/bootloader/update.sh @@ -16,17 +16,17 @@ if [ -z "$BOOT_DISK" ]; then fi # mount $BOOT_ROOT r/w - mount -o remount,rw $BOOT_ROOT +mount -o remount,rw $BOOT_ROOT # update Device Tree Blobs - for all_dtb in /flash/*.dtb; do - dtb=$(basename $all_dtb) - if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then - echo "*** updating Device Tree Blob: $dtb ..." - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT - fi - done +for all_dtb in /flash/*.dtb; do + dtb=$(basename $all_dtb) + if [ -f $SYSTEM_ROOT/usr/share/bootloader/$dtb ]; then + echo "*** updating Device Tree Blob: $dtb ..." + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT + fi +done # mount $BOOT_ROOT r/o - sync - mount -o remount,ro $BOOT_ROOT +sync +mount -o remount,ro $BOOT_ROOT diff --git a/projects/RPi/filesystem/usr/bin/cputemp b/projects/RPi/filesystem/usr/bin/cputemp index 11535271c5..33e4d3d5ff 100755 --- a/projects/RPi/filesystem/usr/bin/cputemp +++ b/projects/RPi/filesystem/usr/bin/cputemp @@ -5,4 +5,4 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/RPi/packages/systemd/scripts/cpufreq b/projects/RPi/packages/systemd/scripts/cpufreq index 8fb2b3976a..0c402a9b17 100755 --- a/projects/RPi/packages/systemd/scripts/cpufreq +++ b/projects/RPi/packages/systemd/scripts/cpufreq @@ -4,15 +4,15 @@ # 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_ONDEMAND_DIR="/sys/devices/system/cpu/cpufreq/ondemand/" # Configure frequency scaling properties if [ "${SYS_CPUFREQ_GOV}" = "ondemand" ]; then - echo 1 > "${SYS_ONDEMAND_DIR}/io_is_busy" - echo 50 > "${SYS_ONDEMAND_DIR}/up_threshold" - echo 100000 > "${SYS_ONDEMAND_DIR}/sampling_rate" - echo 50 > "${SYS_ONDEMAND_DIR}/sampling_down_factor" + echo 1 >"${SYS_ONDEMAND_DIR}/io_is_busy" + echo 50 >"${SYS_ONDEMAND_DIR}/up_threshold" + echo 100000 >"${SYS_ONDEMAND_DIR}/sampling_rate" + echo 50 >"${SYS_ONDEMAND_DIR}/sampling_down_factor" else echo "cpufreq: settings not found for current cpu governor." | systemd-cat -p info fi diff --git a/projects/Rockchip/devices/RK3288/filesystem/usr/bin/cputemp b/projects/Rockchip/devices/RK3288/filesystem/usr/bin/cputemp index 11535271c5..33e4d3d5ff 100755 --- a/projects/Rockchip/devices/RK3288/filesystem/usr/bin/cputemp +++ b/projects/Rockchip/devices/RK3288/filesystem/usr/bin/cputemp @@ -5,4 +5,4 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Rockchip/devices/RK3288/filesystem/usr/bin/gputemp b/projects/Rockchip/devices/RK3288/filesystem/usr/bin/gputemp index 73d0115961..99794b412a 100755 --- a/projects/Rockchip/devices/RK3288/filesystem/usr/bin/gputemp +++ b/projects/Rockchip/devices/RK3288/filesystem/usr/bin/gputemp @@ -5,4 +5,4 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone1/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Rockchip/filesystem/usr/bin/cputemp b/projects/Rockchip/filesystem/usr/bin/cputemp index 11535271c5..33e4d3d5ff 100755 --- a/projects/Rockchip/filesystem/usr/bin/cputemp +++ b/projects/Rockchip/filesystem/usr/bin/cputemp @@ -5,4 +5,4 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)" -echo "$(( $TEMP / 1000 )) C" +echo "$(($TEMP / 1000)) C" diff --git a/projects/Rockchip/packages/systemd/scripts/cpufreq b/projects/Rockchip/packages/systemd/scripts/cpufreq index 940e090a58..9afa1b1b06 100755 --- a/projects/Rockchip/packages/systemd/scripts/cpufreq +++ b/projects/Rockchip/packages/systemd/scripts/cpufreq @@ -8,16 +8,16 @@ SYS_CPUFREQ_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) if [ "${SYS_CPUFREQ_GOV}" = "ondemand" ]; then for io_is_busy in $(find /sys/devices/system/cpu -name io_is_busy); do - echo 1 > "${io_is_busy}" + echo 1 >"${io_is_busy}" done for up_threshold in $(find /sys/devices/system/cpu -name up_threshold); do - echo 50 > "${up_threshold}" + echo 50 >"${up_threshold}" done for sampling_rate in $(find /sys/devices/system/cpu -name sampling_rate); do - echo 100000 > "${sampling_rate}" + echo 100000 >"${sampling_rate}" done for sampling_down_factor in $(find /sys/devices/system/cpu -name sampling_down_factor); do - echo 50 > "${sampling_down_factor}" + echo 50 >"${sampling_down_factor}" done else echo "cpufreq: settings not found for current cpu governor." | systemd-cat -p info diff --git a/projects/Samsung/bootloader/update.sh b/projects/Samsung/bootloader/update.sh index e61ff3ef0f..80f88bea56 100644 --- a/projects/Samsung/bootloader/update.sh +++ b/projects/Samsung/bootloader/update.sh @@ -8,29 +8,29 @@ [ -z "$BOOT_PART" ] && BOOT_PART=$(df "$BOOT_ROOT" | tail -1 | awk {' print $1 '}) # identify the boot device - if [ -z "$BOOT_DISK" ]; then - case $BOOT_PART in - /dev/sd[a-z][0-9]*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") - ;; - /dev/mmcblk*) - BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") - ;; - esac - fi +if [ -z "$BOOT_DISK" ]; then + case $BOOT_PART in + /dev/sd[a-z][0-9]*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,[0-9]*,,g") + ;; + /dev/mmcblk*) + BOOT_DISK=$(echo $BOOT_PART | sed -e "s,p[0-9]*,,g") + ;; + esac +fi # mount $BOOT_ROOT rw - mount -o remount,rw $BOOT_ROOT +mount -o remount,rw $BOOT_ROOT # update extlinux device trees - if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then - for dtbfile in $BOOT_ROOT/*.dtb ; do - dtb=$(basename $dtbfile) - echo "Updating $dtb" - cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/ 2>/dev/null || true - done - fi +if [ -f $BOOT_ROOT/extlinux/extlinux.conf ]; then + for dtbfile in $BOOT_ROOT/*.dtb; do + dtb=$(basename $dtbfile) + echo "Updating $dtb" + cp -p $SYSTEM_ROOT/usr/share/bootloader/$dtb $BOOT_ROOT/ 2>/dev/null || true + done +fi # mount $BOOT_ROOT ro - sync - mount -o remount,ro $BOOT_ROOT +sync +mount -o remount,ro $BOOT_ROOT diff --git a/projects/Samsung/filesystem/usr/bin/cputemp b/projects/Samsung/filesystem/usr/bin/cputemp index 5275e17be5..60e91cb63b 100755 --- a/projects/Samsung/filesystem/usr/bin/cputemp +++ b/projects/Samsung/filesystem/usr/bin/cputemp @@ -5,5 +5,5 @@ # XU4 has 5x sensors so read them all and report the highest value TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone*/temp | sort -n | tail -1) -TEMP="$(( $TEMP / 1000 ))" +TEMP="$(($TEMP / 1000))" echo "${TEMP} C" diff --git a/scripts/autoreconf b/scripts/autoreconf index 66413841e0..2fad4e9ecf 100755 --- a/scripts/autoreconf +++ b/scripts/autoreconf @@ -9,7 +9,7 @@ RECONF_DIR="${3}" if [ ! -f "${RECONF_DIR}/configure.in" \ - -a ! -f "${RECONF_DIR}/configure.ac" ]; then + -a ! -f "${RECONF_DIR}/configure.ac" ]; then die "configure.in or configure.ac not found" fi diff --git a/scripts/build b/scripts/build index 98d6e9c612..fc46b8c81d 100755 --- a/scripts/build +++ b/scripts/build @@ -60,10 +60,18 @@ ${SCRIPTS}/unpack "${PKG_NAME}" "${PARENT_PKG}" # build dependencies, only when PKG_DEPENDS_? is filled unset _pkg_depends case "${TARGET}" in - "target") _pkg_depends="${PKG_DEPENDS_TARGET}";; - "host") _pkg_depends="${PKG_DEPENDS_HOST}";; - "init") _pkg_depends="${PKG_DEPENDS_INIT}";; - "bootstrap") _pkg_depends="${PKG_DEPENDS_BOOTSTRAP}";; + "target") + _pkg_depends="${PKG_DEPENDS_TARGET}" + ;; + "host") + _pkg_depends="${PKG_DEPENDS_HOST}" + ;; + "init") + _pkg_depends="${PKG_DEPENDS_INIT}" + ;; + "bootstrap") + _pkg_depends="${PKG_DEPENDS_BOOTSTRAP}" + ;; esac if is_sequential_build; then @@ -76,7 +84,7 @@ fi if [ "${PKG_SECTION}" = "virtual" ]; then PKG_DEEPHASH=$(calculate_stamp) for i in PKG_NAME PKG_DEEPHASH BUILD_WITH_DEBUG; do - echo "STAMP_${i}=\"${!i}\"" >> ${STAMP} + echo "STAMP_${i}=\"${!i}\"" >>${STAMP} done pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "build" "built" @@ -171,7 +179,6 @@ if [ "${BUILD_WITH_DEBUG}" != "yes" ] && flag_enabled "strip" "yes"; then TARGET_MESON_OPTS+=" -Dstrip=true" fi - # configure HOST build defaults HOST_CONFIGURE_OPTS="--host=${HOST_NAME} \ --build=${HOST_NAME} \ @@ -227,9 +234,15 @@ cd "${PKG_BUILD}" if [ -f "${PKG_CONFIGURE_SCRIPT}" -o -f "${PKG_CMAKE_SCRIPT}" -o -f "${PKG_MESON_SCRIPT}" ]; then case "${TARGET}" in - "target") PKG_REAL_BUILD="${PKG_BUILD}/.${TARGET_NAME}" ;; - "host") PKG_REAL_BUILD="${PKG_BUILD}/.${HOST_NAME}" ;; - "init") PKG_REAL_BUILD="${PKG_BUILD}/.${TARGET_NAME}-${TARGET}" ;; + "target") + PKG_REAL_BUILD="${PKG_BUILD}/.${TARGET_NAME}" + ;; + "host") + PKG_REAL_BUILD="${PKG_BUILD}/.${HOST_NAME}" + ;; + "init") + PKG_REAL_BUILD="${PKG_BUILD}/.${TARGET_NAME}-${TARGET}" + ;; "bootstrap") PKG_REAL_BUILD="${PKG_BUILD}/.${HOST_NAME}-${TARGET}" ;; esac mkdir -p "${PKG_REAL_BUILD}" @@ -241,13 +254,13 @@ fi # create wrapper scripts in build dir and use them for CC/CXX when # building for host and local-cc build flag is set if [ "${TARGET}" = "host" ] && flag_enabled "local-cc" "no"; then - cat > libreelec-local-cc << EOF + cat >libreelec-local-cc < libreelec-local-cxx << EOF + cat >libreelec-local-cxx </dev/null || : + -o -name "*.rej" \ + -o -name "*.in" \ + -o -name ".git*" \) \ + -exec rm -f {} \; 2>/dev/null || : find ${INSTALL} -type d -exec rmdir -p {} \; 2>/dev/null || : python_fix_abi "${INSTALL}" @@ -532,24 +545,24 @@ if [ "${TARGET}" = "target" -o "${TARGET}" = "init" ]; then ! -name "libpthread-*.so" \ ! -name "libthread_db-*so" \ 2>/dev/null) 2>/dev/null || : - if [ "${TARGET}" = "init" ]; then - ${STRIP} $(find ${INSTALL} -type f -name "*.so*" 2>/dev/null) 2>/dev/null || : - fi - ${STRIP} $(find ${INSTALL} ! -name "*.so*" ! -name "*.ko" \ - -type f -executable 2>/dev/null) 2>/dev/null || : + if [ "${TARGET}" = "init" ]; then + ${STRIP} $(find ${INSTALL} -type f -name "*.so*" 2>/dev/null) 2>/dev/null || : + fi + ${STRIP} $(find ${INSTALL} ! -name "*.so*" ! -name "*.ko" \ + -type f -executable 2>/dev/null) 2>/dev/null || : fi fi fi if [ -n "${INSTALL}" -a -d "${INSTALL}" ]; then - echo "INFO_PKG_NAME=\"${PKG_NAME}\"" > "${INSTALL}/.libreelec-package" + echo "INFO_PKG_NAME=\"${PKG_NAME}\"" >"${INSTALL}/.libreelec-package" fi cd ${ROOT} PKG_DEEPHASH=$(calculate_stamp) for i in PKG_NAME PKG_DEEPHASH BUILD_WITH_DEBUG; do - echo "STAMP_${i}=\"${!i}\"" >> ${STAMP} + echo "STAMP_${i}=\"${!i}\"" >>${STAMP} done pkg_lock_status "UNLOCK" "${PKG_NAME}:${TARGET}" "build" "built" @@ -559,7 +572,7 @@ record_timestamp BUILD_END if [ -n "${TRACE_BUILD_TIMING}" ]; then ( print_color "CLR_AUTOREMOVE" "\nBuild timing details:" - print_color "CLR_TARGET" "\n================================\n" + print_color "CLR_TARGET" "\n================================\n" show_timestamp_diff "unpack" BUILD_BEGIN BUILD_START show_timestamp_diff "pre-build setup" BUILD_START BUILD_CONFIGURE show_timestamp_diff "configure" BUILD_CONFIGURE BUILD_MAKE @@ -567,7 +580,7 @@ if [ -n "${TRACE_BUILD_TIMING}" ]; then show_timestamp_diff "make install" BUILD_MAKEINSTALL BUILD_COPY_SYSROOT show_timestamp_diff "copy sysroot" BUILD_COPY_SYSROOT BUILD_CLEANUP_INSTALL show_timestamp_diff "cleanup install" BUILD_CLEANUP_INSTALL BUILD_END - print_color "CLR_TARGET" "--------------------------------\n" + print_color "CLR_TARGET" "--------------------------------\n" show_timestamp_diff "total time" BUILD_BEGIN BUILD_END echo -e ) >&${VERBOSE_OUT} diff --git a/scripts/build_mt b/scripts/build_mt index d7b35168df..4d78307ff4 100755 --- a/scripts/build_mt +++ b/scripts/build_mt @@ -10,7 +10,7 @@ ${SCRIPTS}/checkdeps # Setup both toolchain cmake configs to avoid potentially racy behaviour later. # Use a fork for host to isolate any variable modifications. -( setup_toolchain host ) +(setup_toolchain host) setup_toolchain target MTADDONBUILD=no start_multithread_build ${@} diff --git a/scripts/clean b/scripts/clean index de9a62941b..3418483ba2 100755 --- a/scripts/clean +++ b/scripts/clean @@ -16,8 +16,8 @@ clean_package() { # Use a wildcard here to remove all versions of the package for i in "${BUILD}/build/${1}-"* \ - "${BUILD}/install_pkg/${1}-"* \ - "${BUILD}/install_init/${1}-"*; do + "${BUILD}/install_pkg/${1}-"* \ + "${BUILD}/install_init/${1}-"*; do if [ -d "${i}" -a -f "${i}/.libreelec-unpack" ]; then . "${i}/.libreelec-unpack" if [ "${STAMP_PKG_NAME}" = "${1}" ]; then @@ -49,4 +49,3 @@ if [ "${1}" = "--all" -a -n "${2}" ]; then elif [ -n "${1}" ]; then clean_package "${1}" fi - diff --git a/scripts/create_addon b/scripts/create_addon index 4961f0cd9d..e8483c7396 100755 --- a/scripts/create_addon +++ b/scripts/create_addon @@ -51,10 +51,19 @@ get_addons() { local count=0 validpkg case ${1} in - binary) paths="^${ROOT}/packages/mediacenter/kodi-binary-addons/";; - official) paths="^${ROOT}/packages/addons/";; - all) paths="^${ROOT}/packages/|^${ROOT}/projects/.*/packages/";; - *) paths="^${ROOT}/packages/|^${ROOT}/projects/.*/packages/"; filter="${1}";; + binary) + paths="^${ROOT}/packages/mediacenter/kodi-binary-addons/" + ;; + official) + paths="^${ROOT}/packages/addons/" + ;; + all) + paths="^${ROOT}/packages/|^${ROOT}/projects/.*/packages/" + ;; + *) + paths="^${ROOT}/packages/|^${ROOT}/projects/.*/packages/" + filter="${1}" + ;; esac exit() { exited=1; } @@ -90,8 +99,8 @@ get_addons() { unset -f exit if [ ${count} -eq 0 -a -n "${filter}" ]; then - echo "$(print_color CLR_ERROR "ERROR: no addons matched for filter ${filter}")" >&2 - echo "For more information type: ./scripts/create_addon --help" >&2 + echo "$(print_color CLR_ERROR "ERROR: no addons matched for filter ${filter}")" >&2 + echo "For more information type: ./scripts/create_addon --help" >&2 die fi } @@ -110,13 +119,13 @@ verify_addon() { VERIFY_FAIL="Incompatible project or device: \"${_DEVICE:-${PROJECT}}\" not in [ ${PKG_ADDON_PROJECTS} ]" if listcontains "${PKG_ADDON_PROJECTS}" "!${_DEVICE:-${PROJECT}}" || - listcontains "${PKG_ADDON_PROJECTS}" "!${PROJECT}"; then + listcontains "${PKG_ADDON_PROJECTS}" "!${PROJECT}"; then return 1 fi if ! listcontains "${PKG_ADDON_PROJECTS}" "${_DEVICE:-${PROJECT}}" && - ! listcontains "${PKG_ADDON_PROJECTS}" "${PROJECT}" && - ! listcontains "${PKG_ADDON_PROJECTS}" "any"; then + ! listcontains "${PKG_ADDON_PROJECTS}" "${PROJECT}" && + ! listcontains "${PKG_ADDON_PROJECTS}" "any"; then return 1 fi fi @@ -132,7 +141,7 @@ fi # check environment and configure toolchains ${SCRIPTS}/checkdeps -( setup_toolchain host ) +(setup_toolchain host) setup_toolchain target # collect list of addons for building @@ -143,11 +152,21 @@ show_only="no" # read addons from parameter list while [ $# -gt 0 ]; do case ${1} in - --help) usage 0;; - --show-only) show_only="yes";; - --*) usage 1;; - -*) addons_drop+=" $(get_addons ${1:1})";; - *) addons+=" $(get_addons ${1})";; + --help) + usage 0 + ;; + --show-only) + show_only="yes" + ;; + --*) + usage 1 + ;; + -*) + addons_drop+=" $(get_addons ${1:1})" + ;; + *) + addons+=" $(get_addons ${1})" + ;; esac shift done @@ -181,7 +200,7 @@ elif [ -f "${THREAD_CONTROL}/addons.failed" ]; then echo " $(print_color CLR_ERROR "${addon}")" >&2 fi fi - done < "${THREAD_CONTROL}/addons.failed" + done <"${THREAD_CONTROL}/addons.failed" die else die "$(print_color CLR_ERROR "UNKNOWN BUILD FAILURE OR INABILITY TO GENERATE PLAN")" diff --git a/scripts/extract b/scripts/extract index fa4552b542..02d753f56e 100755 --- a/scripts/extract +++ b/scripts/extract @@ -63,7 +63,7 @@ case "${PKG_SOURCE_NAME}" in unzip -o -q "${FULL_SOURCE_PATH}" -d "${2}" ;; *.diff | *.patch) - patch -d "${2}" -p1 < "${FULL_SOURCE_PATH}" + patch -d "${2}" -p1 <"${FULL_SOURCE_PATH}" ;; *.diff.bz2 | *.patch.bz2 | patch-*.bz2) bzcat "${FULL_SOURCE_PATH}" | patch -d "${2}" -p1 diff --git a/scripts/get b/scripts/get index ee51aca4e5..3cf3cd2bb4 100755 --- a/scripts/get +++ b/scripts/get @@ -31,12 +31,15 @@ if [ -n "${PKG_URL}" -a -n "${PKG_SOURCE_NAME}" ]; then # determine get handler based on protocol and/or filename case "${PKG_URL}" in - git://*|*.git) - get_handler="git";; + git://* | *.git) + get_handler="git" + ;; file://*) - get_handler="file";; + get_handler="file" + ;; *) - get_handler="archive";; + get_handler="archive" + ;; esac if ! listcontains "${GET_HANDLER_SUPPORT}" "${get_handler}"; then diff --git a/scripts/image b/scripts/image index 3d6c6d1b44..a4caaf0ee6 100755 --- a/scripts/image +++ b/scripts/image @@ -23,7 +23,7 @@ ${SCRIPTS}/checkdeps # Setup both toolchain cmake configs to avoid potentially racy behaviour later. # Use a fork for host to isolate any variable modifications. -( setup_toolchain host ) +(setup_toolchain host) setup_toolchain target show_config @@ -68,11 +68,21 @@ if [ "${LIBREELEC_VERSION}" = "devel" ]; then GIT_ABBREV=${GIT_HASH:0:7} DEVEL_VERSION=${LIBREELEC_VERSION} case "${BUILD_PERIODIC}" in - nightly) LIBREELEC_VERSION=nightly-$(date +%Y%m%d)-${GIT_ABBREV};; - daily) LIBREELEC_VERSION=daily-$(date +%Y%j)-${GIT_ABBREV};; - weekly) LIBREELEC_VERSION=weekly-$(date +%G%V)-${GIT_ABBREV};; - monthly) LIBREELEC_VERSION=monthly-$(date +%Y%m)-${GIT_ABBREV};; - *) LIBREELEC_VERSION=devel-$(date +%Y%m%d%H%M%S)-${GIT_ABBREV};; + nightly) + LIBREELEC_VERSION=nightly-$(date +%Y%m%d)-${GIT_ABBREV} + ;; + daily) + LIBREELEC_VERSION=daily-$(date +%Y%j)-${GIT_ABBREV} + ;; + weekly) + LIBREELEC_VERSION=weekly-$(date +%G%V)-${GIT_ABBREV} + ;; + monthly) + LIBREELEC_VERSION=monthly-$(date +%Y%m)-${GIT_ABBREV} + ;; + *) + LIBREELEC_VERSION=devel-$(date +%Y%m%d%H%M%S)-${GIT_ABBREV} + ;; esac fi @@ -115,13 +125,13 @@ if [ -n "${IMAGE_SUFFIX}" ]; then IMAGE_NAME="${IMAGE_NAME}-${IMAGE_SUFFIX}" fi -echo "${IMAGE_NAME}" > ${BUILD}/BUILD_FILENAME +echo "${IMAGE_NAME}" >${BUILD}/BUILD_FILENAME # Setup fakeroot rm -rf ${FAKEROOT_SCRIPT} # remove ${FAKEROOT_SCRIPT} if it exist touch ${FAKEROOT_SCRIPT} # create an empty ${FAKEROOT_SCRIPT} chmod +x ${FAKEROOT_SCRIPT} # make ${FAKEROOT_SCRIPT} executable -echo "chown -R 0:0 ${INSTALL}" >> ${FAKEROOT_SCRIPT} +echo "chown -R 0:0 ${INSTALL}" >>${FAKEROOT_SCRIPT} # Clean old install dirs rm -rf ${BUILD}/qa_checks/general @@ -151,7 +161,7 @@ if [ "${TARGET_ARCH}" = "x86_64" ]; then ln -sfn /usr/lib ${INSTALL}/usr/lib64 fi -echo "${TARGET_VERSION}" > ${INSTALL}/etc/release +echo "${TARGET_VERSION}" >${INSTALL}/etc/release # Create /etc/os-release cat <${INSTALL}/etc/os-release @@ -167,9 +177,9 @@ LIBREELEC_ARCH="${LIBREELEC_ARCH}" LIBREELEC_BUILD="${LIBREELEC_BUILD}" LIBREELEC_PROJECT="${PROJECT}" EOF -[ -n "${DEVICE}" ] && echo "LIBREELEC_DEVICE=\"${DEVICE}\"" >> ${INSTALL}/etc/os-release -[ -n "${BUILDER_NAME}" ] && echo "BUILDER_NAME=\"${BUILDER_NAME}\"" >> ${INSTALL}/etc/os-release -[ -n "${BUILDER_VERSION}" ] && echo "BUILDER_VERSION=\"${BUILDER_VERSION}\"" >> ${INSTALL}/etc/os-release +[ -n "${DEVICE}" ] && echo "LIBREELEC_DEVICE=\"${DEVICE}\"" >>${INSTALL}/etc/os-release +[ -n "${BUILDER_NAME}" ] && echo "BUILDER_NAME=\"${BUILDER_NAME}\"" >>${INSTALL}/etc/os-release +[ -n "${BUILDER_VERSION}" ] && echo "BUILDER_VERSION=\"${BUILDER_VERSION}\"" >>${INSTALL}/etc/os-release # Create /etc/issue cat <${INSTALL}/etc/issue @@ -208,16 +218,16 @@ fi # Replace placeholders with values in install script to eMMC if [ -f ${INSTALL}/usr/bin/install2emmc ]; then sed -e "s%@SYSTEM_SIZE@%${SYSTEM_SIZE}%g" \ - -i ${INSTALL}/usr/bin/install2emmc + -i ${INSTALL}/usr/bin/install2emmc sed -e "s%@DISTRONAME@%${DISTRONAME}%g" \ - -i ${INSTALL}/usr/bin/install2emmc + -i ${INSTALL}/usr/bin/install2emmc fi # Run depmod for base overlay modules MODVER=$(basename $(ls -d ${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/*)) -find ${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/${MODVER}/ -name *.ko | \ +find ${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/${MODVER}/ -name *.ko | sed -e "s,${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/${MODVER}/,," \ - > ${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/${MODVER}/modules.order + >${INSTALL}/usr/lib/kernel-overlays/base/lib/modules/${MODVER}/modules.order ${TOOLCHAIN}/bin/depmod -b ${INSTALL}/usr/lib/kernel-overlays/base -a -e -F "$(get_install_dir linux)/.image/System.map" ${MODVER} 2>&1 # Strip kernel modules @@ -251,8 +261,8 @@ if [ -z "${SQUASHFS_COMPRESSION_OPTION}" ]; then fi # Create squashfs file, default to gzip if no compression configured -echo "rm -rf \"${TARGET_IMG}/${IMAGE_NAME}.system\"" >> ${FAKEROOT_SCRIPT} -echo "${TOOLCHAIN}/bin/mksquashfs \"${BUILD}/image/system\" \"${TARGET_IMG}/${IMAGE_NAME}.system\" -noappend -comp ${SQUASHFS_COMPRESSION:-gzip} ${SQUASHFS_COMPRESSION_OPTION}" >> ${FAKEROOT_SCRIPT} +echo "rm -rf \"${TARGET_IMG}/${IMAGE_NAME}.system\"" >>${FAKEROOT_SCRIPT} +echo "${TOOLCHAIN}/bin/mksquashfs \"${BUILD}/image/system\" \"${TARGET_IMG}/${IMAGE_NAME}.system\" -noappend -comp ${SQUASHFS_COMPRESSION:-gzip} ${SQUASHFS_COMPRESSION_OPTION}" >>${FAKEROOT_SCRIPT} # Run fakeroot ${TOOLCHAIN}/bin/fakeroot -- ${FAKEROOT_SCRIPT} @@ -290,10 +300,10 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then cp ${ROOT}/README* ${RELEASE_DIR} cp ${ROOT}/CHANGELOG* ${RELEASE_DIR} - echo "${TARGET_VERSION}" > ${RELEASE_DIR}/RELEASE + echo "${TARGET_VERSION}" >${RELEASE_DIR}/RELEASE if [ ! "${MEDIACENTER}" = "no" ]; then - echo "Kodi commit: $(get_pkg_version ${MEDIACENTER})" >> ${RELEASE_DIR}/RELEASE + echo "Kodi commit: $(get_pkg_version ${MEDIACENTER})" >>${RELEASE_DIR}/RELEASE fi mkdir -p ${RELEASE_DIR}/licenses @@ -304,9 +314,10 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then cp ${TARGET_IMG}/${IMAGE_NAME}.kernel ${RELEASE_DIR}/target/KERNEL # Create md5sum's - ( cd ${RELEASE_DIR}; - md5sum -t target/SYSTEM > target/SYSTEM.md5; - md5sum -t target/KERNEL > target/KERNEL.md5; + ( + cd ${RELEASE_DIR} + md5sum -t target/SYSTEM >target/SYSTEM.md5 + md5sum -t target/KERNEL >target/KERNEL.md5 ) # Create target directory @@ -319,12 +330,13 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then tar cf ${TARGET_IMG}/${IMAGE_NAME}.tar -C target ${IMAGE_NAME} # Create sha256 checksum of tarball - ( cd ${TARGET_IMG} - sha256sum ${IMAGE_NAME}.tar > ${IMAGE_NAME}.tar.sha256 + ( + cd ${TARGET_IMG} + sha256sum ${IMAGE_NAME}.tar >${IMAGE_NAME}.tar.sha256 ) # Create image files if requested - if [[ ( "${1}" = "noobs" || "${1}" = "mkimage" ) && -n "${BOOTLOADER}" ]]; then + if [[ ("${1}" = "noobs" || "${1}" = "mkimage") && -n "${BOOTLOADER}" ]]; then UUID_SYSTEM="$(date '+%d%m')-$(date '+%M%S')" UUID_STORAGE="$(uuidgen)" @@ -386,42 +398,42 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then if [ -n "${NOOBS_HEX}" ]; then sed -e "s%@NOOBS_HEX@%${NOOBS_HEX}%g" \ - -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json + -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json else sed -e "/@NOOBS_HEX@/d" \ - -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json + -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json fi sed -e "s%@DISTRONAME@%${DISTRONAME}%g" \ - -e "s%@PROJECT@%${DEVICE:-${PROJECT}}%g" \ - -e "s%@LIBREELEC_VERSION@%${LIBREELEC_VERSION}%g" \ - -e "s%@RELEASE_DATE@%$(date +%F)%g" \ - -e "s%@KERNEL_VERSION@%$(kernel_version)%g" \ - -e "s%@DESCRIPTION@%${DESCRIPTION}%g" \ - -e "s%@ROOT_PASSWORD@%${ROOT_PASSWORD}%g" \ - -e "s%@NOOBS_SUPPORTED_MODELS@%${NOOBS_SUPPORTED_MODELS}%g" \ - -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json + -e "s%@PROJECT@%${DEVICE:-${PROJECT}}%g" \ + -e "s%@LIBREELEC_VERSION@%${LIBREELEC_VERSION}%g" \ + -e "s%@RELEASE_DATE@%$(date +%F)%g" \ + -e "s%@KERNEL_VERSION@%$(kernel_version)%g" \ + -e "s%@DESCRIPTION@%${DESCRIPTION}%g" \ + -e "s%@ROOT_PASSWORD@%${ROOT_PASSWORD}%g" \ + -e "s%@NOOBS_SUPPORTED_MODELS@%${NOOBS_SUPPORTED_MODELS}%g" \ + -i ${RELEASE_DIR}/${NOOBS_DISTRO}/os.json sed -e "s%@DISTRONAME@%${DISTRONAME}%g" \ - -e "s%@PROJECT@%${DEVICE:-${PROJECT}}%g" \ - -e "s%@SYSTEM_SIZE@%${SYSTEM_SIZE}%g" \ - -i ${RELEASE_DIR}/${NOOBS_DISTRO}/partitions.json + -e "s%@PROJECT@%${DEVICE:-${PROJECT}}%g" \ + -e "s%@SYSTEM_SIZE@%${SYSTEM_SIZE}%g" \ + -i ${RELEASE_DIR}/${NOOBS_DISTRO}/partitions.json sed -e "s%@EXTRA_CMDLINE@%${EXTRA_CMDLINE}%g" \ - -i ${RELEASE_DIR}/${NOOBS_DISTRO}/partition_setup.sh + -i ${RELEASE_DIR}/${NOOBS_DISTRO}/partition_setup.sh # Create System dir mkdir -p ${RELEASE_DIR}/${NOOBS_DISTRO}/System # Copy Bootloader cp -PR ${INSTALL}/usr/share/bootloader/config.txt ${RELEASE_DIR}/${NOOBS_DISTRO}/System/ - for distro in "${INSTALL}/usr/share/bootloader/distroconfig"*.txt ; do + for distro in "${INSTALL}/usr/share/bootloader/distroconfig"*.txt; do if [ -f "${distro}" ]; then cp -PR "${distro}" ${RELEASE_DIR}/${NOOBS_DISTRO}/System/ fi done cp -PR ${INSTALL}/usr/share/bootloader/LICENCE* ${RELEASE_DIR}/${NOOBS_DISTRO}/System/ - for f in bootcode.bin fixup.dat start.elf ; do + 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}/${NOOBS_DISTRO}/System/" fi @@ -445,9 +457,10 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then done # Create md5sum's - ( cd ${RELEASE_DIR}/${NOOBS_DISTRO}/System; - md5sum -t SYSTEM > SYSTEM.md5; - md5sum -t kernel.img > kernel.img.md5; + ( + cd ${RELEASE_DIR}/${NOOBS_DISTRO}/System + md5sum -t SYSTEM >SYSTEM.md5 + md5sum -t kernel.img >kernel.img.md5 ) # Copy additional files @@ -476,8 +489,9 @@ if [ "${1}" = "release" -o "${1}" = "mkimage" -o "${1}" = "noobs" ]; then tar cf ${TARGET_IMG}/${IMAGE_NAME}-${1}.tar -C ${TARGET_IMG} ${IMAGE_NAME}-${1} # Create sha256 checksum of tarball - ( cd ${TARGET_IMG} - sha256sum ${IMAGE_NAME}-${1}.tar > ${IMAGE_NAME}-${1}.tar.sha256 + ( + cd ${TARGET_IMG} + sha256sum ${IMAGE_NAME}-${1}.tar >${IMAGE_NAME}-${1}.tar.sha256 ) fi @@ -490,4 +504,3 @@ fi if [ -n "$(ls -1 ${BUILD}/qa_checks/ 2>/dev/null)" ]; then log_qa_check "qa_issues" "QA issues present, please fix!\n$(find ${BUILD}/qa_checks/* -type f ! -name qa_issues)\n" fi - diff --git a/scripts/install b/scripts/install index 0a92c55571..629653d2ff 100755 --- a/scripts/install +++ b/scripts/install @@ -15,7 +15,7 @@ if [ -z "${PKG_NAME}" ]; then die "$(print_color CLR_ERROR "${1}: no package.mk file found")" fi -if [ -z "${INSTALL}" ] ; then +if [ -z "${INSTALL}" ]; then die "error: '\${INSTALL}' not set! this script is not intended to be run manually" fi @@ -46,17 +46,17 @@ mkdir -p ${STAMPS_INSTALL}/${PKG_NAME} ${SCRIPTS}/build "${1}" "${PARENT_PKG}" if is_sequential_build || [ "${PARENT_PKG}" = "initramfs:target" ]; then - if [ "${TARGET}" = "target" ] ; then + if [ "${TARGET}" = "target" ]; then for p in ${PKG_DEPENDS_TARGET}; do ${SCRIPTS}/install "${p}" "${PARENT_PKG}" done - elif [ "${TARGET}" = "init" ] ; then + elif [ "${TARGET}" = "init" ]; then for p in ${PKG_DEPENDS_INIT}; do ${SCRIPTS}/install "${p}" "${PARENT_PKG}" done fi fi -if [ "${TARGET}" = "init" ] ; then +if [ "${TARGET}" = "init" ]; then INSTALL=${BUILD}/initramfs fi @@ -70,11 +70,10 @@ acquire_update_lock image mkdir -p ${INSTALL} -if [ "${TARGET}" = "target" ] ; then +if [ "${TARGET}" = "target" ]; then for PKG_TMP_DIR in ${PKG_DIR} \ - ${PROJECT_DIR}/${PROJECT}/packages/${PKG_NAME} \ - ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/${PKG_NAME} \ - ; do + ${PROJECT_DIR}/${PROJECT}/packages/${PKG_NAME} \ + ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/packages/${PKG_NAME}; do [ -d ${PKG_TMP_DIR} ] || continue @@ -141,7 +140,7 @@ if [ "${TARGET}" = "target" ] ; then fi # install -if [ "${TARGET}" = "target" ] ; then +if [ "${TARGET}" = "target" ]; then pkg_call_exists_opt pre_install && pkg_call fi @@ -169,7 +168,7 @@ if [ -n "${PKG_INSTALL}" -a -d "${PKG_INSTALL}" ]; then -cf - . | tar -C "${INSTALL}" -xf - fi -if [ "${TARGET}" = "target" ] ; then +if [ "${TARGET}" = "target" ]; then pkg_call_exists_opt post_install && pkg_call fi diff --git a/scripts/install_addon b/scripts/install_addon index 9cdcd311cf..c49e11df02 100755 --- a/scripts/install_addon +++ b/scripts/install_addon @@ -80,8 +80,9 @@ if [ "${ADDON_JENKINS}" = "yes" ]; then mkdir -p "${ADDON_JENKINS_DIR}" cd ${ADDON_INSTALL_DIR} ${TOOLCHAIN}/bin/7za a -mx0 -bsp0 -bso0 -tzip ${ADDON_JENKINS_DIR}/${ADDON_JENKINS_ADDON_NAME}.zip ${PKG_ADDON_ID}-${ADDONVER}.zip resources/ - ( cd ${ADDON_JENKINS_DIR} - sha256sum ${ADDON_JENKINS_ADDON_NAME}.zip > ${ADDON_JENKINS_ADDON_NAME}.zip.sha256 + ( + cd ${ADDON_JENKINS_DIR} + sha256sum ${ADDON_JENKINS_ADDON_NAME}.zip >${ADDON_JENKINS_ADDON_NAME}.zip.sha256 ) build_msg "CLR_INFO" "*** creating ${ADDON_JENKINS_ADDON_NAME}.zip for Jenkins complete ***" else diff --git a/scripts/makefile_helper b/scripts/makefile_helper index 1cfbe06fee..019a2b9d6c 100755 --- a/scripts/makefile_helper +++ b/scripts/makefile_helper @@ -20,12 +20,12 @@ fi case $1 in --clean) rm -rf "${BUILD_ROOT}/${BUILD_BASE}."*/* "${BUILD_ROOT}/${BUILD_BASE}."*/.stamps - ;; + ;; --distclean) rm -rf "${BUILD_ROOT}/.ccache" "${BUILD_ROOT}/${BUILD_BASE}."* - ;; + ;; *) echo "error: ${0}: unsupported option on CLI; aborting" exit 1 - ;; + ;; esac diff --git a/scripts/mkimage b/scripts/mkimage index da69b7dd52..c29761ea4a 100755 --- a/scripts/mkimage +++ b/scripts/mkimage @@ -18,9 +18,9 @@ if [ -z "${SYSTEM_SIZE}" -o -z "${SYSTEM_PART_START}" ]; then exit 1 fi -DISK_START_PADDING=$(( (${SYSTEM_PART_START} + 2048 - 1) / 2048 )) +DISK_START_PADDING=$(((${SYSTEM_PART_START} + 2048 - 1) / 2048)) DISK_GPT_PADDING=1 -DISK_SIZE=$(( ${DISK_START_PADDING} + ${SYSTEM_SIZE} + ${STORAGE_SIZE} + ${DISK_GPT_PADDING} )) +DISK_SIZE=$((${DISK_START_PADDING} + ${SYSTEM_SIZE} + ${STORAGE_SIZE} + ${DISK_GPT_PADDING})) DISK_BASENAME="${TARGET_IMG}/${IMAGE_NAME}" DISK="${DISK_BASENAME}.img" @@ -63,17 +63,17 @@ sync # create partitions echo "image: creating partitions..." -SYSTEM_PART_END=$(( ${SYSTEM_PART_START} + (${SYSTEM_SIZE} * 1024 * 1024 / 512) - 1 )) -STORAGE_PART_START=$(( ${SYSTEM_PART_END} + 1 )) -STORAGE_PART_END=$(( ${STORAGE_PART_START} + (${STORAGE_SIZE} * 1024 * 1024 / 512) - 1 )) +SYSTEM_PART_END=$((${SYSTEM_PART_START} + (${SYSTEM_SIZE} * 1024 * 1024 / 512) - 1)) +STORAGE_PART_START=$((${SYSTEM_PART_END} + 1)) +STORAGE_PART_END=$((${STORAGE_PART_START} + (${STORAGE_SIZE} * 1024 * 1024 / 512) - 1)) if [ "${DISK_LABEL}" = "gpt" ]; then - parted -s "${DISK}" -a min unit s mkpart system fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} - parted -s "${DISK}" -a min unit s mkpart storage ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} + parted -s "${DISK}" -a min unit s mkpart system fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart storage ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} parted -s "${DISK}" set 1 legacy_boot on else - parted -s "${DISK}" -a min unit s mkpart primary fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} - parted -s "${DISK}" -a min unit s mkpart primary ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} + parted -s "${DISK}" -a min unit s mkpart primary fat32 ${SYSTEM_PART_START} ${SYSTEM_PART_END} + parted -s "${DISK}" -a min unit s mkpart primary ext4 ${STORAGE_PART_START} ${STORAGE_PART_END} parted -s "${DISK}" set 1 boot on fi sync @@ -86,7 +86,7 @@ fi # create part2 to format and copy files echo "image: creating sparse file for part2..." -STORAGE_PART_COUNT=$(( ${STORAGE_PART_END} - ${STORAGE_PART_START} + 1 )) +STORAGE_PART_COUNT=$((${STORAGE_PART_END} - ${STORAGE_PART_START} + 1)) sync dd if="${DISK}" of="${LE_TMP}/part2.ext4" bs=512 count=0 seek="${STORAGE_PART_COUNT}" conv=fsync >"${SAVE_ERROR}" 2>&1 || show_error @@ -118,11 +118,11 @@ fi # create part1 to format and copy files echo "image: creating sparse file for part1..." -SYSTEM_PART_COUNT=$(( ${SYSTEM_PART_END} - ${SYSTEM_PART_START} + 1 )) +SYSTEM_PART_COUNT=$((${SYSTEM_PART_END} - ${SYSTEM_PART_START} + 1)) sync dd if=/dev/zero of="${LE_TMP}/part1.fat" bs=512 count=0 seek="${SYSTEM_PART_COUNT}" conv=fsync >"${SAVE_ERROR}" 2>&1 || show_error -shopt -s expand_aliases # enables alias expansion in script +shopt -s expand_aliases # enables alias expansion in script alias mcopy='mcopy -i "${LE_TMP}/part1.fat" -o' alias mmd='mmd -i "${LE_TMP}/part1.fat"' @@ -137,7 +137,7 @@ sync if [ "${BOOTLOADER}" = "syslinux" ]; then # create bootloader configuration echo "image: creating bootloader configuration..." - cat << EOF > "${LE_TMP}/syslinux.cfg" + cat <"${LE_TMP}/syslinux.cfg" SAY Wait for installer mode to start automatically in 5 seconds... SAY SAY Options @@ -163,7 +163,7 @@ LABEL run APPEND boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} portable quiet EOF - cat << EOF > "${LE_TMP}/grub.cfg" + cat <"${LE_TMP}/grub.cfg" set timeout="25" set default="Installer" menuentry "Installer" { @@ -202,7 +202,7 @@ EOF elif [ "${BOOTLOADER}" = "bcm2835-bootloader" ]; then # create bootloader configuration echo "image: creating bootloader configuration..." - cat << EOF > "${LE_TMP}/cmdline.txt" + cat <"${LE_TMP}/cmdline.txt" boot=UUID=${UUID_SYSTEM} disk=UUID=${UUID_STORAGE} quiet ${EXTRA_CMDLINE} EOF @@ -215,20 +215,20 @@ EOF mcopy "${RELEASE_DIR}/target/KERNEL.md5" "::/${KERNEL_NAME}.md5" >"${SAVE_ERROR}" 2>&1 || show_error mcopy "${RELEASE_DIR}/target/SYSTEM.md5" ::/SYSTEM.md5 >"${SAVE_ERROR}" 2>&1 || show_error - for f in bootcode.bin fixup.dat start.elf ; do + for f in bootcode.bin fixup.dat start.elf; do if [ -f "${RELEASE_DIR}/3rdparty/bootloader/$f" ]; then mcopy "${RELEASE_DIR}/3rdparty/bootloader/$f" :: >"${SAVE_ERROR}" 2>&1 || show_error fi done mcopy "${RELEASE_DIR}/3rdparty/bootloader/config.txt" :: >"${SAVE_ERROR}" 2>&1 || show_error - for distro in "${RELEASE_DIR}/3rdparty/bootloader/distroconfig"*.txt ; do + for distro in "${RELEASE_DIR}/3rdparty/bootloader/distroconfig"*.txt; do if [ -f "${distro}" ]; then mcopy "${distro}" ::/"${distro##*/}" >"${SAVE_ERROR}" 2>&1 || show_error fi done - for dtb in "${RELEASE_DIR}/3rdparty/bootloader/"*.dtb ; do + for dtb in "${RELEASE_DIR}/3rdparty/bootloader/"*.dtb; do if [ -f "${dtb}" ]; then mcopy "${dtb}" ::/"${dtb##*/}" >"${SAVE_ERROR}" 2>&1 || show_error fi @@ -255,7 +255,7 @@ elif [ "${BOOTLOADER}" = "u-boot" -a -n "${UBOOT_SYSTEM}" ]; then mkdir -p "${LE_TMP}/extlinux" - cat << EOF > "${LE_TMP}/extlinux/extlinux.conf" + cat <"${LE_TMP}/extlinux/extlinux.conf" LABEL ${DISTRO} LINUX /${KERNEL_NAME} FDT /${DTB} @@ -314,14 +314,14 @@ if [ "${PROJECT}" = "Generic" ]; then qemu-img convert -O vmdk -o subformat=streamOptimized "${DISK_BASENAME}.tmp" "${DISK_BASENAME}.vmdk" # generate ovf from template sed -e "s,@DISTRO@,${DISTRO},g" -e "s,@DISK@,${IMAGE_NAME},g" \ - -e "s,@OVA_SIZE@,$((${OVA_SIZE}*1024*1024)),g" \ - "${PROJECT_DIR}/${PROJECT}/config/ovf.template" > "${DISK_BASENAME}.ovf" + -e "s,@OVA_SIZE@,$((${OVA_SIZE} * 1024 * 1024)),g" \ + "${PROJECT_DIR}/${PROJECT}/config/ovf.template" >"${DISK_BASENAME}.ovf" # combine ovf and vmdk into official ova tar -C "${TARGET_IMG}" -cf "${DISK_BASENAME}.ova" "${IMAGE_NAME}.ovf" "${IMAGE_NAME}.vmdk" # create sha256 checksum of ova image ( cd "${TARGET_IMG}" - sha256sum "${IMAGE_NAME}.ova" > "${IMAGE_NAME}.ova.sha256" + sha256sum "${IMAGE_NAME}.ova" >"${IMAGE_NAME}.ova.sha256" ) echo "image: cleaning up open virtual appliance..." # remove tmp ${DISK}, vmdk and ovf @@ -335,7 +335,7 @@ pigz --best --force "${DISK}" # create sha256 checksum of image ( cd "${TARGET_IMG}" - sha256sum "${DISK##*/}.gz" > "${DISK##*/}.gz.sha256" + sha256sum "${DISK##*/}.gz" >"${DISK##*/}.gz.sha256" ) # cleanup diff --git a/scripts/pkgbuild b/scripts/pkgbuild index 495a423d83..9a32147c27 100755 --- a/scripts/pkgbuild +++ b/scripts/pkgbuild @@ -23,7 +23,7 @@ package_worker() { num=0 for failed_items in ${oseqinfo//;/ }; do num=$((num + 1)) - read -r ftask fpkgname fseq <<< "${failed_items//,/ }" + read -r ftask fpkgname fseq <<<"${failed_items//,/ }" if [ -n "${fseq}" ]; then [ ${num} -eq 1 ] && echo "The following log(s) for already failed dependencies are available:" @@ -39,7 +39,7 @@ package_worker() { [[ ${pkgname} =~ :target$ || "${pkgname//:/}" = "${pkgname}" ]] && istarget="yes" || istarget="no" - [[ "${MTADDONBUILD}" = "yes" && ( "${PKG_IS_ADDON}" = "yes" || "${PKG_IS_ADDON}" = "embedded" ) ]] && isaddon="yes" || isaddon="no" + [[ "${MTADDONBUILD}" = "yes" && ("${PKG_IS_ADDON}" = "yes" || "${PKG_IS_ADDON}" = "embedded") ]] && isaddon="yes" || isaddon="no" if [ "${isaddon}" = "yes" -a "${istarget}" = "yes" ]; then if [ ${result} -eq 0 ]; then @@ -58,7 +58,7 @@ package_worker() { ( flock --exclusive 95 [ ${result} -eq 0 ] && status="DONE" || status="FAIL" - num=$(< "${THREAD_CONTROL}/progress") + num=$(<"${THREAD_CONTROL}/progress") mv "${THREAD_CONTROL}/progress" "${THREAD_CONTROL}/progress.prev" num=$((num + 1)) echo ${num} >"${THREAD_CONTROL}/progress" diff --git a/scripts/pkgjson b/scripts/pkgjson index 91b55efaa1..d643494264 100755 --- a/scripts/pkgjson +++ b/scripts/pkgjson @@ -51,6 +51,6 @@ fi # pipefail: return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status set -o pipefail -cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | \ +cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | xargs --max-args=64 --max-procs="$(nproc)" "$0" --worker exit $? diff --git a/scripts/unpack b/scripts/unpack index b1bb4ada36..a211a80e31 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -20,7 +20,7 @@ pkg_lock "${PKG_NAME}" "unpack" "${PARENT_PKG}" ${SCRIPTS}/get "${PKG_NAME}" if [ -n "${PKG_DEPENDS_UNPACK}" ]; then - export _unpack_recursive_cnt=$((_unpack_recursive_cnt+1)) + export _unpack_recursive_cnt=$((_unpack_recursive_cnt + 1)) if [ ${_unpack_recursive_cnt} -gt 2 ]; then die "unpack recursive limit hit: ${PKG_DEPENDS_UNPACK}, ${PARENT_PKG}" fi @@ -28,7 +28,7 @@ if [ -n "${PKG_DEPENDS_UNPACK}" ]; then for p in ${PKG_DEPENDS_UNPACK}; do ${SCRIPTS}/unpack "${p}" "${PARENT_PKG}" done - + unset _unpack_recursive_cnt fi @@ -39,11 +39,11 @@ mkdir -p ${BUILD}/build # Perform a wildcard match on the package to ensure old versions are cleaned too PKG_DEEPHASH= for i in ${BUILD}/build/${PKG_NAME}-*; do - if [ -d ${i} -a -f "${i}/.libreelec-unpack" ] ; then + if [ -d ${i} -a -f "${i}/.libreelec-unpack" ]; then . "${i}/.libreelec-unpack" if [ "${STAMP_PKG_NAME}" = "${PKG_NAME}" ]; then [ -z "${PKG_DEEPHASH}" ] && PKG_DEEPHASH=$(calculate_stamp) - if [ ! "${PKG_DEEPHASH}" = "${STAMP_PKG_DEEPHASH}" ] ; then + if [ ! "${PKG_DEEPHASH}" = "${STAMP_PKG_DEEPHASH}" ]; then ${SCRIPTS}/clean "${PKG_NAME}" fi fi @@ -109,7 +109,7 @@ if [ -d "${SOURCES}/${PKG_NAME}" -o -d "${PKG_DIR}/sources" ] || pkg_call_exists fi # Add a tag to the unpacked folder before transferring into the shared build folder - echo "INFO_PKG_NAME=\"${PKG_NAME}\"" > "${PKG_UNPACK_DIR}/.intermediate/.libreelec-package" + echo "INFO_PKG_NAME=\"${PKG_NAME}\"" >"${PKG_UNPACK_DIR}/.intermediate/.libreelec-package" # Restore original PKG_BUILD, and transfer the unpacked folder PKG_BUILD="${PKG_BUILD_ORIG}" @@ -126,7 +126,7 @@ if [ -d "${SOURCES}/${PKG_NAME}" -o -d "${PKG_DIR}/sources" ] || pkg_call_exists if [ "${TARGET_ARCH}" = "x86_64" ]; then PATCH_ARCH="x86" - elif [ "${PKG_IS_KERNEL_PKG}" = "yes" ]; then + elif [ "${PKG_IS_KERNEL_PKG}" = "yes" ]; then PATCH_ARCH="${TARGET_KERNEL_PATCH_ARCH:-${TARGET_ARCH}}" else PATCH_ARCH="${TARGET_PATCH_ARCH:-${TARGET_ARCH}}" @@ -148,15 +148,15 @@ if [ -d "${SOURCES}/${PKG_NAME}" -o -d "${PKG_DIR}/sources" ] || pkg_call_exists fi for i in ${PKG_DIR}/patches/*.patch \ - ${PKG_DIR}/patches/${PATCH_ARCH}/*.patch \ - ${PATCH_DIRS_PKG} \ - ${PKG_DIR}/patches/${PKG_VERSION}/*.patch \ - ${PKG_DIR}/patches/${PKG_VERSION}/${PATCH_ARCH}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PATCH_ARCH}/*.patch \ - ${PATCH_DIRS_PRJ} \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PKG_VERSION}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/${PKG_NAME}/*.patch; do + ${PKG_DIR}/patches/${PATCH_ARCH}/*.patch \ + ${PATCH_DIRS_PKG} \ + ${PKG_DIR}/patches/${PKG_VERSION}/*.patch \ + ${PKG_DIR}/patches/${PKG_VERSION}/${PATCH_ARCH}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PATCH_ARCH}/*.patch \ + ${PATCH_DIRS_PRJ} \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PKG_VERSION}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/${PKG_NAME}/*.patch; do thisdir="${i%/*}" @@ -191,9 +191,9 @@ if [ -d "${SOURCES}/${PKG_NAME}" -o -d "${PKG_DIR}/sources" ] || pkg_call_exists if [ -f "${i}" ]; then build_msg "CLR_APPLY_PATCH" "APPLY PATCH $(print_color "CLR_PATCH_DESC" "${PATCH_DESC}")" "${i#${ROOT}/}" if grep -qE '^GIT binary patch$|^rename from|^rename to' ${i}; then - git apply --directory="${PKG_BUILD}" -p1 --verbose --whitespace=nowarn --unsafe-paths < ${i} >&${VERBOSE_OUT} + git apply --directory="${PKG_BUILD}" -p1 --verbose --whitespace=nowarn --unsafe-paths <${i} >&${VERBOSE_OUT} else - patch -d "${PKG_BUILD}" -p1 < ${i} >&${VERBOSE_OUT} + patch -d "${PKG_BUILD}" -p1 <${i} >&${VERBOSE_OUT} fi fi done @@ -201,13 +201,13 @@ if [ -d "${SOURCES}/${PKG_NAME}" -o -d "${PKG_DIR}/sources" ] || pkg_call_exists pkg_call_exists_opt post_patch && pkg_call fi - if [ "${PKG_NAME}" != "configtools" ] ; then + if [ "${PKG_NAME}" != "configtools" ]; then for config in $(find "${PKG_BUILD}" -name config.guess | sed 's/config.guess//'); do build_msg "CLR_FIXCONFIG" "FIXCONFIG" "${config}" - [ -f "${config}/config.guess" -a -f ${TOOLCHAIN}/configtools/config.guess ] && \ + [ -f "${config}/config.guess" -a -f ${TOOLCHAIN}/configtools/config.guess ] && cp -f ${TOOLCHAIN}/configtools/config.guess ${config} - [ -f "${config}/config.sub" -a -f ${TOOLCHAIN}/configtools/config.sub ] && \ + [ -f "${config}/config.sub" -a -f ${TOOLCHAIN}/configtools/config.sub ] && cp -f ${TOOLCHAIN}/configtools/config.sub ${config} done fi @@ -216,11 +216,11 @@ pkg_call_finish if [ "${PKG_SECTION}" != "virtual" ]; then mkdir -p "${PKG_BUILD}" - echo "INFO_PKG_NAME=\"${PKG_NAME}\"" > "${PKG_BUILD}/.libreelec-package" + echo "INFO_PKG_NAME=\"${PKG_NAME}\"" >"${PKG_BUILD}/.libreelec-package" PKG_DEEPHASH=$(calculate_stamp) for i in PKG_NAME PKG_DEEPHASH; do - echo "STAMP_${i}=\"${!i}\"" >> ${STAMP} + echo "STAMP_${i}=\"${!i}\"" >>${STAMP} done fi diff --git a/tools/RPi/gen-rpi-kodi-patch.sh b/tools/RPi/gen-rpi-kodi-patch.sh index 45ff092ac5..f47c34a8e3 100755 --- a/tools/RPi/gen-rpi-kodi-patch.sh +++ b/tools/RPi/gen-rpi-kodi-patch.sh @@ -10,8 +10,7 @@ fi DEPTH=1000 -usage() -{ +usage() { local me="$(basename $0)" echo "Usage: ${me} |" diff --git a/tools/RPi/rpi-kodi-rebase.sh b/tools/RPi/rpi-kodi-rebase.sh index f16552f05e..2f2a77c3b8 100755 --- a/tools/RPi/rpi-kodi-rebase.sh +++ b/tools/RPi/rpi-kodi-rebase.sh @@ -12,5 +12,5 @@ for COMMIT in $DROP_COMMITS; do sed -i -E "s/^pick ([0-9a-f]+) (${COMMIT}.*)/drop \1 \2/g" $TODO done -grep -E "^drop " $TODO > /tmp/dropped +grep -E "^drop " $TODO >/tmp/dropped sed -i -E "/^drop /d" $TODO diff --git a/tools/change_addon_version b/tools/change_addon_version index 124d761444..a8ccebf2cc 100755 --- a/tools/change_addon_version +++ b/tools/change_addon_version @@ -59,21 +59,21 @@ OPTION=$(whiptail --title "Update ADDON-VERSION" --menu "" 12 60 4 \ "3" "Exit" 3>&1 1>&2 2>&3) case $OPTION in -"1") - update_addon_version - update_package - ;; -"2") - BUMP_ADDON_VERSION=$(whiptail --inputbox "Enter ADDON-VERSION:" 10 25 ${DISTRO_ADDON_VERSION} 3>&1 1>&2 2>&3) - EXITSTATUS=$? - if [ $EXITSTATUS = 0 ]; then + "1") update_addon_version update_package - else + ;; + "2") + BUMP_ADDON_VERSION=$(whiptail --inputbox "Enter ADDON-VERSION:" 10 25 ${DISTRO_ADDON_VERSION} 3>&1 1>&2 2>&3) + EXITSTATUS=$? + if [ $EXITSTATUS = 0 ]; then + update_addon_version + update_package + else + exit + fi + ;; + "3") exit - fi - ;; -"3") - exit - ;; + ;; esac diff --git a/tools/check_kernel_config b/tools/check_kernel_config index 16552225fd..308da4fc86 100755 --- a/tools/check_kernel_config +++ b/tools/check_kernel_config @@ -32,7 +32,7 @@ if [ -f "${DISTRO_DIR}/${DISTRO}/kernel_options" ]; then $PKG_BUILD/scripts/config --file $PKG_KERNEL_CFG_FILE --set-str ${OPTION%%=*} $(echo ${OPTION##*=} | tr -d '"') fi - done < ${DISTRO_DIR}/${DISTRO}/kernel_options + done <${DISTRO_DIR}/${DISTRO}/kernel_options else echo "kernel options file doesn't exist: ${DISTRO_DIR}/${DISTRO}/kernel_options" fi diff --git a/tools/checkunpack b/tools/checkunpack index a783f91a83..e3875295fa 100755 --- a/tools/checkunpack +++ b/tools/checkunpack @@ -37,12 +37,25 @@ USING_FILTER="no" while getopts "f:cvSh" opt; do case ${opt} in - f) FILTER="${OPTARG}"; USING_FILTER="yes";; - c) RMPROGRESS="yes";; - v) VERBOSE="yes";; - S) SHOW_SKIPPED="yes";; - h) usage;; - *) usage;; + f) + FILTER="${OPTARG}" + USING_FILTER="yes" + ;; + c) + RMPROGRESS="yes" + ;; + v) + VERBOSE="yes" + ;; + S) + SHOW_SKIPPED="yes" + ;; + h) + usage + ;; + *) + usage + ;; esac done @@ -59,7 +72,10 @@ SKIPPED="$(cut -d' ' -f1 ${RESTART_FILE} 2>/dev/null | sort -u | wc -l || true)" [ "${USING_FILTER}" = "no" -a "${SKIPPED:-0}" -ne 0 ] && echo -e "WARNING: skipping ${SKIPPED} packages.\n" >&2 for pkg_name in $(get_all_package_names | grep -E "${FILTER}"); do - stamp=$(source_package ${pkg_name}; calculate_stamp) + stamp=$( + source_package ${pkg_name} + calculate_stamp + ) if [ -z "${stamp}" ]; then [ "${SHOW_SKIPPED}" = "yes" ] && printf "Checking: %-40s IGNORED\n" "${pkg_name}" continue diff --git a/tools/distro-tool b/tools/distro-tool index 5e28c7fb78..0157497d27 100755 --- a/tools/distro-tool +++ b/tools/distro-tool @@ -696,7 +696,7 @@ if __name__ == "__main__": ' [ -z "${PROJECT}" ] && PROJECT=Generic -[ -z "${ARCH}" ] && ARCH=x86_64 +[ -z "${ARCH}" ] && ARCH=x86_64 help() { [ -n "$1" ] && echo -e "ERROR: Unknown argument [$1]\n" @@ -854,7 +854,7 @@ generate_work_worker() { echo " \"${var}\": \"${!var}\"${comma}" >>${workfile_o} done echo " }," >>${workfile_o} - done < ${workfile_i} + done <${workfile_i} ) } @@ -909,17 +909,17 @@ get_packages() { } init_progress() { - echo 0 > ${LOCKFILE} + echo 0 >${LOCKFILE} } progress() { local count ( flock -x 9 - count=$(($(< ${LOCKFILE}) + 1)) + count=$(($(<${LOCKFILE}) + 1)) echo "${count}" >${LOCKFILE} printf "Generating workload... %3d%% (%d of %d)\r" $((count * 100 / $1)) ${count} $1 >&2 - ) 9< "${LOCKFILE}" + ) 9<"${LOCKFILE}" } end_progress() { @@ -930,52 +930,52 @@ end_progress() { exec_worker_prog() { echo "${PYTHON_PROG}" >/tmp/distro-tool.py python3 /tmp/distro-tool.py "${DOWNLOAD_DIR}" "${TARGET_DIR}" "${DISTRO_SOURCE}" "${DISTRO_MIRROR}" \ - "${IS_MIRROR}" "${IGNORE_ERRORS}" "${DRY_RUN}" "${CHECK_NEWER}" \ - "${PROGRESS}" "${WORKER_THREADS}" "${GIT_USERNAME}" "${GIT_PASSWORD}" \ - "${CHECK_FILTER_CLASS}" "${CHECK_FILTER_TYPE}" ${VERIFY_CHECKSUM} "${VERBOSE}" + "${IS_MIRROR}" "${IGNORE_ERRORS}" "${DRY_RUN}" "${CHECK_NEWER}" \ + "${PROGRESS}" "${WORKER_THREADS}" "${GIT_USERNAME}" "${GIT_PASSWORD}" \ + "${CHECK_FILTER_CLASS}" "${CHECK_FILTER_TYPE}" ${VERIFY_CHECKSUM} "${VERBOSE}" rm -f /tmp/distro-tool.py } while [ : ]; do [ -z "$1" ] && break case $1 in - -d|--download) + -d | --download) shift DOWNLOAD_DIR=$1 ;; - -l|--libreelec) + -l | --libreelec) shift LIBREELEC_DIR=$1 ;; - -t|--target) + -t | --target) shift TARGET_DIR=$1 ;; - -a|--all) + -a | --all) IGNORE_ERRORS=yes ;; - -p|--package) + -p | --package) shift PACKAGE=$1 ;; - -r|--revision) + -r | --revision) shift REVISION=$1 ;; - -m|--mirror) + -m | --mirror) IS_MIRROR=yes ;; - -s|--source) + -s | --source) IS_MIRROR=no ;; - --dry-run|--dryrun) + --dry-run | --dryrun) DRY_RUN=yes LINE_PREFIX="**DRY-RUN** " ;; --git) DOGIT=yes ;; - -n|--notnewer) + -n | --notnewer) CHECK_NEWER=no ;; --check-ver) @@ -990,19 +990,19 @@ while [ : ]; do --check-main) CHECK_FILTER_CLASS=Main ;; - -T|--threads) + -T | --threads) shift [ $1 -gt 0 ] && WORKER_THREADS=$1 ;; - -U|--gituser) + -U | --gituser) shift GIT_USERNAME=$1 ;; - -P|--gitpass) + -P | --gitpass) shift GIT_PASSWORD=$1 ;; - -v|--verbose) + -v | --verbose) VERBOSE=$((VERBOSE + 1)) ;; --no-progress) @@ -1015,7 +1015,7 @@ while [ : ]; do --verify-checksum) VERIFY_CHECKSUM=yes ;; - -h|--help) + -h | --help) help exit 0 ;; diff --git a/tools/download-cleaner b/tools/download-cleaner index dfc4380ede..7bf7e53af3 100755 --- a/tools/download-cleaner +++ b/tools/download-cleaner @@ -25,19 +25,17 @@ BUILD_SOURCES="false" REPLACE_OLD="false" NEW_SOURCES="${NEW_SOURCES_DIR:-${SOURCES}.new}" - # helper functions -help(){ +help() { echo "Usage: ${0} [-hdfbr]" - echo "Set PROJECT, DEVICE and ARCH as required." - echo " -h this help" - echo " -d delete obsolete source packages (default no)" - echo " -f fetch updated source packages (default: no)" - echo " -b build new SOURCES content (default: no)" - echo " -r replace old SOURCES when rebuilding (default: no)" + echo "Set PROJECT, DEVICE and ARCH as required." + echo " -h this help" + echo " -d delete obsolete source packages (default no)" + echo " -f fetch updated source packages (default: no)" + echo " -b build new SOURCES content (default: no)" + echo " -r replace old SOURCES when rebuilding (default: no)" } - # command line opts while getopts hdfrb OPT; do case "${OPT}" in @@ -65,8 +63,7 @@ while getopts hdfrb OPT; do esac done -shift $((${OPTIND}-1)) - +shift $((${OPTIND} - 1)) # sanity checking if [ ! -d "${SOURCES}" ]; then @@ -75,7 +72,6 @@ elif [ "${DESTRUCTIVE_RUN}" = "true" -a "${BUILD_SOURCES}" = "true" ]; then die "error: options '-d' and '-b' are mutually exclusive" fi - # main # process files in SOURCES for SOURCE_PACKAGE in $(find "${SOURCES}/" -mindepth 1 -type d); do diff --git a/tools/download-tool b/tools/download-tool index 92f42bebaa..31b56ecd53 100755 --- a/tools/download-tool +++ b/tools/download-tool @@ -15,17 +15,18 @@ help() { } case $1 in - -a|--all) - ALL_PACKAGES="true" - ;; - -h|--help) - help - exit 0 + -a | --all) + ALL_PACKAGES="true" + ;; + -h | --help) + help + exit 0 + ;; esac for package in $(find packages/ -name package.mk); do if [ -n "$(echo $package | grep addons)" -a -z "$ALL_PACKAGES" ]; then continue fi - ./scripts/get $(basename `dirname $package`) + ./scripts/get $(basename $(dirname $package)) done diff --git a/tools/ffmpeg/gen-patches.sh b/tools/ffmpeg/gen-patches.sh index b9610e5a9d..9c372c6825 100755 --- a/tools/ffmpeg/gen-patches.sh +++ b/tools/ffmpeg/gen-patches.sh @@ -13,7 +13,10 @@ if [ $# -eq 0 ]; then fi FFMPEG_ROOT="$(pwd)" -LE_ROOT="$(cd $(dirname $0)/../.. ; pwd)" +LE_ROOT="$( + cd $(dirname $0)/../.. + pwd +)" create_patch() { FEATURE_SET="$1" @@ -25,7 +28,7 @@ create_patch() { PATCH_CREATE_DIFF="no" case "${FEATURE_SET}" in - v4l2-drmprime|v4l2-request|vf-deinterlace-v4l2m2m) + v4l2-drmprime | v4l2-request | vf-deinterlace-v4l2m2m) REPO="https://github.com/jernejsk/FFmpeg" REFSPEC="${FEATURE_SET}-${FFMPEG_VERSION}" ;; @@ -67,14 +70,14 @@ create_patch() { if [ "${PATCH_CREATE_DIFF}" = "yes" ]; then # create diff in case format-patch doesn't work, eg when we have non-linear history - git diff "${BASE_REV}..${REV}" > "${LE_ROOT}/${PATCH_FILE}" + git diff "${BASE_REV}..${REV}" >"${LE_ROOT}/${PATCH_FILE}" else - git format-patch --stdout --no-signature "${BASE_REV}..${REV}" > "${LE_ROOT}/${PATCH_FILE}" + git format-patch --stdout --no-signature "${BASE_REV}..${REV}" >"${LE_ROOT}/${PATCH_FILE}" fi MSG=$(mktemp) - cat << EOF > "${MSG}" + cat <"${MSG}" ffmpeg: ${ACTION} ${FEATURE_SET} patch Patch created using revisions ${BASE_REV:0:7}..${REV:0:7} diff --git a/tools/mkpkg/mkpkg_bcm2835-bootloader b/tools/mkpkg/mkpkg_bcm2835-bootloader index 0954d2cf77..00c5f7fe2b 100755 --- a/tools/mkpkg/mkpkg_bcm2835-bootloader +++ b/tools/mkpkg/mkpkg_bcm2835-bootloader @@ -7,35 +7,35 @@ GIT_DIR="raspberrypi-firmware.git" echo "getting sources..." - if [ ! -d "${GIT_DIR}" ]; then - git clone https://github.com/raspberrypi/firmware.git --depth=1 -b master "${GIT_DIR}" - fi +if [ ! -d "${GIT_DIR}" ]; then + git clone https://github.com/raspberrypi/firmware.git --depth=1 -b master "${GIT_DIR}" +fi - cd "${GIT_DIR}" - git fetch - if [ $# -eq 1 ]; then - git checkout "$1" - else - git checkout origin/master - fi - GIT_REV=$(git log -n1 --format=%H) - cd .. +cd "${GIT_DIR}" +git fetch +if [ $# -eq 1 ]; then + git checkout "$1" +else + git checkout origin/master +fi +GIT_REV=$(git log -n1 --format=%H) +cd .. BOOT_DIR="${GIT_DIR}/boot" PKG_DIR="bcm2835-bootloader-${GIT_REV}" echo "copying sources..." - rm -rf "${PKG_DIR}" - mkdir -p "${PKG_DIR}" - cp \ - "${BOOT_DIR}"/LICENCE* \ - "${BOOT_DIR}"/bootcode.bin \ - "${BOOT_DIR}"/fixup*.dat \ - "${BOOT_DIR}"/start*.elf \ - "${PKG_DIR}" +rm -rf "${PKG_DIR}" +mkdir -p "${PKG_DIR}" +cp \ + "${BOOT_DIR}"/LICENCE* \ + "${BOOT_DIR}"/bootcode.bin \ + "${BOOT_DIR}"/fixup*.dat \ + "${BOOT_DIR}"/start*.elf \ + "${PKG_DIR}" echo "packing sources..." - tar cvJf "${PKG_DIR}.tar.xz" "${PKG_DIR}" +tar cvJf "${PKG_DIR}.tar.xz" "${PKG_DIR}" echo "remove temporary sourcedir..." - rm -rf "${PKG_DIR}" +rm -rf "${PKG_DIR}" diff --git a/tools/mkpkg/mkpkg_boblightd b/tools/mkpkg/mkpkg_boblightd index 7268439f2a..6d9315b32e 100755 --- a/tools/mkpkg/mkpkg_boblightd +++ b/tools/mkpkg/mkpkg_boblightd @@ -4,23 +4,23 @@ # Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv) echo "getting sources..." - svn checkout http://boblight.googlecode.com/svn/trunk/ boblightd-latest +svn checkout http://boblight.googlecode.com/svn/trunk/ boblightd-latest echo "getting version..." - cd boblightd-latest - SVN_REV=`LANG=C svn info 2>/dev/null | grep Revision: | sed -e 's/.*\: //'` - echo $SVN_REV - cd .. +cd boblightd-latest +SVN_REV=$(LANG=C svn info 2>/dev/null | grep Revision: | sed -e 's/.*\: //') +echo $SVN_REV +cd .. echo "copying sources..." - rm -rf boblightd-$SVN_REV - cp -R boblightd-latest boblightd-$SVN_REV +rm -rf boblightd-$SVN_REV +cp -R boblightd-latest boblightd-$SVN_REV #echo "cleaning sources..." - find boblightd-$SVN_REV -name ".svn" -exec rm -rf {} \; 2>/dev/null +find boblightd-$SVN_REV -name ".svn" -exec rm -rf {} \; 2>/dev/null echo "packing sources..." - tar cvJf boblightd-$SVN_REV.tar.xz boblightd-$SVN_REV +tar cvJf boblightd-$SVN_REV.tar.xz boblightd-$SVN_REV echo "remove temporary sourcedir..." - rm -rf boblightd-$SVN_REV +rm -rf boblightd-$SVN_REV diff --git a/tools/mkpkg/mkpkg_libcec b/tools/mkpkg/mkpkg_libcec index 5492c8890b..6c4fbc8e67 100755 --- a/tools/mkpkg/mkpkg_libcec +++ b/tools/mkpkg/mkpkg_libcec @@ -5,24 +5,24 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) echo "getting sources..." - if [ ! -d libcec.git ]; then - git clone --depth=1 https://github.com/Pulse-Eight/libcec.git libcec.git - fi +if [ ! -d libcec.git ]; then + git clone --depth=1 https://github.com/Pulse-Eight/libcec.git libcec.git +fi - cd libcec.git - git pull - GIT_REV=`git log -n1 --format=%H` - cd .. +cd libcec.git +git pull +GIT_REV=$(git log -n1 --format=%H) +cd .. echo "copying sources..." - rm -rf libcec-$GIT_REV - cp -R libcec.git libcec-$GIT_REV +rm -rf libcec-$GIT_REV +cp -R libcec.git libcec-$GIT_REV echo "cleaning sources..." - rm -rf libcec-$GIT_REV/.git +rm -rf libcec-$GIT_REV/.git echo "packing sources..." - tar cvJf libcec-$GIT_REV.tar.xz libcec-$GIT_REV +tar cvJf libcec-$GIT_REV.tar.xz libcec-$GIT_REV echo "remove temporary sourcedir..." - rm -rf libcec-$GIT_REV +rm -rf libcec-$GIT_REV diff --git a/tools/mkpkg/mkpkg_media_build b/tools/mkpkg/mkpkg_media_build index aa4a83deac..f370bc81d2 100755 --- a/tools/mkpkg/mkpkg_media_build +++ b/tools/mkpkg/mkpkg_media_build @@ -30,23 +30,23 @@ fi #get log cd media_build/ - git pull - git checkout $MEDIA_BUILD_HASH - GIT_LOG_MEDIA_BUILD=`git log --pretty=oneline -n1` +git pull +git checkout $MEDIA_BUILD_HASH +GIT_LOG_MEDIA_BUILD=$(git log --pretty=oneline -n1) cd $DVB_MKPKG_FOLDER/ # media_tree dl echo "getting sources ..." - if [ ! -d linux_media.git ]; then - git clone --depth=1 https://bitbucket.org/CrazyCat/linux_media.git -b latest media_tree - fi +if [ ! -d linux_media.git ]; then + git clone --depth=1 https://bitbucket.org/CrazyCat/linux_media.git -b latest media_tree +fi #get log cd media_tree/ - git pull - GIT_LOG_MEDIA_TREE=`git log --pretty=oneline -n1` - GIT_REV=`git log -n1 --pretty=format:"%ad" --date=short` +git pull +GIT_LOG_MEDIA_TREE=$(git log --pretty=oneline -n1) +GIT_REV=$(git log -n1 --pretty=format:"%ad" --date=short) cd $DVB_MKPKG_FOLDER/ @@ -64,7 +64,7 @@ rm -rf media_tree/ rm -rf media_build/.git/ # log used versions into LE_versions -echo "package include: \n\nmedia_build:\n$GIT_LOG_MEDIA_BUILD \n\nmedia_tree:\n$GIT_LOG_MEDIA_TREE \n" > media_build/LE_versions +echo "package include: \n\nmedia_build:\n$GIT_LOG_MEDIA_BUILD \n\nmedia_tree:\n$GIT_LOG_MEDIA_TREE \n" >media_build/LE_versions # rename buildfolder mv media_build/ media_build-$GIT_REV/ diff --git a/tools/mkpkg/mkpkg_pvr b/tools/mkpkg/mkpkg_pvr index 842d3d8249..5c4792d032 100755 --- a/tools/mkpkg/mkpkg_pvr +++ b/tools/mkpkg/mkpkg_pvr @@ -8,7 +8,7 @@ if [ -z "$1" ]; then echo "Usage: $0 crazycat | tbs" exit 0 else - MEDIA_BUILD_PROJECT="$1" + MEDIA_BUILD_PROJECT="$1" fi # name of the package @@ -50,31 +50,31 @@ fi #get log cd media_build/ - git pull - git checkout $MEDIA_BUILD_HASH - GIT_LOG_MEDIA_BUILD=`git log --pretty=oneline -n1` +git pull +git checkout $MEDIA_BUILD_HASH +GIT_LOG_MEDIA_BUILD=$(git log --pretty=oneline -n1) cd $DVB_MKPKG_FOLDER/ # media_tree dl echo "getting sources ..." - if [ ! -d linux_media.git ]; then - git clone --depth=1 $MEDIA_TREE_URL -b $MEDIA_TREE_BRANCH media_tree - fi +if [ ! -d linux_media.git ]; then + git clone --depth=1 $MEDIA_TREE_URL -b $MEDIA_TREE_BRANCH media_tree +fi #get log cd media_tree/ - git pull - GIT_LOG_MEDIA_TREE=`git log --pretty=oneline -n1` - GIT_REV=`git log -n1 --pretty=format:"%ad" --date=short` +git pull +GIT_LOG_MEDIA_TREE=$(git log --pretty=oneline -n1) +GIT_REV=$(git log -n1 --pretty=format:"%ad" --date=short) # hack/workaround for borked upstream kernel/media_build -# without removing atomisp there a lot additional includes that +# without removing atomisp there a lot additional includes that # slowdown build process after modpost from 3min to 6min # even if atomisp is disabled via kernel.conf - rm -rf drivers/staging/media/atomisp - sed -i 's|^.*drivers/staging/media/atomisp.*$||' $DVB_MKPKG_FOLDER/media_tree/drivers/staging/media/Kconfig - +rm -rf drivers/staging/media/atomisp +sed -i 's|^.*drivers/staging/media/atomisp.*$||' $DVB_MKPKG_FOLDER/media_tree/drivers/staging/media/Kconfig + cd $DVB_MKPKG_FOLDER/ ################################################################################ @@ -84,10 +84,10 @@ echo "create media_tree tar" cd media_build/linux make tar DIR="$DVB_MKPKG_FOLDER/media_tree/" -cd $DVB_MKPKG_FOLDER +cd $DVB_MKPKG_FOLDER # cleanup -rm -rf media_tree/ +rm -rf media_tree/ rm -rf media_build/.git/ # rename buildfolder @@ -101,7 +101,7 @@ media_build url: $MEDIA_BUILD_URL media_tree commit: $GIT_LOG_MEDIA_TREE media_tree url: $MEDIA_TREE_URL \n -package date: $(date +%F_%H:%M:%S)" > $MEDIA_BUILD_NAME-$GIT_REV/LE_versions +package date: $(date +%F_%H:%M:%S)" >$MEDIA_BUILD_NAME-$GIT_REV/LE_versions ################################################################################ diff --git a/tools/mkpkg/mkpkg_rtmpdump b/tools/mkpkg/mkpkg_rtmpdump index 7e708eb54d..982da77ac4 100755 --- a/tools/mkpkg/mkpkg_rtmpdump +++ b/tools/mkpkg/mkpkg_rtmpdump @@ -5,24 +5,24 @@ # Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv) echo "getting sources..." - if [ ! -d rtmpdump.git ]; then - git clone git://git.ffmpeg.org/rtmpdump rtmpdump.git - fi +if [ ! -d rtmpdump.git ]; then + git clone git://git.ffmpeg.org/rtmpdump rtmpdump.git +fi - cd rtmpdump.git - git pull - GIT_REV=`git log -n1 --format=%H` - cd .. +cd rtmpdump.git +git pull +GIT_REV=$(git log -n1 --format=%H) +cd .. echo "copying sources..." - rm -rf rtmpdump-$GIT_REV - cp -R rtmpdump.git rtmpdump-$GIT_REV +rm -rf rtmpdump-$GIT_REV +cp -R rtmpdump.git rtmpdump-$GIT_REV echo "cleaning sources..." - rm -rf rtmpdump-$GIT_REV/.git +rm -rf rtmpdump-$GIT_REV/.git echo "packing sources..." - tar cvJf rtmpdump-$GIT_REV.tar.xz rtmpdump-$GIT_REV +tar cvJf rtmpdump-$GIT_REV.tar.xz rtmpdump-$GIT_REV echo "remove temporary sourcedir..." - rm -rf rtmpdump-$GIT_REV +rm -rf rtmpdump-$GIT_REV diff --git a/tools/mkpkg/mkpkg_vboxguest b/tools/mkpkg/mkpkg_vboxguest index c8ec1f1bd1..89ccd21926 100755 --- a/tools/mkpkg/mkpkg_vboxguest +++ b/tools/mkpkg/mkpkg_vboxguest @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv) -# the script uses 7z to extract the iso to avoid root +# the script uses 7z to extract the iso to avoid root # sudo apt-get install p7zip-full # set version you want to use @@ -15,24 +15,24 @@ fi VBOX_VERSION="$1" echo "getting sources..." - mkdir vbox && cd vbox/ - wget http://download.virtualbox.org/virtualbox/${VBOX_VERSION}/VBoxGuestAdditions_${VBOX_VERSION}.iso +mkdir vbox && cd vbox/ +wget http://download.virtualbox.org/virtualbox/${VBOX_VERSION}/VBoxGuestAdditions_${VBOX_VERSION}.iso echo "extracting iso..." - 7z e VBoxGuestAdditions_${VBOX_VERSION}.iso VBoxLinuxAdditions.run -r - chmod 0755 VBoxLinuxAdditions.run +7z e VBoxGuestAdditions_${VBOX_VERSION}.iso VBoxLinuxAdditions.run -r +chmod 0755 VBoxLinuxAdditions.run echo "extract VBoxLinuxAdditions.run..." - ./VBoxLinuxAdditions.run --tar xf +./VBoxLinuxAdditions.run --tar xf echo "extract VBoxGuestAdditions-amd64..." - mkdir xf86-video-virtualbox-${VBOX_VERSION} - tar -jxvf VBoxGuestAdditions-amd64.tar.bz2 -C xf86-video-virtualbox-${VBOX_VERSION}/ +mkdir xf86-video-virtualbox-${VBOX_VERSION} +tar -jxvf VBoxGuestAdditions-amd64.tar.bz2 -C xf86-video-virtualbox-${VBOX_VERSION}/ echo "packing sources..." - tar cvJf xf86-video-virtualbox-${VBOX_VERSION}.tar.xz xf86-video-virtualbox-${VBOX_VERSION} - mv xf86-video-virtualbox-${VBOX_VERSION}.tar.xz ../xf86-video-virtualbox-${VBOX_VERSION}.tar.xz +tar cvJf xf86-video-virtualbox-${VBOX_VERSION}.tar.xz xf86-video-virtualbox-${VBOX_VERSION} +mv xf86-video-virtualbox-${VBOX_VERSION}.tar.xz ../xf86-video-virtualbox-${VBOX_VERSION}.tar.xz echo "remove temporary sourcedir..." - cd .. - rm -rf vbox/ +cd .. +rm -rf vbox/ diff --git a/tools/mkpkg/update_adafruit-libraries b/tools/mkpkg/update_adafruit-libraries index dbadcc7369..f950f99fa0 100755 --- a/tools/mkpkg/update_adafruit-libraries +++ b/tools/mkpkg/update_adafruit-libraries @@ -31,23 +31,23 @@ CHANGED="" for PKG in $ADAFRUIT_PACKAGES; do echo -n "check: $PKG... " . config/options $PKG - + # filter out, all non github packages if [[ $PKG_URL != https://github.com/* ]]; then echo "ignore, not on github" continue fi - + # get new hash from master branch - URL=$(sed "s|\(www\.\)*github.com/|api.github.com/repos/|;s|/archive/.*|/commits/master|" <<< $PKG_URL) + URL=$(sed "s|\(www\.\)*github.com/|api.github.com/repos/|;s|/archive/.*|/commits/master|" <<<$PKG_URL) GIT_HASH=$(curl --silent --header "Accept: application/vnd.github.v3.sha" $CURL_LOGIN $URL) - + # check rate limit if [[ "$GIT_HASH" == *rate\ limit* ]]; then echo "abort, rate limit of api reached. try later or use your github account" exit 1 fi - + # compare hash if [ $PKG_VERSION == $GIT_HASH ]; then echo "unchanged" @@ -57,19 +57,19 @@ for PKG in $ADAFRUIT_PACKAGES; do # replace old with new hash sed "s|^PKG_VERSION=.*$|PKG_VERSION=\"${GIT_HASH}\"|" -i ${PKG_DIR}/package.mk echo -n "updated to $GIT_HASH " - + CHANGED="${CHANGED}#$PKG_SHORTDESC" # get new package . config/options $PKG TMP_FILE=$ROOT/mkpkg-temp/adafruit/pkg wget --timeout=30 --tries=3 --passive-ftp --no-check-certificate -c -q -O $TMP_FILE $PKG_URL - + # calc new sha256 and replace the old NEW_SHA256="$(sha256sum $TMP_FILE | cut -d" " -f1)" sed "s|^PKG_SHA256=.*$|PKG_SHA256=\"${NEW_SHA256}\"|" -i ${PKG_DIR}/package.mk echo "(sha: ${NEW_SHA256})" - + # remove tmp download rm -f $TMP_FILE done @@ -78,17 +78,17 @@ done . config/options adafruit-libraries if [ ! -z "$CHANGED" ]; then # revision - REV=$(( $PKG_REV + 1 )) + REV=$(($PKG_REV + 1)) echo "increase revision $PKG_REV -> $REV" sed "s|^PKG_REV=.*$|PKG_REV=\"${REV}\"|" -i ${PKG_DIR}/package.mk - + # changelog - echo -en "${REV}\n updated libraries:" > ${PKG_DIR}/changelog.txt.new - sed "s|#|\n - |g" <<< ${CHANGED} >> ${PKG_DIR}/changelog.txt.new - echo "" >> ${PKG_DIR}/changelog.txt.new - cat ${PKG_DIR}/changelog.txt >> ${PKG_DIR}/changelog.txt.new + echo -en "${REV}\n updated libraries:" >${PKG_DIR}/changelog.txt.new + sed "s|#|\n - |g" <<<${CHANGED} >>${PKG_DIR}/changelog.txt.new + echo "" >>${PKG_DIR}/changelog.txt.new + cat ${PKG_DIR}/changelog.txt >>${PKG_DIR}/changelog.txt.new mv ${PKG_DIR}/changelog.txt.new ${PKG_DIR}/changelog.txt -fi +fi # cleanup temp rm -rf $ROOT/mkpkg-temp/adafruit diff --git a/tools/mkpkg/update_binary-addons b/tools/mkpkg/update_binary-addons index 4412dbb06d..ce34dae6aa 100755 --- a/tools/mkpkg/update_binary-addons +++ b/tools/mkpkg/update_binary-addons @@ -17,26 +17,26 @@ usage() { while [ $# -ne 0 ]; do case "$1" in - -b|--bump-pkg-rev) - BUMP_PKG_REV="yes" - shift - ;; - -d|--delete-git-dirs) - KEEP_GIT_DIRS="" - shift - ;; - -h|--help) - usage - exit 1 - ;; - -*) - echo "illegal option $1" - usage - exit 1 - ;; - *) - break - ;; + -b | --bump-pkg-rev) + BUMP_PKG_REV="yes" + shift + ;; + -d | --delete-git-dirs) + KEEP_GIT_DIRS="" + shift + ;; + -h | --help) + usage + exit 1 + ;; + -*) + echo "illegal option $1" + usage + exit 1 + ;; + *) + break + ;; esac done @@ -87,21 +87,21 @@ else ADDONS_REPO_LOCATION=${TMP_REPO_DIR} fi -if ! ls ${ADDONS_REPO_LOCATION}/*-addons.txt &> /dev/null; then - echo "No binary addon repo description found, nothing to do!" - echo "Path searched: ${ADDONS_REPO_LOCATION}" - exit 0 +if ! ls ${ADDONS_REPO_LOCATION}/*-addons.txt &>/dev/null; then + echo "No binary addon repo description found, nothing to do!" + echo "Path searched: ${ADDONS_REPO_LOCATION}" + exit 0 fi # addons -for addontxt in ${ADDONS_REPO_LOCATION}/*-addons.txt ; do +for addontxt in ${ADDONS_REPO_LOCATION}/*-addons.txt; do ADDONS=$(cat $addontxt | awk '{print $1}') ADDONS_GIT_DIR="${ADDONS}.git" ADDONS_GIT_REPO=$(cat $addontxt | awk '{print $2}') ADDONS_GIT_BRANCH=$(cat $addontxt | awk '{print $3}') git_clone $ADDONS_GIT_REPO $ADDONS_GIT_DIR ${ADDONS_GIT_BRANCH} - for addon in $ADDONS_GIT_DIR/*.*/ ; do + for addon in $ADDONS_GIT_DIR/*.*/; do ADDON=$(basename $addon) [[ ${ADDON} =~ ^game.* ]] && continue # ignore game.* addons - handled by update_retroplayer-addons @@ -117,7 +117,7 @@ for addontxt in ${ADDONS_REPO_LOCATION}/*-addons.txt ; do fi ADDON_PATH="${ROOT}/packages/mediacenter/kodi-binary-addons/${ADDON}/" - if [ -f "${ADDON_PATH}/package.mk" ] ; then + if [ -f "${ADDON_PATH}/package.mk" ]; then # Verify the Kodi repo matches our package repo # If different, ignore the addon and process it later as an "unofficial" addon validate_pkg_url "${ADDON}" "${GIT_REPO}" || continue diff --git a/tools/mkpkg/update_retroplayer-addons b/tools/mkpkg/update_retroplayer-addons index ea79e0a6de..4327e96f20 100755 --- a/tools/mkpkg/update_retroplayer-addons +++ b/tools/mkpkg/update_retroplayer-addons @@ -18,34 +18,33 @@ usage() { while [ $# -ne 0 ]; do case "$1" in - -b|--bump-pkg-rev) - BUMP_PKG_REV="yes" - shift - ;; - -d|--delete-git-dirs) - KEEP_GIT_DIRS="" - shift - ;; - -f|--force-libretro-bump) - FORCE_LIBRETRO_BUMP="yes" - shift - ;; - -h|--help) - usage - exit 1 - ;; - -*) - echo "illegal option $1" - usage - exit 1 - ;; - *) - break - ;; + -b | --bump-pkg-rev) + BUMP_PKG_REV="yes" + shift + ;; + -d | --delete-git-dirs) + KEEP_GIT_DIRS="" + shift + ;; + -f | --force-libretro-bump) + FORCE_LIBRETRO_BUMP="yes" + shift + ;; + -h | --help) + usage + exit 1 + ;; + -*) + echo "illegal option $1" + usage + exit 1 + ;; + *) + break + ;; esac done - if [ $# -eq 0 -o $# -gt 2 ]; then usage exit 1 @@ -88,7 +87,7 @@ ADDONS_DIR="${ADDONS}.git" ADDONS_REPO="https://github.com/kodi-game/repo-binary-addons.git" git_clone ${ADDONS_REPO} ${ADDONS_DIR} ${KODI_BRANCH} -for addon in ${ADDONS_DIR}/*.*/ ; do +for addon in ${ADDONS_DIR}/*.*/; do GAME_ADDON=$(basename ${addon}) [[ "${GAME_ADDON}" =~ ^game. ]] || continue @@ -104,7 +103,7 @@ for addon in ${ADDONS_DIR}/*.*/ ; do GAME_GIT_BRANCH=$(cat $addon/${GAME_ADDON}.txt | awk '{print $3}') GAME_PATH="${ROOT}/packages/mediacenter/kodi-binary-addons/${GAME_ADDON}" - if [ ! -d "$GAME_PATH" ] ; then + if [ ! -d "$GAME_PATH" ]; then msg_warn "SKIPPING ${GAME_ADDON}, not present in LE" continue fi @@ -185,7 +184,7 @@ for addon in ${ADDONS_DIR}/*.*/ ; do fi VERSION_INFO=$(grep "^${RETRO_NAME}" "${RETRO_VERSION_FILE}" | head -1) - if [[ "$VERSION_INFO" =~ github\.com/[^/]+/[^/]+/archive/[^/]+\.tar\..*$ ]] ; then + if [[ "$VERSION_INFO" =~ github\.com/[^/]+/[^/]+/archive/[^/]+\.tar\..*$ ]]; then # version referenced by githash RETRO_NEW_VERSION=$(echo "${VERSION_INFO}" | sed -E -e 's|^(.+/archive/)([^/]+)(\.tar.*)$|\2|') RETRO_NEW_REPO=$(echo "${VERSION_INFO}" | sed -E -e 's|^(.+github\.com/)([^/]+/[^/]+)(/archive/.*)$|\2|') @@ -223,12 +222,11 @@ for addon in ${ADDONS_DIR}/*.*/ ; do done msg_info "Checking for orphaned addon packages in LE" -for addon in ${ROOT}/packages/mediacenter/kodi-binary-addons/game.libretro.* ; do +for addon in ${ROOT}/packages/mediacenter/kodi-binary-addons/game.libretro.*; do GAME_ADDON=$(basename ${addon}) - if [ ! -d "${ADDONS_DIR}/${GAME_ADDON}" ] ; then + if [ ! -d "${ADDONS_DIR}/${GAME_ADDON}" ]; then msg_warn "ORHPANED ${GAME_ADDON}, not present in kodi game repo" fi done rm -rf "${TMPDIR}" - diff --git a/tools/pkgcheck b/tools/pkgcheck index fb509b83cd..f44a38e435 100755 --- a/tools/pkgcheck +++ b/tools/pkgcheck @@ -39,21 +39,20 @@ process_line() { rightside="${line#*=}" for var in PKG_SHORTDESC PKG_LONGDESC PKG_IS_ADDON PKG_NEED_UNPACK PKG_SOURCE_NAME PKG_ADDON_IS_STANDALONE \ - PKG_CONFIGURE_SCRIPT PKG_CMAKE_SCRIPT PKG_MESON_SCRIPT \ - PKG_DIR PKG_ADDON_ID PKG_BUILD \ - DESTIMAGE CC CXX CPP LD AS AR NM \ - RANLIB OBJCOPY OBJDUMP STRIP \ - CPPFLAGS CFLAGS CXXFLAGS LDFLAGS \ - PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_BASE PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_ALLOW_SYSTEM_CFLAGS PKG_CONFIG_ALLOW_SYSTEM_LIBS \ - CMAKE_CONF CMAKE \ - HOST_CC HOST_CXX HOSTCC HOSTCXX \ - CC_FOR_BUILD CXX_FOR_BUILD BUILD_CC BUILD_CXX \ - _python_sysroot _python_prefix _python_exec_prefix \ - TARGET_CONFIGURE_OPTS CMAKE_GENERATOR_NINJA TARGET_CMAKE_OPTS TARGET_MESON_OPTS \ - HOST_CONFIGURE_OPTS HOST_CMAKE_OPTS HOST_MESON_OPTS \ - INIT_CONFIGURE_OPTS INIT_CMAKE_OPTS INIT_MESON_OPTS \ - BOOTSTRAP_CONFIGURE_OPTS BOOTSTRAP_CMAKE_OPTS BOOTSTRAP_MESON_OPTS \ - ; do + PKG_CONFIGURE_SCRIPT PKG_CMAKE_SCRIPT PKG_MESON_SCRIPT \ + PKG_DIR PKG_ADDON_ID PKG_BUILD \ + DESTIMAGE CC CXX CPP LD AS AR NM \ + RANLIB OBJCOPY OBJDUMP STRIP \ + CPPFLAGS CFLAGS CXXFLAGS LDFLAGS \ + PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_BASE PKG_CONFIG_SYSROOT_DIR PKG_CONFIG_ALLOW_SYSTEM_CFLAGS PKG_CONFIG_ALLOW_SYSTEM_LIBS \ + CMAKE_CONF CMAKE \ + HOST_CC HOST_CXX HOSTCC HOSTCXX \ + CC_FOR_BUILD CXX_FOR_BUILD BUILD_CC BUILD_CXX \ + _python_sysroot _python_prefix _python_exec_prefix \ + TARGET_CONFIGURE_OPTS CMAKE_GENERATOR_NINJA TARGET_CMAKE_OPTS TARGET_MESON_OPTS \ + HOST_CONFIGURE_OPTS HOST_CMAKE_OPTS HOST_MESON_OPTS \ + INIT_CONFIGURE_OPTS INIT_CMAKE_OPTS INIT_MESON_OPTS \ + BOOTSTRAP_CONFIGURE_OPTS BOOTSTRAP_CMAKE_OPTS BOOTSTRAP_MESON_OPTS; do # After PKG_DIR, treat assigns to var as invalid [ "${var}" = "PKG_DIR" ] && assignallowed=N @@ -81,10 +80,9 @@ init_target_funcs() { for t in target host init bootstrap; do for f in pre_build \ - pre_configure configure post_configure \ - pre_make make post_make \ - pre_makeinstall makeinstall post_makeinstall \ - ; do + pre_configure configure post_configure \ + pre_make make post_make \ + pre_makeinstall makeinstall post_makeinstall; do funcs+=" ${f}_${t}" done done @@ -96,13 +94,12 @@ check_func_name() { local f for f in configure_package \ - pre_unpack unpack post_unpack \ - pre_patch post_patch \ - pre_configure \ - ${TARGET_FUNCS} \ - pre_install post_install \ - addon post_install_addon \ - ; do + pre_unpack unpack post_unpack \ + pre_patch post_patch \ + pre_configure \ + ${TARGET_FUNCS} \ + pre_install post_install \ + addon post_install_addon; do [[ ${line} =~ ^${f} ]] && return 0 done @@ -124,7 +121,7 @@ process_pkg() { if [[ "${line}" =~ \(\)[[:space:]]*\{ ]]; then funcname="${line//(*/}" - fc=$((fc+1)) + fc=$((fc + 1)) check_func_name "${filename}" "${lc}" "${line}" fi @@ -139,12 +136,12 @@ process_pkg() { [[ "${line}" =~ (\"$|\"[[:space:]]*$|\"[[:space:]]*#.*$) ]] && isassign=N [[ "${line}" =~ (^}|^[[:space:]]*}) ]] && funcname= - done < "${filename}" + done <"${filename}" # Duplicate function check while read -r count line; do [ -n "${line}" ] && log "${filename}" 0 "FAIL" "duplicate function def" "${line}" - done <<< "$(grep -E ".*() {" "${filename}" | sed 's/[[:space:]]*{.*//' | sort | uniq -c | grep -v ^[[:space:]]*1[[:space:]])" + done <<<"$(grep -E ".*() {" "${filename}" | sed 's/[[:space:]]*{.*//' | sort | uniq -c | grep -v ^[[:space:]]*1[[:space:]])" } TARGET_FUNCS="$(init_target_funcs)" diff --git a/tools/pkginfo b/tools/pkginfo index bcdd664846..7c0128abaf 100755 --- a/tools/pkginfo +++ b/tools/pkginfo @@ -16,9 +16,9 @@ shift echo "PROJECT=${PROJECT}, DEVICE=${DEVICE}, ARCH=${ARCH}" for v in PKG_NAME PKG_VERSION PKG_SITE PKG_URL PKG_DIR \ - PKG_NEED_UNPACK PKG_DEPENDS_UNPACK \ - PKG_DEPENDS_BOOTSTRAP PKG_DEPENDS_INIT PKG_DEPENDS_HOST PKG_DEPENDS_TARGET \ - PKG_IS_ADDON PKG_IS_KERNEL_PKG $@; do + PKG_NEED_UNPACK PKG_DEPENDS_UNPACK \ + PKG_DEPENDS_BOOTSTRAP PKG_DEPENDS_INIT PKG_DEPENDS_HOST PKG_DEPENDS_TARGET \ + PKG_IS_ADDON PKG_IS_KERNEL_PKG $@; do if [ "${STRIP}" = "yes" ]; then echo "${v}=\"${!v}\"" | sed "s#${ROOT}/##g" else diff --git a/tools/refresh-patches b/tools/refresh-patches index dc32bb39e5..0104344120 100755 --- a/tools/refresh-patches +++ b/tools/refresh-patches @@ -67,7 +67,7 @@ pkg_call_exists_opt pre_patch && pkg_call if [ "${TARGET_ARCH}" = "x86_64" ]; then PATCH_ARCH="x86" -elif [ "${PKG_IS_KERNEL_PKG}" = "yes" ]; then +elif [ "${PKG_IS_KERNEL_PKG}" = "yes" ]; then PATCH_ARCH="${TARGET_KERNEL_PATCH_ARCH:-${TARGET_ARCH}}" else PATCH_ARCH="${TARGET_PATCH_ARCH:-${TARGET_ARCH}}" @@ -92,20 +92,20 @@ rm -rf "${PKG_BUILD}/patches" mkdir -p "${PKG_BUILD}/patches" for i in ${PKG_DIR}/patches/*.patch \ - ${PKG_DIR}/patches/${PATCH_ARCH}/*.patch \ - ${PATCH_DIRS_PKG} \ - ${PKG_DIR}/patches/${PKG_VERSION}/*.patch \ - ${PKG_DIR}/patches/${PKG_VERSION}/${PATCH_ARCH}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PATCH_ARCH}/*.patch \ - ${PATCH_DIRS_PRJ} \ - ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PKG_VERSION}/*.patch \ - ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/${PKG_NAME}/*.patch; do + ${PKG_DIR}/patches/${PATCH_ARCH}/*.patch \ + ${PATCH_DIRS_PKG} \ + ${PKG_DIR}/patches/${PKG_VERSION}/*.patch \ + ${PKG_DIR}/patches/${PKG_VERSION}/${PATCH_ARCH}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PATCH_ARCH}/*.patch \ + ${PATCH_DIRS_PRJ} \ + ${PROJECT_DIR}/${PROJECT}/patches/${PKG_NAME}/${PKG_VERSION}/*.patch \ + ${PROJECT_DIR}/${PROJECT}/devices/${DEVICE}/patches/${PKG_NAME}/*.patch; do if [ -f "${i}" ]; then PATCH="${i#${ROOT}/}" mkdir -p "$(dirname ${PKG_BUILD}/patches/${PATCH})" ln -s "${i}" "${PKG_BUILD}/patches/${PATCH}" - echo "${PATCH}" >> "${PKG_BUILD}/patches/series" + echo "${PATCH}" >>"${PKG_BUILD}/patches/series" fi done diff --git a/tools/repo-tool b/tools/repo-tool index c1295aff01..c0a2165207 100755 --- a/tools/repo-tool +++ b/tools/repo-tool @@ -8,18 +8,18 @@ update_addons_xml() { echo "[*] cleanup addons ..." olddir="" - find target/addons/$ADDON_VERSION -iname 'changelog*.txt' | sort -rV | while read line ; do + find target/addons/$ADDON_VERSION -iname 'changelog*.txt' | sort -rV | while read line; do dir=$(dirname $line) - if [ "$olddir" = "$dir" ] ; then + if [ "$olddir" = "$dir" ]; then rm -f $line fi olddir=$dir done olddir="" - find target/addons/$ADDON_VERSION -iname '*.zip' | sort -rV | while read line ; do + find target/addons/$ADDON_VERSION -iname '*.zip' | sort -rV | while read line; do dir=$(dirname $line) - if [ "$olddir" = "$dir" ] ; then + if [ "$olddir" = "$dir" ]; then rm -f $line fi olddir=$dir @@ -27,26 +27,26 @@ update_addons_xml() { echo "[*] updating addons.xml* ..." rm -rf .addons - pwd=`pwd` - find target/addons/$ADDON_VERSION -iname addons.xml | while read line ; do - localdir=`echo $line | sed s/addons.xml//g` + pwd=$(pwd) + find target/addons/$ADDON_VERSION -iname addons.xml | while read line; do + localdir=$(echo $line | sed s/addons.xml//g) echo " [*] updating $line..." echo ' -' > $line.tmp - for zip in $localdir/*/*.zip ; do +' >$line.tmp + for zip in $localdir/*/*.zip; do mkdir -p ".addons/$localdir" unzip $zip "*/addon.xml" -d ".addons/$localdir" &>/dev/null done - find .addons/$localdir -iname addon.xml | grep -v resources/ | while read xml ; do - cat $xml | grep -v "> $line.tmp + find .addons/$localdir -iname addon.xml | grep -v resources/ | while read xml; do + cat $xml | grep -v ">$line.tmp done echo ' -' >> $line.tmp +' >>$line.tmp mv $line.tmp $line cd $localdir - md5sum addons.xml > addons.xml.md5 + md5sum addons.xml >addons.xml.md5 cd $pwd done rm -rf .addons @@ -57,7 +57,7 @@ touch_addons_xml() { if [ -d "projects/$PROJECT/devices" ]; then for DEVICE in $(ls -1 projects/$PROJECT/devices); do for archfile in projects/$PROJECT/devices/$DEVICE/linux/linux.*.conf; do - ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + ARCH=$(echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p') if [ ! -d target/addons/$ADDON_VERSION/$DEVICE/$ARCH ]; then break fi @@ -68,7 +68,7 @@ touch_addons_xml() { done else for archfile in projects/$PROJECT/linux/linux.*.conf; do - ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + ARCH=$(echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p') if [ ! -d target/addons/$ADDON_VERSION/$PROJECT/$ARCH ]; then break fi @@ -81,10 +81,10 @@ touch_addons_xml() { } upload() { - if [ -f .work/repoconfig ] ; then + if [ -f .work/repoconfig ]; then . .work/repoconfig fi - if [ -z "$RSYNC_REPO" ] ; then + if [ -z "$RSYNC_REPO" ]; then echo "*** ERROR: \$RSYNC_REPO not set. see .work/repoconfig ***" exit 0 fi @@ -99,48 +99,48 @@ build() { for PROJECT in $2; do if [ -n "$DEVICE" ]; then for archfile in projects/$PROJECT/devices/$DEVICE/linux/linux.*.conf; do - ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + ARCH=$(echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p') done else for archfile in projects/$PROJECT/linux/linux.*.conf; do - ARCH=`echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p'` + ARCH=$(echo $archfile | sed -n '$s/\.conf//;$s/.*\.//p') done fi - for package in $(find $1 -iname package.mk) ; do + for package in $(find $1 -iname package.mk); do ( - . $package - if [ "$PKG_IS_ADDON" = "yes" ] ; then - ADDON=$PKG_NAME - PROJECT=$PROJECT DEVICE=$DEVICE ARCH=$ARCH ./scripts/create_addon $ADDON - fi + . $package + if [ "$PKG_IS_ADDON" = "yes" ]; then + ADDON=$PKG_NAME + PROJECT=$PROJECT DEVICE=$DEVICE ARCH=$ARCH ./scripts/create_addon $ADDON + fi ) done done } update_revision() { - for package in $(find $1 -iname package.mk) ; do + for package in $(find $1 -iname package.mk); do [[ "$2" == "Y" && $package =~ .*/game.libretro.* ]] && continue ( - . $package - if [ "$PKG_IS_ADDON" = "yes" ] ; then - sed -i -e "s|PKG_REV=.*|PKG_REV=\"$((PKG_REV+1))\"|" $package - fi + . $package + if [ "$PKG_IS_ADDON" = "yes" ]; then + sed -i -e "s|PKG_REV=.*|PKG_REV=\"$((PKG_REV + 1))\"|" $package + fi ) done } update_repo_version() { - for package in $(find packages/addons -iname package.mk) ; do + for package in $(find packages/addons -iname package.mk); do ( - . $package - if [ "$PKG_IS_ADDON" = "yes" ] ; then - sed -i -e "s|PKG_ADDON_REPOVERSION=.*|PKG_ADDON_REPOVERSION=\"$ADDON_VERSION\"|" $package - sed -i -e "s|PKG_REV=.*|PKG_REV=\"100\"|" $package - changelog="$(echo $package | sed 's/package.mk/changelog.txt/')" - sed -i "1i${ADDON_VERSION}.100\n- Update for LibreELEC ${ADDON_VERSION}\n" $changelog - fi + . $package + if [ "$PKG_IS_ADDON" = "yes" ]; then + sed -i -e "s|PKG_ADDON_REPOVERSION=.*|PKG_ADDON_REPOVERSION=\"$ADDON_VERSION\"|" $package + sed -i -e "s|PKG_REV=.*|PKG_REV=\"100\"|" $package + changelog="$(echo $package | sed 's/package.mk/changelog.txt/')" + sed -i "1i${ADDON_VERSION}.100\n- Update for LibreELEC ${ADDON_VERSION}\n" $changelog + fi ) done } @@ -205,8 +205,8 @@ case $1 in update_revision "$repo" "$exclude_games" ;; -rv) - update_repo_version - ;; + update_repo_version + ;; -xml) touch_addons_xml update_addons_xml @@ -216,4 +216,3 @@ case $1 in exit 0 ;; esac - diff --git a/tools/update-scan b/tools/update-scan index 64fbeeea30..3a0f29f0f7 100755 --- a/tools/update-scan +++ b/tools/update-scan @@ -19,7 +19,7 @@ github_api_token="" github_api="no" test_github_api() { -# check for github user and token present at ~/.libreelec/options to activate github api checks + # check for github user and token present at ~/.libreelec/options to activate github api checks if [[ -n "${github_token}" || -n "${github_user}" ]]; then github_api_token="-u ${github_user}:${github_token}" # check if token works @@ -125,15 +125,16 @@ check_for_update() { # print version output line if [ ! -z "${API}" ]; then - printf "%s %s %s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}"; printf '\n' + printf "%s %s %s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}" + printf '\n' elif [ "${PKG_VERSION}" != "${upstream_version}" ]; then - printf "%-35s | %-40s | %-20s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}"; printf '\n' + printf "%-35s | %-40s | %-20s" "${PKG_NAME}" "${PKG_VERSION}" "${upstream_version}" + printf '\n' else PACKAGES_CURRENT+="${PKG_NAME} " fi } - # create list of packages if [ -n "${1}" ]; then PACKAGE_LIST="$(find packages/ -type d -name ${1})/package.mk" @@ -141,13 +142,14 @@ if [ -n "${1}" ]; then die "Package not found: ${1}" fi else - PACKAGE_LIST="$(find packages/ -type f -name package.mk \ - ! -path "packages/addons/addon-depends/adafruit-libraries-depends/*" \ - ! -path "packages/emulation/*" \ - ! -path "packages/linux/*" \ - ! -path "packages/mediacenter/*" \ - | awk '{FS="/" ; $0=$0 ; print $(NF-1)"|"$0}' | sort | cut -d"|" -f2 \ - )" + PACKAGE_LIST="$( + find packages/ -type f -name package.mk \ + ! -path "packages/addons/addon-depends/adafruit-libraries-depends/*" \ + ! -path "packages/emulation/*" \ + ! -path "packages/linux/*" \ + ! -path "packages/mediacenter/*" | + awk '{FS="/" ; $0=$0 ; print $(NF-1)"|"$0}' | sort | cut -d"|" -f2 + )" fi if [ -z "${API}" ]; then @@ -156,7 +158,8 @@ if [ -z "${API}" ]; then # output echo -e "\nUpdates found:\n" - printf "%-35s | %-40s | %-20s" "Package" "LE git master" "upstream location"; printf '\n' + printf "%-35s | %-40s | %-20s" "Package" "LE git master" "upstream location" + printf '\n' echo -e ''$_{1..140}'\b-' for check_version in ${PACKAGE_LIST}; do diff --git a/tools/viewplan b/tools/viewplan index 8a82e97cba..ac908f7eca 100755 --- a/tools/viewplan +++ b/tools/viewplan @@ -7,5 +7,5 @@ unset _CACHE_PACKAGE_LOCAL _CACHE_PACKAGE_GLOBAL _DEBUG_DEPENDS_LIST _DEBUG_PACK . config/options "" -${SCRIPTS}/pkgjson | ${SCRIPTS}/genbuildplan.py --show-wants --build ${@:-image} --warn-invalid ${GENFLAGS} || \ - die "FAILURE: Unable to generate plan" +${SCRIPTS}/pkgjson | ${SCRIPTS}/genbuildplan.py --show-wants --build ${@:-image} --warn-invalid ${GENFLAGS} || + die "FAILURE: Unable to generate plan"