Skip to content

Commit 7416a81

Browse files
committed
refactor _sudo_run into a variable for commands to run in the background
using `_sudo_run` in the background means `[ -t 0 ]` never happens, so instead this function should set a variable to be used for the sudo command.
1 parent 4660635 commit 7416a81

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

AppDir/bin/start-waydroid.src.hook

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _check_kernel() (
2222
fi
2323
)
2424

25-
_sudo_run() {
25+
_get_sudo() {
2626
if _is_cmd pkexec; then
2727
sudocmd=pkexec
2828
elif _is_cmd lxqt-sudo; then
@@ -37,7 +37,6 @@ _sudo_run() {
3737
zenity --info --text "Launch the AppImage from the terminal so we can prompt sudo/doas instead"
3838
exit 1
3939
fi
40-
"$sudocmd" "$@"
4140
}
4241

4342
_install_polkit_policy() (
@@ -65,7 +64,8 @@ _install_polkit_policy() (
6564
In that case you will have to remove those files manually!
6665
EOF
6766
)" || return 1
68-
_sudo_run /bin/sh -c "
67+
_get_sudo
68+
"$sudocmd" /bin/sh -c "
6969
mkdir -p /usr/share/polkit-1/actions
7070
mkdir -p /usr/share/dbus-1/system-services
7171
mkdir -p /usr/share/dbus-1/system.d
@@ -102,7 +102,8 @@ _is_session_running() {
102102

103103
_start_waydroid() {
104104
if ! _is_container_running; then
105-
_sudo_run "$APPDIR"/bin/python3 "$APPDIR"/bin/waydroid container start &
105+
_get_sudo
106+
"$sudocmd" "$APPDIR"/bin/python3 "$APPDIR"/bin/waydroid container start &
106107
fi
107108
# now we need to wait for the container to start
108109
count=0

0 commit comments

Comments
 (0)