Skip to content

Commit 96b879c

Browse files
committed
Update install script to allow relative path installation
* Also use a symbolic link in /var/lib/webosbrew/init.d/ so that simply removing the files will stop the init script from executing altogether. * Also add a notice when using telnet and rename the install/uninstall scripts.
1 parent f7f8044 commit 96b879c

File tree

3 files changed

+51
-21
lines changed

3 files changed

+51
-21
lines changed

README.txt

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ Limitations:
3535
Installation:
3636
-------------
3737

38-
- Open a root shell to your TV (e.g. using ssh)
39-
- Download, extract and run the installer by issuing:
40-
cd /home/root
41-
wget https://github.com/lgstreamer/dts_restore/releases/download/1.0/dts_restore_1.0.tgz
42-
tar -xzvf dts_restore_1.0.tgz
43-
./dts_install.sh
38+
- Open a root shell to your TV *using ssh* (not telnet!)
39+
- Download, extract and run the installer by issuing something like:
40+
cd ~
41+
wget https://github.com/lgstreamer/dts_restore/archive/refs/tags/1.1.tar.gz
42+
tar -xzvf 1.1.tar.gz
43+
./dts_restore-1.1/install.sh
4444

4545

4646
Uninstallation:
4747
---------------
4848

49-
- Open a root shell to your TV (e.g. using ssh)
50-
- Run the command: ./home/root/dts_uninstall.sh
49+
- Open a root shell to your TV
50+
- Run the commands:
51+
cd ~
52+
./dts_restore-1.1/uninstall.sh
5153
- Fully power off or reboot your TV.
5254

5355

@@ -58,7 +60,7 @@ Additional notes:
5860
content. All changes are applied in a temporary manner which means that,
5961
should you want reset media playback to its original behaviour, you can
6062
just remove the /var/lib/webosbrew/init.d/restore_dts init script or run
61-
dst_uninstall.sh.
63+
uninstall.sh.
6264
- If you still see the "This video does not support audio" message on first
6365
attempt, just close the video file and try again.
6466
- If you want to adjust the stereo downmix settings, you can edit the

dts_install.sh renamed to install.sh

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
#!/bin/bash
2-
1+
#!/usr/bin/env sh
32
# DTS playback restoration script for LG OLED CX
43
# Copyright (c) 2022-2023 Pete Batard <pete@akeo.ie>
54
# See https://github.com/RootMyTV/RootMyTV.github.io/issues/72#issuecomment-1343204028
65

7-
# Set the following to the directory where you have the GST plugins
8-
GST_SRC=/home/root/gst
6+
# Get the path where the script is located.
7+
# Adapted from https://github.com/rmyorston/busybox-w32/issues/154
8+
LAST_COMMAND="$_" # IMPORTANT: This must be the first command in the script
9+
ps_output="$(ps -o pid,comm | grep -Fw $$)"
10+
for cs in $ps_output; do
11+
CURRENT_SHELL=$cs
12+
done;
13+
if [[ -n "$BASH_SOURCE" ]]; then
14+
SCRIPT="${BASH_SOURCE[0]}"
15+
elif [[ "$0" != "$CURRENT_SHELL" ]] && [[ "$0" != "-$CURRENT_SHELL" ]]; then
16+
SCRIPT="$0"
17+
elif [[ -n "$LAST_COMMAND" ]]; then
18+
SCRIPT="$LAST_COMMAND"
19+
else
20+
echo "Could not get script path - Aborting";
21+
exit 1
22+
fi;
23+
24+
SCRIPT=$(realpath "$SCRIPT" 2>&-)
25+
SCRIPT_DIR=$(dirname "$SCRIPT")
26+
27+
# Set the directory where the GST plugins are located
28+
GST_SRC=$SCRIPT_DIR/gst
929

1030
# Validate that we have the relevant init.d directory
1131
INIT_DIR=/var/lib/webosbrew/init.d
@@ -15,8 +35,12 @@ if [[ ! -d $INIT_DIR ]]; then
1535
fi
1636

1737
# Validate that there is a GStreamer registry to override
18-
if [[ -z $GST_REGISTRY_1_0 ]] || [[ ! -f $GST_REGISTRY_1_0 ]]; then
19-
echo 'Could not locate GStreamer registry on this environment - Aborting'
38+
if [[ -z "$GST_REGISTRY_1_0" ]] || [[ ! -f "$GST_REGISTRY_1_0" ]]; then
39+
echo "Could not locate the GStreamer registry on this environment - Aborting"
40+
echo
41+
echo "If needed, please make sure that you use an ssh session and not a"
42+
echo "telnet session when running this installer, as telnet is missing the"
43+
echo "required environmental variables and is known to cause this issue..."
2044
exit 1
2145
fi
2246

@@ -63,10 +87,9 @@ if [[ "$GST_VERSION" != "1.14.4" || "${WEBOS_VERSION::1}" != "5" || "${MODEL_NAM
6387
esac
6488
fi
6589

66-
echo "Installing $INIT_DIR/restore_dts"
67-
68-
# The script must *NOT* have a .sh extension
69-
cat <<EOS > $INIT_DIR/restore_dts
90+
# Create the init script
91+
echo "Creating $SCRIPT_DIR/init_dts.sh"
92+
cat <<EOS > $SCRIPT_DIR/init_dts.sh
7093
#!/bin/bash
7194
7295
# Override the GST plugins that were nerfed by LG
@@ -105,10 +128,15 @@ EOT
105128
fi
106129
fi
107130
EOS
131+
chmod 755 $SCRIPT_DIR/init_dts.sh
132+
133+
# Install/link the init script into the webosbrew init directory
134+
echo "Creating $INIT_DIR/restore_dts symbolic link"
135+
# The $INIT_DIR script must *NOT* have a .sh extension
136+
ln -s $SCRIPT_DIR/init_dts.sh $INIT_DIR/restore_dts
108137

109-
chmod 755 $INIT_DIR/restore_dts
110138
if [[ ! -f /tmp/gstcool.conf ]]; then
111139
echo "Running $INIT_DIR/restore_dts"
112-
source $INIT_DIR/restore_dts
140+
source $INIT_DIR/restore_dts || exit 1
113141
echo "DTS playback has been permanently re-enabled - Enjoy!"
114142
fi
File renamed without changes.

0 commit comments

Comments
 (0)